pub struct Value<C: Codec>(/* private fields */);Expand description
A Lean value of the type C stands for, with the one reference to it that the holder
owns. Dropping it gives the reference up.
A value of a type that Lean passes as a scalar is that scalar. A codec of such a type
accepts every scalar in Codec::from_lean, which is what lets Value::from_scalar
be safe.
Implementations§
Source§impl<C: Codec> Value<C>
impl<C: Codec> Value<C>
Sourcepub unsafe fn from_raw(repr: C::Repr) -> Value<C>
pub unsafe fn from_raw(repr: C::Repr) -> Value<C>
§Safety
repr is a value of the Lean type C stands for, produced by this runtime, and the
caller owns a reference to it.
Sourcepub fn from_scalar(repr: C::Repr) -> Value<C>
pub fn from_scalar(repr: C::Repr) -> Value<C>
The value of a type that Lean passes as a scalar.
Sourcepub fn as_raw(&self) -> C::Repr
pub fn as_raw(&self) -> C::Repr
The representation, for a function that borrows it. The reference stays here.
Sourcepub fn into_object(self) -> Obj
pub fn into_object(self) -> Obj
The value as an object; see Repr::into_object.
Sourcepub unsafe fn take(object: Obj) -> Value<C>
pub unsafe fn take(object: Obj) -> Value<C>
The value out of an object whose reference is given up.
§Safety
object holds a value of the Lean type C stands for, in the form
Value::into_object gives it, and the caller owns a reference to it.
The value out of an object that stays with its owner.
§Safety
object holds a value of the Lean type C stands for, in the form
Value::into_object gives it.