Struct magnus::value::Qundef

source ·
#[repr(transparent)]
pub struct Qundef(_);
Expand description

A placeholder value that represents an undefined value. Not exposed to Ruby level code.

See QUNDEF to obtain a value of this type.

Implementations§

Return Some(Qundef) if val is a Qundef, None otherwise.

Examples
use magnus::{eval, value::Qundef};

// nil is not undef
assert!(Qundef::from_value(eval("nil").unwrap()).is_none());

Return self as a Value.

Safety

It is not a good idea to return this to Ruby code, bad things will happen. There are only a handful of places in Ruby’s API where it is appropriate to pass a Value created from Qundef (hence this method, rather than implimenting Into<Value>).

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.