pub struct NeedPolicy;Expand description
A call-by-need policy: arguments are thunked and forced at most once.
Each argument becomes a memoizing ThunkObject whose value is computed
on first force and cached for later uses.
Trait Implementations§
Source§impl EvalPolicy for NeedPolicy
impl EvalPolicy for NeedPolicy
Source§fn allow_macro_expansion(&self, phase: Phase) -> bool
fn allow_macro_expansion(&self, phase: Phase) -> bool
Source§fn prepare_call_args(
&self,
cx: &mut Cx,
raw: RawArgs,
_demands: &[Demand],
) -> Result<PreparedArgs>
fn prepare_call_args( &self, cx: &mut Cx, raw: RawArgs, _demands: &[Demand], ) -> Result<PreparedArgs>
Prepares raw call arguments into
PreparedArgs per the demands. Read moreSource§fn force(&self, cx: &mut Cx, value: Value, demand: Demand) -> Result<Value>
fn force(&self, cx: &mut Cx, value: Value, demand: Demand) -> Result<Value>
Forces
value far enough to satisfy demand.Source§fn eval_expr(&self, cx: &mut Cx, expr: Expr) -> Result<Value>
fn eval_expr(&self, cx: &mut Cx, expr: Expr) -> Result<Value>
Evaluates a bare expression to a value under this policy.
Auto Trait Implementations§
impl Freeze for NeedPolicy
impl RefUnwindSafe for NeedPolicy
impl Send for NeedPolicy
impl Sync for NeedPolicy
impl Unpin for NeedPolicy
impl UnsafeUnpin for NeedPolicy
impl UnwindSafe for NeedPolicy
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
Mutably borrows from an owned value. Read more