Enum ValuePtr

Source
pub enum ValuePtr {
    None,
    Bool(bool),
    Char(char),
    Integer(i64),
    Float(f64),
    String(Slot),
    Array(Slot),
    Object(Slot),
    External(Slot),
    Type(Hash),
    Fn(Hash),
}
Expand description

An entry on the stack.

Variants§

§

None

An empty value indicating nothing.

§

Bool(bool)

A boolean.

§

Char(char)

A character.

§

Integer(i64)

A number.

§

Float(f64)

A float.

§

String(Slot)

A String.

§

Array(Slot)

An array.

§

Object(Slot)

An object.

§

External(Slot)

An external value.

§

Type(Hash)

A type.

§

Fn(Hash)

A function pointer.

Implementations§

Source§

impl ValuePtr

Source

pub fn into_string(self, vm: &Vm) -> Result<Slot, StackError>

Try to coerce value reference into an array.

Source

pub fn into_array(self, vm: &Vm) -> Result<Slot, StackError>

Try to coerce value reference into an array.

Source

pub fn into_object(self, vm: &Vm) -> Result<Slot, StackError>

Try to coerce value reference into an object.

Source

pub fn into_external(self, vm: &Vm) -> Result<Slot, StackError>

Try to coerce value reference into an external.

Source

pub fn value_type(&self, vm: &Vm) -> Result<ValueType, StackError>

Get the type information for the current value.

Source

pub fn type_info(&self, vm: &Vm) -> Result<ValueTypeInfo, StackError>

Get the type information for the current value.

Trait Implementations§

Source§

impl Clone for ValuePtr

Source§

fn clone(&self) -> ValuePtr

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ValuePtr

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ValuePtr

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ValuePtr

Deserialize implementation for value pointers.

Warning: This only works if a Vm is accessible through tls, like by being set up with tls::inject_vm or tls::InjectVm.

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl FromValue for ValuePtr

Source§

fn from_value(value: ValuePtr, _: &mut Vm) -> Result<Self, StackError>

Try to convert to the given type, from the given value.
Source§

impl PartialEq for ValuePtr

Source§

fn eq(&self, other: &ValuePtr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for ValuePtr

Serialize implementation for value pointers.

Warning: This only works if a Vm is accessible through tls, like by being set up with tls::inject_vm or tls::InjectVm.

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl ToValue for ValuePtr

Source§

fn to_value(self, _vm: &mut Vm) -> Result<ValuePtr, StackError>

Convert into a value.
Source§

impl Copy for ValuePtr

Source§

impl StructuralPartialEq for ValuePtr

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UnsafeFromValue for T
where T: FromValue,

Source§

type Guard = ()

The raw guard returned. Read more
Source§

unsafe fn unsafe_from_value( value: ValuePtr, vm: &mut Vm, ) -> Result<(T, <T as UnsafeFromValue>::Guard), StackError>

Convert the given reference using unsafe assumptions to a value. Read more
Source§

impl<T> UnsafeToValue for T
where T: ToValue,

Source§

unsafe fn unsafe_to_value(self, vm: &mut Vm) -> Result<ValuePtr, StackError>

Convert into a value.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,