[][src]Struct gluon_vm::api::Data

pub struct Data<'a>(_);

Stores values of variants and records.

Implementations

impl<'a> Data<'a>[src]

pub fn tag(&self) -> VmTag[src]

The tag of this variant. If this value is a variant, the tag is the zero-based index of the variant that is present, in order of the declaration.

Use this method to find out what variant you are dealing with, before extracting data from it.

Examples

type OneOfFour =
    | First
    | Second
    | Third
    | Fourth

let val = First // has the tag '0'
let val = Fourth // has the tag '3'

pub fn len(&self) -> usize[src]

Returns the number of fields of this value.

pub fn get(&self, index: usize) -> Option<ValueRef<'a>>[src]

Retrieves the value of the field at index, like get_variant, but does not wrap it in a Variants struct.

pub fn iter(&self) -> impl Iterator<Item = Variants<'a>>[src]

Creates an iterator over the fields of this value.

pub fn get_variant(&self, index: usize) -> Option<Variants<'a>>[src]

Retrieves the value of the field at index. This is useful if you cannot name the field (like in a variant). If the value is a record, use lookup_field instead.

pub fn lookup_field(&self, thread: &Thread, name: &str) -> Option<Variants<'a>>[src]

Retrieves the field name from this record.

Trait Implementations

impl<'a> Clone for Data<'a>[src]

impl<'a> Debug for Data<'a>[src]

impl<'a> PartialEq<Data<'a>> for Data<'a>[src]

impl<'a> StructuralPartialEq for Data<'a>[src]

Auto Trait Implementations

impl<'a> !RefUnwindSafe for Data<'a>

impl<'a> Send for Data<'a>

impl<'a> Sync for Data<'a>

impl<'a> Unpin for Data<'a>

impl<'a> !UnwindSafe for Data<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Any for T where
    T: Any

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<'_, T> Captures<'_> for T[src]

impl<T> CloneAny for T where
    T: Clone + Any

impl<Choices> CoproductSubsetter<CNil, HNil> for Choices[src]

type Remainder = Choices

impl<T> Downcast for T where
    T: Any
[src]

impl<T> DowncastArc for T where
    T: Downcast + Send + Sync
[src]

impl<T> DowncastSync for T where
    T: Send + Sync + Any
[src]

impl<T> From<T> for T[src]

impl<D, T> FromPtr<D> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U, I> LiftInto<U, I> for T where
    U: LiftFrom<T, I>, 
[src]

impl<Source> Sculptor<HNil, HNil> for Source[src]

type Remainder = Source

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.