pub enum Demand {
Never,
Expr,
Value,
Bool,
Class(ClassId),
Shape(ShapeId),
}Expand description
How strongly an argument position demands its value be forced.
A Demand is the contract an EvalPolicy consults
when preparing call arguments: it states how far a value must be driven
before the callable sees it, from “leave it as an unevaluated expression”
to “force it to a value of a specific class or shape”. The kernel only
defines the demand vocabulary; libraries decide how to satisfy each variant.
§Examples
use sim_kernel::eval::Demand;
// The vocabulary is plain, copyable data.
let demand = Demand::Value;
assert_eq!(demand, Demand::Value);
assert_ne!(Demand::Value, Demand::Expr);Variants§
Never
Never force; the argument is passed through untouched.
Expr
Force to an expression form (leave it quoted, do not evaluate).
Value
Force to a fully evaluated value.
Bool
Force to a value and coerce to its boolean truth.
Class(ClassId)
Force to a value required to be of the given class.
Shape(ShapeId)
Force to a value required to match the given shape.
Trait Implementations§
impl Copy for Demand
impl Eq for Demand
impl StructuralPartialEq for Demand
Auto Trait Implementations§
impl Freeze for Demand
impl RefUnwindSafe for Demand
impl Send for Demand
impl Sync for Demand
impl Unpin for Demand
impl UnsafeUnpin for Demand
impl UnwindSafe for Demand
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