Enum Variant

Source
pub enum Variant {
Show 15 variants Nil, BoolTrue, BoolFalse, Marker(Marker), Integer(IntType), Float(FloatType), InternStr(StringSymbol), InlineStr(InlineStr), GCStr(Gc<str>), Tuple(Tuple), Function(Gc<Function>), NativeFunction(Gc<NativeFunction>), Iterator(Gc<dyn UserIterator>), Error(Gc<RuntimeError>), UserData(Gc<dyn UserData>),
}

Variants§

§

Nil

§

BoolTrue

§

BoolFalse

§

Marker(Marker)

§

Integer(IntType)

§

Float(FloatType)

§

InternStr(StringSymbol)

§

InlineStr(InlineStr)

§

GCStr(Gc<str>)

§

Tuple(Tuple)

§

Function(Gc<Function>)

§

NativeFunction(Gc<NativeFunction>)

§

Iterator(Gc<dyn UserIterator>)

§

Error(Gc<RuntimeError>)

§

UserData(Gc<dyn UserData>)

Implementations§

Source§

impl Variant

Source

pub fn marker(id: StringSymbol) -> Self

Source

pub fn is_nil(&self) -> bool

Source

pub fn as_strval(&self) -> Option<StringValue>

Source

pub fn display_echo(&self) -> impl Display + '_

Source

pub fn fmt_str(&self) -> ExecResult<StringValue>

Source§

impl Variant

Source

pub fn can_hash(&self) -> bool

Source§

impl Variant

Source

pub fn apply_neg(&self) -> ExecResult<Variant>

Source

pub fn apply_pos(&self) -> ExecResult<Variant>

Source

pub fn apply_inv(&self) -> ExecResult<Variant>

Source

pub fn apply_not(&self) -> ExecResult<Variant>

Source

pub fn apply_mul(&self, rhs: &Variant) -> ExecResult<Variant>

Source

pub fn apply_div(&self, rhs: &Variant) -> ExecResult<Variant>

Source

pub fn apply_mod(&self, rhs: &Variant) -> ExecResult<Variant>

Source

pub fn apply_add(&self, rhs: &Variant) -> ExecResult<Variant>

Source

pub fn apply_sub(&self, rhs: &Variant) -> ExecResult<Variant>

Source

pub fn apply_and(&self, rhs: &Variant) -> ExecResult<Variant>

Source

pub fn apply_xor(&self, rhs: &Variant) -> ExecResult<Variant>

Source

pub fn apply_or(&self, rhs: &Variant) -> ExecResult<Variant>

Source

pub fn apply_shl(&self, rhs: &Variant) -> ExecResult<Variant>

Source

pub fn apply_shr(&self, rhs: &Variant) -> ExecResult<Variant>

Source

pub fn cmp_eq(&self, other: &Variant) -> ExecResult<bool>

Source

pub fn cmp_ne(&self, other: &Variant) -> ExecResult<bool>

Source

pub fn cmp_lt(&self, other: &Variant) -> ExecResult<bool>

Source

pub fn cmp_le(&self, other: &Variant) -> ExecResult<bool>

Source

pub fn cmp_gt(&self, other: &Variant) -> ExecResult<bool>

Source

pub fn cmp_ge(&self, other: &Variant) -> ExecResult<bool>

Source§

impl Variant

Source

pub fn as_meta(&self) -> impl MetaObject + '_

Source

pub fn type_tag(&self) -> Type

Source

pub fn type_name(&self) -> ExecResult<StringValue>

Source§

impl Variant

Source

pub fn as_bool(&self) -> ExecResult<bool>

Source

pub fn as_bits(&self) -> ExecResult<IntType>

Source

pub fn as_int(&self) -> ExecResult<IntType>

Source

pub fn as_float(&self) -> ExecResult<FloatType>

Source§

impl Variant

Source

pub fn len(&self) -> ExecResult<usize>

Source

pub fn is_empty(&self) -> ExecResult<bool>

Source

pub fn iter_init(&self) -> ExecResult<IterState>

Source

pub fn iter_next(&self, state: &Variant) -> ExecResult<Variant>

Source

pub fn iter_get(&self, state: &Variant) -> ExecResult<Variant>

Source

pub fn invoke(&self, args: &[Variant]) -> ExecResult<Call>

Source

pub fn fmt_repr(&self) -> ExecResult<StringValue>

Trait Implementations§

Source§

impl Clone for Variant

Source§

fn clone(&self) -> Variant

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 Variant

Source§

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

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

impl Display for Variant

Source§

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

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

impl From<Box<[Variant]>> for Variant

Source§

fn from(items: Box<[Variant]>) -> Self

Converts to this type from the input type.
Source§

impl From<Function> for Variant

Source§

fn from(func: Function) -> Self

Converts to this type from the input type.
Source§

impl From<NativeFunction> for Variant

Source§

fn from(func: NativeFunction) -> Self

Converts to this type from the input type.
Source§

impl From<StringSymbol> for Variant

Source§

fn from(symbol: StringSymbol) -> Self

Converts to this type from the input type.
Source§

impl From<StringValue> for Variant

Source§

fn from(value: StringValue) -> Self

Converts to this type from the input type.
Source§

impl From<bool> for Variant

Source§

fn from(value: bool) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for Variant

Source§

fn from(value: FloatType) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for Variant

Source§

fn from(value: IntType) -> Self

Converts to this type from the input type.
Source§

impl GcTrace for Variant

Source§

fn trace(&self)

SAFETY: Must call Gc::mark_trace() on every reachable Gc handle
Source§

fn size_hint(&self) -> usize

If the GcTrace owns any allocations, this should return the extra allocated size. If the allocation can change size, like a Vec, then don’t include it in the size hint, or return a const estimate of the average size.
Source§

fn cleanup(&self)

Source§

impl<'a> TryFrom<&'a Variant> for VariantKey<'a>

Source§

type Error = Box<RuntimeError>

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

fn try_from(value: &'a Variant) -> ExecResult<Self>

Performs the conversion.
Source§

impl Copy for Variant

Auto Trait Implementations§

§

impl Freeze for Variant

§

impl !RefUnwindSafe for Variant

§

impl !Send for Variant

§

impl !Sync for Variant

§

impl Unpin for Variant

§

impl !UnwindSafe for Variant

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.