Skip to main content

RealizeRequest

Struct RealizeRequest 

Source
pub struct RealizeRequest {
    pub term: Term,
    pub result_shape: Option<Ref>,
    pub required_capabilities: Vec<CapabilityName>,
    pub deadline: Option<Duration>,
    pub consistency: Consistency,
    pub mode: EvalMode,
    pub answer_limit: Option<usize>,
    pub buffer_limit: Option<usize>,
    pub observe: ObserveMode,
}
Expand description

A reference-based realize request: the portable form of an EvalRequest.

Where EvalRequest carries an in-process Expr and live values, a RealizeRequest carries a Term and Refs, so it can cross a transport boundary. The two convert via from_eval_request and to_eval_request. See the README section “Distributed evaluation”.

§Examples

use sim_kernel::realize::{ObserveMode, RealizeRequest};
use sim_kernel::term::Term;
use sim_kernel::Symbol;

let request = RealizeRequest::new(Term::Local(Symbol::new("x")))
    .observing(ObserveMode::Events);
assert_eq!(request.observe, ObserveMode::Events);
assert!(request.required_capabilities.is_empty());

Fields§

§term: Term

The term to evaluate.

§result_shape: Option<Ref>

Optional reference to a shape the result must satisfy.

§required_capabilities: Vec<CapabilityName>

Capabilities the evaluation requires.

§deadline: Option<Duration>

Optional wall-clock deadline for the evaluation.

§consistency: Consistency

Where the request may be answered from.

§mode: EvalMode

Which evaluation discipline to run under.

§answer_limit: Option<usize>

Optional cap on the number of answers (logic mode).

§buffer_limit: Option<usize>

Optional buffer size for streamed events.

§observe: ObserveMode

How much of the evaluation to observe.

Implementations§

Source§

impl RealizeRequest

Source

pub fn new(term: Term) -> Self

Creates a request to realize term with all defaults.

Source

pub fn observing(self, observe: ObserveMode) -> Self

Sets the ObserveMode, returning the request (builder style).

Source

pub fn requiring(self, capability: CapabilityName) -> Self

Adds a required capability, returning the request (builder style).

Source

pub fn from_eval_request(cx: &mut Cx, request: &EvalRequest) -> Result<Self>

Builds a RealizeRequest from an in-process EvalRequest.

Live values become Refs and the Expr becomes a Term so the request can cross a transport boundary.

Source

pub fn to_eval_request(&self, cx: &mut Cx) -> Result<EvalRequest>

Resolves this request back into an in-process EvalRequest.

The inverse of from_eval_request: Term and Refs are resolved against cx into an Expr and live values.

Trait Implementations§

Source§

impl Clone for RealizeRequest

Source§

fn clone(&self) -> RealizeRequest

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 RealizeRequest

Source§

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

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

impl Eq for RealizeRequest

Source§

impl PartialEq for RealizeRequest

Source§

fn eq(&self, other: &RealizeRequest) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for RealizeRequest

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> 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.