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
impl Variant
pub fn marker(id: StringSymbol) -> Self
pub fn is_nil(&self) -> bool
pub fn as_strval(&self) -> Option<StringValue>
pub fn display_echo(&self) -> impl Display + '_
pub fn fmt_str(&self) -> ExecResult<StringValue>
Source§impl Variant
impl Variant
pub fn apply_neg(&self) -> ExecResult<Variant>
pub fn apply_pos(&self) -> ExecResult<Variant>
pub fn apply_inv(&self) -> ExecResult<Variant>
pub fn apply_not(&self) -> ExecResult<Variant>
pub fn apply_mul(&self, rhs: &Variant) -> ExecResult<Variant>
pub fn apply_div(&self, rhs: &Variant) -> ExecResult<Variant>
pub fn apply_mod(&self, rhs: &Variant) -> ExecResult<Variant>
pub fn apply_add(&self, rhs: &Variant) -> ExecResult<Variant>
pub fn apply_sub(&self, rhs: &Variant) -> ExecResult<Variant>
pub fn apply_and(&self, rhs: &Variant) -> ExecResult<Variant>
pub fn apply_xor(&self, rhs: &Variant) -> ExecResult<Variant>
pub fn apply_or(&self, rhs: &Variant) -> ExecResult<Variant>
pub fn apply_shl(&self, rhs: &Variant) -> ExecResult<Variant>
pub fn apply_shr(&self, rhs: &Variant) -> ExecResult<Variant>
pub fn cmp_eq(&self, other: &Variant) -> ExecResult<bool>
pub fn cmp_ne(&self, other: &Variant) -> ExecResult<bool>
pub fn cmp_lt(&self, other: &Variant) -> ExecResult<bool>
pub fn cmp_le(&self, other: &Variant) -> ExecResult<bool>
pub fn cmp_gt(&self, other: &Variant) -> ExecResult<bool>
pub fn cmp_ge(&self, other: &Variant) -> ExecResult<bool>
Source§impl Variant
impl Variant
pub fn as_meta(&self) -> impl MetaObject + '_
pub fn type_tag(&self) -> Type
pub fn type_name(&self) -> ExecResult<StringValue>
Source§impl Variant
impl Variant
pub fn as_bool(&self) -> ExecResult<bool>
pub fn as_bits(&self) -> ExecResult<IntType>
pub fn as_int(&self) -> ExecResult<IntType>
pub fn as_float(&self) -> ExecResult<FloatType>
Source§impl Variant
impl Variant
pub fn len(&self) -> ExecResult<usize>
pub fn is_empty(&self) -> ExecResult<bool>
pub fn iter_init(&self) -> ExecResult<IterState>
pub fn iter_next(&self, state: &Variant) -> ExecResult<Variant>
pub fn iter_get(&self, state: &Variant) -> ExecResult<Variant>
pub fn invoke(&self, args: &[Variant]) -> ExecResult<Call>
pub fn fmt_repr(&self) -> ExecResult<StringValue>
Trait Implementations§
Source§impl From<NativeFunction> for Variant
impl From<NativeFunction> for Variant
Source§fn from(func: NativeFunction) -> Self
fn from(func: NativeFunction) -> Self
Converts to this type from the input type.
Source§impl From<StringSymbol> for Variant
impl From<StringSymbol> for Variant
Source§fn from(symbol: StringSymbol) -> Self
fn from(symbol: StringSymbol) -> Self
Converts to this type from the input type.
Source§impl From<StringValue> for Variant
impl From<StringValue> for Variant
Source§fn from(value: StringValue) -> Self
fn from(value: StringValue) -> Self
Converts to this type from the input type.
Source§impl GcTrace for Variant
impl GcTrace for Variant
Source§impl<'a> TryFrom<&'a Variant> for VariantKey<'a>
impl<'a> TryFrom<&'a Variant> for VariantKey<'a>
Source§type Error = Box<RuntimeError>
type Error = Box<RuntimeError>
The type returned in the event of a conversion error.
Source§fn try_from(value: &'a Variant) -> ExecResult<Self>
fn try_from(value: &'a Variant) -> ExecResult<Self>
Performs the conversion.
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more