Callbacks

Struct Callbacks 

pub struct Callbacks { /* private fields */ }
Expand description

Provides a simple implementation of the FapiCallbacks trait.

Implementations§

§

impl Callbacks

pub fn new<AuthFn, SignFn, BranchFn, PolicyActionFn>( auth_fn: AuthFn, sign_fn: SignFn, branch_fn: BranchFn, policy_action_fn: PolicyActionFn, ) -> Self
where AuthFn: Fn(AuthCbParam<'_>) -> Option<Cow<'static, str>> + Send + 'static, SignFn: Fn(SignCbParam<'_>) -> Option<Vec<u8>> + Send + 'static, BranchFn: Fn(BranchCbParam<'_>) -> Option<usize> + Send + 'static, PolicyActionFn: Fn(PolicyActionCbParam<'_>) -> bool + Send + 'static,

Creates a new Callbacks instance with application-defined callback functions.

Instances of this struct are registered with a FAPI context via the FapiContext::set_callbacks() function.

pub fn with_auth<F>(auth_fn: F) -> Self
where F: Fn(AuthCbParam<'_>) -> Option<Cow<'static, str>> + Send + 'static,

Creates a Callbacks instance with an application-defined auth_cb callback function.

All other callback functions will use the default implementation.

pub fn with_sign<F>(sign_fn: F) -> Self
where F: Fn(SignCbParam<'_>) -> Option<Vec<u8>> + Send + 'static,

Creates a Callbacks instance with an application-defined sign_cb callback function.

All other callback functions will use the default implementation.

pub fn with_branch<F>(branch_fn: F) -> Self
where F: Fn(BranchCbParam<'_>) -> Option<usize> + Send + 'static,

Creates a Callbacks instance with an application-defined branch_cb callback function.

All other callback functions will use the default implementation.

pub fn with_policy_action<F>(policy_action_fn: F) -> Self
where F: Fn(PolicyActionCbParam<'_>) -> bool + Send + 'static,

Creates a Callbacks instance with an application-defined policy_action_cb callback function.

All other callback functions will use the default implementation.

Trait Implementations§

§

impl FapiCallbacks for Callbacks

§

fn auth_cb( &mut self, param: AuthCbParam<'_>, ) -> Result<Cow<'static, str>, Cancelled>

A callback function that allows the FAPI to request authorization values. Read more
§

fn sign_cb(&mut self, param: SignCbParam<'_>) -> Result<Vec<u8>, Cancelled>

A callback function that allows the FAPI to request signatures. Read more
§

fn branch_cb(&mut self, param: BranchCbParam<'_>) -> Result<usize, Cancelled>

A callback function that allows the FAPI to request branch choices. Read more
§

fn policy_action_cb( &mut self, param: PolicyActionCbParam<'_>, ) -> Result<(), Cancelled>

A callback function that allows the FAPI to notify the application. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.