pub struct Value(/* private fields */);Expand description
A Scheme value. See the module documentation for more information.
Implementations§
Source§impl Value
impl Value
Sourcepub fn new(v: UnpackedValue) -> Self
pub fn new(v: UnpackedValue) -> Self
Create a new Value from an UnpackedValue.
This is generally discouraged as it’s cumbersome; try using From
instead.
pub fn is_null(&self) -> bool
pub fn is_undefined(&self) -> bool
Sourcepub unsafe fn from_raw_inc_rc(raw: *const ()) -> Self
pub unsafe fn from_raw_inc_rc(raw: *const ()) -> Self
Sourcepub fn into_raw(val: Self) -> *const ()
pub fn into_raw(val: Self) -> *const ()
Creates a raw u64 from a Value. Does not decrement the reference count. Calling this function without turning the raw value into a Value via from_raw is equivalent to calling mem::forget on the value.
Sourcepub fn as_raw(this: &Self) -> *const ()
pub fn as_raw(this: &Self) -> *const ()
Creates a raw u64 from the Value. Does not decrement the reference count.
pub fn undefined() -> Self
pub fn null() -> Self
Sourcepub fn datum_from_syntax(syntax: &Syntax) -> Self
pub fn datum_from_syntax(syntax: &Syntax) -> Self
Convert a Syntax into its corresponding datum representation.
pub fn type_of(&self) -> ValueType
pub fn type_name(&self) -> &'static str
Sourcepub fn cast_to_scheme_type<T>(&self) -> Option<T>
pub fn cast_to_scheme_type<T>(&self) -> Option<T>
Attempt to cast the value into a Scheme primitive type.
Sourcepub fn try_to_scheme_type<T>(&self) -> Result<T, Exception>
pub fn try_to_scheme_type<T>(&self) -> Result<T, Exception>
Attempt to cast the value into a Scheme primitive type and return a descriptive error on failure.
Sourcepub fn cast_to_rust_type<T: SchemeCompatible>(&self) -> Option<Gc<T>>
pub fn cast_to_rust_type<T: SchemeCompatible>(&self) -> Option<Gc<T>>
Attempt to cast the value into a Rust type that implements
SchemeCompatible.
Sourcepub fn try_to_rust_type<T: SchemeCompatible>(&self) -> Result<Gc<T>, Exception>
pub fn try_to_rust_type<T: SchemeCompatible>(&self) -> Result<Gc<T>, Exception>
Attempt to cast the value into a Rust type and return a descriptive error on failure.
Sourcepub fn from_rust_type<T: SchemeCompatible>(t: T) -> Self
pub fn from_rust_type<T: SchemeCompatible>(t: T) -> Self
Automatically convert a SchemeCompatible type to a Record and then
into a Value.
Sourcepub fn unpack(self) -> UnpackedValue
pub fn unpack(self) -> UnpackedValue
Unpack the value into an enum representation.
pub fn unpacked_ref(&self) -> UnpackedValueRef<'_>
Sourcepub fn equal(&self, rhs: &Self) -> bool
pub fn equal(&self, rhs: &Self) -> bool
The equal? predicate as defined by the R6RS specification.
Sourcepub fn eq_hash<H: Hasher>(&self, state: &mut H)
pub fn eq_hash<H: Hasher>(&self, state: &mut H)
Performs a hash suitable for use with eq? as an equivalance function
Trait Implementations§
Source§impl From<Arc<RecordTypeDescriptor>> for Value
impl From<Arc<RecordTypeDescriptor>> for Value
Source§fn from(v: Arc<RecordTypeDescriptor>) -> Self
fn from(v: Arc<RecordTypeDescriptor>) -> Self
Source§impl From<ByteVector> for Value
impl From<ByteVector> for Value
Source§fn from(v: ByteVector) -> Self
fn from(v: ByteVector) -> Self
Source§impl From<ComplexNumber> for Value
impl From<ComplexNumber> for Value
Source§fn from(n: ComplexNumber) -> Self
fn from(n: ComplexNumber) -> Self
Source§impl From<Infallible> for Value
impl From<Infallible> for Value
Source§fn from(value: Infallible) -> Self
fn from(value: Infallible) -> Self
Source§impl From<SimpleNumber> for Value
impl From<SimpleNumber> for Value
Source§fn from(n: SimpleNumber) -> Self
fn from(n: SimpleNumber) -> Self
Source§impl From<WideString> for Value
impl From<WideString> for Value
Source§fn from(v: WideString) -> Self
fn from(v: WideString) -> Self
Source§impl Hash for Value
Default Hash implementation for Value is Value::eqv_hash. This produces
reasonable hash maps.
impl Hash for Value
Default Hash implementation for Value is Value::eqv_hash. This produces reasonable hash maps.
Source§impl PartialEq for Value
Default PartialEq implementation for Value is Value::eqv. This allows us
to implement Eq.
impl PartialEq for Value
Default PartialEq implementation for Value is Value::eqv. This allows us to implement Eq.
Source§impl TryFrom<&Value> for ByteVector
impl TryFrom<&Value> for ByteVector
Source§impl TryFrom<&Value> for ComplexNumber
impl TryFrom<&Value> for ComplexNumber
Source§impl TryFrom<&Value> for Identifier
impl TryFrom<&Value> for Identifier
Source§impl TryFrom<&Value> for SimpleNumber
impl TryFrom<&Value> for SimpleNumber
Source§impl TryFrom<&Value> for WideString
impl TryFrom<&Value> for WideString
Source§impl TryFrom<Value> for ByteVector
impl TryFrom<Value> for ByteVector
Source§impl TryFrom<Value> for ComplexNumber
impl TryFrom<Value> for ComplexNumber
Source§impl TryFrom<Value> for SimpleNumber
impl TryFrom<Value> for SimpleNumber
Source§impl TryFrom<Value> for WideString
impl TryFrom<Value> for WideString
impl Eq for Value
Eq can be implemented reasonably for Value since (eqv? +nan.0 +nan.0) is true
impl Send for Value
impl Sync for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Unpin for Value
impl UnsafeUnpin for Value
impl UnwindSafe for Value
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more