Skip to main content

RulesBackend

Struct RulesBackend 

Source
pub struct RulesBackend { /* private fields */ }
Expand description

A validated rules program, ready to answer requests.

Implementations§

Source§

impl RulesBackend

Source

pub fn check_plan(&self, plan: &Plan) -> Result<(), Vec<PlanMismatch>>

Check every semantic or rank step plan binds to this backend, as primary or runtime fallback target. Returns every mismatch; an empty plan use is not an error.

Source§

impl RulesBackend

Source

pub fn new(program: RulesProgram) -> Result<Self, ProgramError>

Validate program and derive the descriptor and artifact identity (spec 005, 3.3, 3.9 and 3.10). The program is the only input: there is no other behavior-affecting configuration.

Source

pub fn from_bytes(bytes: &[u8]) -> Result<Self, ProgramError>

Parse and validate program bytes supplied by the host.

Source

pub fn program(&self) -> &RulesProgram

The program, including each task’s authored interpretation (3.8).

Source

pub fn artifact(&self) -> &ArtifactId

The artifact identity: the program’s digest.

Source

pub fn evaluate(&self, projection: &[u8], cancel: &CancelSignal) -> Evaluated

Answer one canonical projection synchronously, observing cancel at the points of spec 005 3.13.1. Usable without any runtime.

Trait Implementations§

Source§

impl Clone for RulesBackend

Source§

fn clone(&self) -> Self

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 Debug for RulesBackend

Source§

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

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

impl DecisionBackend for RulesBackend

Source§

fn cost_model(&self) -> CostModel

Every call is bounded by the program’s units_per_call (3.12).

Source§

fn descriptor(&self) -> &BackendDescriptor

Source§

fn cost_bound(&self, _projection: &[u8]) -> CostBound

Per-call disclosure before dispatch. A bounded model returns bounded; fractional costs are rounded up.
Source§

fn infer<'a>(&'a self, call: AttemptCall<'a>) -> BoxFuture<'a, AttemptReport>

Source§

fn infer_generation<'a>( &'a self, call: AttemptCall<'a>, _fields: &'a dyn GenerationFields, ) -> Pin<Box<dyn Future<Output = AttemptReport> + Send + 'a>>

Optional generation streaming. Existing backends return their ordinary complete report without emitting provisional fields.
Source§

fn batch_capability(&self, _projection: &[u8]) -> Option<BatchCapability>

Opt-in general batch declaration. None preserves unbatched behavior.
Source§

fn take_remote_evidence(&self, _attempt_id: &str) -> Option<RemoteEvidence>

The remote evidence of an attempt this backend ran, for a rustev.run/2 record (spec 020, 3.2), taken once: the adapter’s part of the entry (exchange reference, identities, binding, code, charge provenance); the runtime sets the step, instance and final remote state. None, the default, for an in-process backend.
Source§

fn infer_batch<'a>( &'a self, _call: BatchAttemptCall, ) -> Pin<Box<dyn Future<Output = BatchAttemptReport> + Send + 'a>>

Dispatch a declared-compatible batch. The default is unreachable for a backend that keeps the default batch_capability implementation.

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.