Skip to main content

DecisionBackend

Trait DecisionBackend 

Source
pub trait DecisionBackend: Send + Sync {
    // Required methods
    fn descriptor(&self) -> &BackendDescriptor;
    fn cost_model(&self) -> CostModel;
    fn cost_bound(&self, projection: &[u8]) -> CostBound;
    fn infer<'a>(
        &'a self,
        call: AttemptCall<'a>,
    ) -> BoxFuture<'a, AttemptReport>;

    // Provided methods
    fn infer_generation<'a>(
        &'a self,
        call: AttemptCall<'a>,
        _fields: &'a dyn GenerationFields,
    ) -> BoxFuture<'a, AttemptReport> { ... }
    fn batch_capability(&self, _projection: &[u8]) -> Option<BatchCapability> { ... }
    fn take_remote_evidence(&self, _attempt_id: &str) -> Option<RemoteEvidence> { ... }
    fn infer_batch<'a>(
        &'a self,
        _call: BatchAttemptCall,
    ) -> BoxFuture<'a, BatchAttemptReport> { ... }
}
Expand description

Answers semantic requests. States its capabilities and its cost; never manufactures a distribution or a calibration claim.

Required Methods§

Source

fn descriptor(&self) -> &BackendDescriptor

Source

fn cost_model(&self) -> CostModel

Static disclosure: whether every call has an enforceable upper bound.

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>

Provided Methods§

Source

fn infer_generation<'a>( &'a self, call: AttemptCall<'a>, _fields: &'a dyn GenerationFields, ) -> BoxFuture<'a, AttemptReport>

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, ) -> BoxFuture<'a, BatchAttemptReport>

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

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§