[−][src]Struct gluon_vm::api::Data
Stores values of variants and records.
Methods
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]
&self
) -> impl Iterator<Item = Variants<'a>>
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> Copy for Data<'a>
[src]
impl<'a> PartialEq<Data<'a>> for Data<'a>
[src]
impl<'a> Clone for Data<'a>
[src]
fn clone(&self) -> Data<'a>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'a> Debug for Data<'a>
[src]
Auto Trait Implementations
Blanket Implementations
impl<D, T> FromPtr for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<Choices> CoproductSubsetter for Choices
[src]
type Remainder = Choices
fn subset(
self
) -> Result<CNil, <Choices as CoproductSubsetter<CNil, HNil>>::Remainder>
[src]
self
) -> Result<CNil, <Choices as CoproductSubsetter<CNil, HNil>>::Remainder>
impl<Source> Sculptor for Source
[src]
impl<T, U, I> LiftInto for T where
U: LiftFrom<T, I>,
[src]
U: LiftFrom<T, I>,
impl<T> Any for T where
T: Any,
[src]
T: Any,