Skip to main content

CedarEvaluator

Struct CedarEvaluator 

Source
pub struct CedarEvaluator {
    pub(crate) shapes: Arc<Shapes>,
    pub(crate) documents: RwLock<Vec<Arc<Document>>>,
}
Expand description

The engine: one set of shapes, and every document compiled against it.

Fields§

§shapes: Arc<Shapes>§documents: RwLock<Vec<Arc<Document>>>

Implementations§

Source§

impl CedarEvaluator

Source

pub fn new(shapes: Arc<Shapes>) -> Self

An engine that validates against shapes.

Source

pub(crate) fn document( &self, compiled: CompiledId, ) -> Result<Arc<Document>, EvalError>

Trait Implementations§

Source§

impl Evaluator for CedarEvaluator

Source§

fn evaluate( &self, subject: &Subject<'_>, compiled: CompiledId, ) -> Result<Outcome, EvalError>

Statements asked about the same subject on one thread share the request built for it, whichever evaluator holds them.

Source§

fn compile(&self, predicate: &Value) -> CompileOutcome

Compile a predicate document into a live artifact this evaluator can judge, or say why it cannot. Read more
Source§

fn observe(&self, _event: &Observed<'_>)

Every attempt and outcome on the declared observation surface, whether or not evaluation short-circuited. The decision channel short-circuits; this one does not.
Source§

fn lifecycle(&self, _event: &Lifecycle<'_>)

froze / unfroze / deleted, so per-account state does not outlive its account.
Source§

fn staleness(&self) -> Staleness

How stale this evaluator’s view may be before it counts as unhealthy.
Source§

fn policy_lifecycle(&self, event: PolicyLifecycle)

loaded / superseded / removed, so per-policy state does not outlive the artifact it belongs to — see PolicyLifecycle’s doc comment. Defaulted to a no-op: an evaluator that holds no state per compiled artifact (this crate’s regex evaluator, most builtins) has nothing to clean up, and should not be forced to write an empty override just to say so.

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. 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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more