pub struct GuestRuntimeKit {
pub truth: Arc<dyn TruthPolicy>,
pub coerce: Arc<dyn CoercionPolicy>,
pub nil: Value,
}Expand description
Runtime policy bundle a language profile configures once and reuses.
Fields§
§truth: Arc<dyn TruthPolicy>Truthiness policy for this profile.
coerce: Arc<dyn CoercionPolicy>Boundary coercion policy for this profile.
nil: ValueProfile-specific nil value used for arity padding.
Implementations§
Source§impl GuestRuntimeKit
impl GuestRuntimeKit
Sourcepub fn new(
truth: Arc<dyn TruthPolicy>,
coerce: Arc<dyn CoercionPolicy>,
nil: Value,
) -> Self
pub fn new( truth: Arc<dyn TruthPolicy>, coerce: Arc<dyn CoercionPolicy>, nil: Value, ) -> Self
Build a kit from truthiness, coercion, and nil policies.
Sourcepub fn is_truthy(&self, cx: &mut Cx, value: &Value) -> Result<bool>
pub fn is_truthy(&self, cx: &mut Cx, value: &Value) -> Result<bool>
Return whether value counts as truthy for this profile.
Sourcepub fn to_number(&self, cx: &mut Cx, value: &Value) -> Result<Option<Value>>
pub fn to_number(&self, cx: &mut Cx, value: &Value) -> Result<Option<Value>>
Convert value to a number value when this profile accepts such a coercion.
Trait Implementations§
Source§impl Clone for GuestRuntimeKit
impl Clone for GuestRuntimeKit
Source§fn clone(&self) -> GuestRuntimeKit
fn clone(&self) -> GuestRuntimeKit
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for GuestRuntimeKit
impl !UnwindSafe for GuestRuntimeKit
impl Freeze for GuestRuntimeKit
impl Send for GuestRuntimeKit
impl Sync for GuestRuntimeKit
impl Unpin for GuestRuntimeKit
impl UnsafeUnpin for GuestRuntimeKit
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