pub trait StateResolver {
type Error: 'static + Send + StateResolverError + Sync + Error;
// Required method
fn get_state<'life0, 'async_trait>(
&'life0 self,
use_case: String,
) -> Pin<Box<dyn Future<Output = Result<State, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
Defines how a state resolver looks like in general.
Required Associated Types§
Sourcetype Error: 'static + Send + StateResolverError + Sync + Error
type Error: 'static + Send + StateResolverError + Sync + Error
The error type emitted by this trait’s functions.
Note that the error is supposed to implement StateResolverError
to communicate standard errors.
Required Methods§
Sourcefn get_state<'life0, 'async_trait>(
&'life0 self,
use_case: String,
) -> Pin<Box<dyn Future<Output = Result<State, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_state<'life0, 'async_trait>(
&'life0 self,
use_case: String,
) -> Pin<Box<dyn Future<Output = Result<State, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Retrieves the current reasoner state necessary for resolving policies.
Note that this state is agnostic to the specific reasoner connector used (and therefore policy language).
§Arguments
use_case
: Some identifier that allows the state resolver to assume a different state depending on the use-case used.
§Returns
A new State
struct that encodes the current state.
§Errors
This function may error whenever it likes. However, it’s recommended to trigger the errors specified in the StateResolverError
trait if applicable.