Skip to main content

KeepsakeResolver

Struct KeepsakeResolver 

Source
pub struct KeepsakeResolver<S, M = TenantScopedSubjectMapper> { /* private fields */ }
Expand description

Resolves gatekeep facts from active keepsake relations for the principal.

Implementations§

Source§

impl<S> KeepsakeResolver<S, TenantScopedSubjectMapper>

Source

pub const fn new(source: S) -> Self

Builds a resolver around an active-relation source.

Source§

impl<S, M> KeepsakeResolver<S, M>

Source

pub const fn with_subject_mapper(source: S, subject_mapper: M) -> Self

Builds a resolver with an explicit subject mapper.

Source

pub fn map_subjects<Next>( self, subject_mapper: Next, ) -> KeepsakeResolver<S, Next>

Replaces the subject mapper.

Source

pub fn with_binding(self, binding: FactBinding) -> Self

Adds or replaces a fact binding.

Source

pub fn insert_binding(&mut self, binding: FactBinding)

Adds or replaces a fact binding.

Source

pub fn with_relation_spec<F, R>(self) -> Result<Self, FactBindingError>
where F: Fact, R: RelationSpec,

Adds or replaces a typed fact-to-relation binding.

§Errors

Returns FactBindingError::Gatekeep if the fact marker exposes an invalid stable id.

Source

pub fn with_resolved_relation<F, R>(self) -> Result<Self, FactBindingError>
where F: Fact, R: RelationSpec,

Adds or replaces a typed binding that is resolved during query preparation.

§Errors

Returns FactBindingError::Gatekeep if the fact marker exposes an invalid stable id.

Source

pub fn with_deferred_relation<F, R>(self) -> Result<Self, FactBindingError>
where F: Fact, R: RelationSpec,

Adds or replaces a typed binding that is deferred during query preparation for row-level lowering.

§Errors

Returns FactBindingError::Gatekeep if the fact marker exposes an invalid stable id.

Source

pub fn with_relation_spec_query_presence<F, R>( self, query_presence: QueryPresence, ) -> Result<Self, FactBindingError>
where F: Fact, R: RelationSpec,

Adds or replaces a typed binding with explicit query-mode behavior.

§Errors

Returns FactBindingError::Gatekeep if the fact marker exposes an invalid stable id.

Source

pub fn with_relation_spec_on_subject<F, R>( self, subject_slot: SubjectSlot, ) -> Result<Self, FactBindingError>
where F: Fact, R: RelationSpec,

Adds or replaces a typed binding resolved against a request-scoped subject slot.

§Errors

Returns FactBindingError::Gatekeep if the fact marker exposes an invalid stable id.

Source

pub const fn bindings(&self) -> &BTreeMap<FactId, FactBinding>

Returns the configured bindings keyed by fact id.

Source

pub const fn source(&self) -> &S

Returns the wrapped active-relation source.

Source

pub const fn subject_mapper(&self) -> &M

Returns the subject mapper.

Source§

impl<S, M> KeepsakeResolver<S, M>
where M: SubjectMapper,

Source

pub fn target_for_binding( &self, binding: &FactBinding, cx: &Context, ) -> Result<KeepsakeRelationTarget, KeepsakeTargetError>

Resolves one binding into the keepsake subject/relation target used for lookups.

§Errors

Returns KeepsakeTargetError::MissingSubjectSlot when the binding targets a request-scoped subject absent from the context, or KeepsakeTargetError::Subject when keepsake rejects the mapped subject.

Source

pub fn target_for_fact( &self, fact: &FactId, cx: &Context, ) -> Result<KeepsakeRelationTarget, KeepsakeTargetError>

Resolves a configured fact id into its keepsake subject/relation target.

§Errors

Returns KeepsakeTargetError::MissingBinding when the fact has no configured binding. Also returns the subject-resolution errors documented by Self::target_for_binding.

Source

pub fn targets_for_facts( &self, facts: &[FactId], cx: &Context, ) -> Result<Vec<KeepsakeRelationTarget>, KeepsakeTargetError>

Resolves configured fact ids into keepsake subject/relation targets.

§Errors

Returns the first KeepsakeTargetError encountered while resolving the requested facts.

Trait Implementations§

Source§

impl<S: Clone, M: Clone> Clone for KeepsakeResolver<S, M>

Source§

fn clone(&self) -> KeepsakeResolver<S, M>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S: Debug, M: Debug> Debug for KeepsakeResolver<S, M>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<S, M> FactResolver for KeepsakeResolver<S, M>

Source§

type Error = KeepsakeResolveError<<S as ActiveRelationSource>::Error>

Resolver-specific backend error.
Source§

fn resolve_for_decision<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, required: &'life1 [FactId], cx: &'life2 Context, ) -> Pin<Box<dyn Future<Output = Result<KnownFacts, ResolveError<Self::Error>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Resolves every required fact to present or absent for a single decision.
Source§

fn resolve_for_query<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, required: &'life1 [FactId], cx: &'life2 Context, ) -> Pin<Box<dyn Future<Output = Result<PartialFacts, ResolveError<Self::Error>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Resolves known request facts and marks query-deferred facts as unknown.

Auto Trait Implementations§

§

impl<S, M> Freeze for KeepsakeResolver<S, M>
where S: Freeze, M: Freeze,

§

impl<S, M> RefUnwindSafe for KeepsakeResolver<S, M>

§

impl<S, M> Send for KeepsakeResolver<S, M>
where S: Send, M: Send,

§

impl<S, M> Sync for KeepsakeResolver<S, M>
where S: Sync, M: Sync,

§

impl<S, M> Unpin for KeepsakeResolver<S, M>
where S: Unpin, M: Unpin,

§

impl<S, M> UnsafeUnpin for KeepsakeResolver<S, M>
where S: UnsafeUnpin, M: UnsafeUnpin,

§

impl<S, M> UnwindSafe for KeepsakeResolver<S, M>
where S: UnwindSafe, M: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.