pub struct DynamicSourcePolicy { /* private fields */ }Expand description
Reusable policy for dynamic source evaluated through a named codec.
The policy fixes only the source provenance and codec. Authority and the
expected result shape remain explicit inputs to every evaluation, so a
guest-language wrapper cannot accidentally retain or widen either one.
Callers that need origin detail must provide it in RequestOrigin when
constructing the policy.
Implementations§
Source§impl DynamicSourcePolicy
impl DynamicSourcePolicy
Sourcepub fn new(codec: Symbol, origin: RequestOrigin) -> DynamicSourcePolicy
pub fn new(codec: Symbol, origin: RequestOrigin) -> DynamicSourcePolicy
Builds a policy with its own decision ledger.
Sourcepub fn with_broker(
broker: ReadEvalBroker,
codec: Symbol,
origin: RequestOrigin,
) -> DynamicSourcePolicy
pub fn with_broker( broker: ReadEvalBroker, codec: Symbol, origin: RequestOrigin, ) -> DynamicSourcePolicy
Builds a policy over an existing broker.
Cloned brokers share their ledger, allowing several origin/codec policies to expose one ordered decision stream.
Sourcepub fn evaluate_text(
&self,
cx: &mut Cx,
text: impl Into<String>,
authority: SourceAuthority,
expected_shape: Arc<dyn Shape>,
) -> Result<Value, Error>
pub fn evaluate_text( &self, cx: &mut Cx, text: impl Into<String>, authority: SourceAuthority, expected_shape: Arc<dyn Shape>, ) -> Result<Value, Error>
Evaluates text decoded through this policy’s codec.
Sourcepub fn evaluate_bytes(
&self,
cx: &mut Cx,
bytes: impl Into<Vec<u8>>,
authority: SourceAuthority,
expected_shape: Arc<dyn Shape>,
) -> Result<Value, Error>
pub fn evaluate_bytes( &self, cx: &mut Cx, bytes: impl Into<Vec<u8>>, authority: SourceAuthority, expected_shape: Arc<dyn Shape>, ) -> Result<Value, Error>
Evaluates bytes decoded through this policy’s codec.
Sourcepub fn evaluate_expr(
&self,
cx: &mut Cx,
expr: Expr,
authority: SourceAuthority,
expected_shape: Arc<dyn Shape>,
) -> Result<Value, Error>
pub fn evaluate_expr( &self, cx: &mut Cx, expr: Expr, authority: SourceAuthority, expected_shape: Arc<dyn Shape>, ) -> Result<Value, Error>
Evaluates an already-decoded expression through the same admission gate.
Sourcepub fn evaluate(
&self,
cx: &mut Cx,
source: ReadEvalSource,
authority: SourceAuthority,
expected_shape: Arc<dyn Shape>,
) -> Result<Value, Error>
pub fn evaluate( &self, cx: &mut Cx, source: ReadEvalSource, authority: SourceAuthority, expected_shape: Arc<dyn Shape>, ) -> Result<Value, Error>
Evaluates any supported source form through the shared broker law.
Sourcepub fn decisions(&self, cx: &Cx) -> Result<Vec<ReadEvalDecision>, Error>
pub fn decisions(&self, cx: &Cx) -> Result<Vec<ReadEvalDecision>, Error>
Returns decisions recorded in the policy’s default run.
Sourcepub fn decisions_for_run(
&self,
cx: &Cx,
run: &Ref,
) -> Result<Vec<ReadEvalDecision>, Error>
pub fn decisions_for_run( &self, cx: &Cx, run: &Ref, ) -> Result<Vec<ReadEvalDecision>, Error>
Returns decisions recorded for run.
Trait Implementations§
Source§impl Clone for DynamicSourcePolicy
impl Clone for DynamicSourcePolicy
Source§fn clone(&self) -> DynamicSourcePolicy
fn clone(&self) -> DynamicSourcePolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DynamicSourcePolicy
impl RefUnwindSafe for DynamicSourcePolicy
impl Send for DynamicSourcePolicy
impl Sync for DynamicSourcePolicy
impl Unpin for DynamicSourcePolicy
impl UnsafeUnpin for DynamicSourcePolicy
impl UnwindSafe for DynamicSourcePolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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