[][src]Enum mtots::Value

pub enum Value {
    Invalid,
    Nil,
    Bool(bool),
    Number(f64),
    String(RcStr),
    List(Rc<List>),
    Set(Rc<Set>),
    Map(Rc<Map>),
    Table(Rc<Table>),
    Function(Rc<Function>),
    NativeFunction(Rc<NativeFunction>),
    Generator(Rc<RefCell<Generator>>),
    NativeGenerator(Rc<RefCell<NativeGenerator>>),
    Class(Rc<Class>),
    Module(Rc<Module>),
    Handle(Rc<HandleData>),
}

Variants

Invalid
Nil
Bool(bool)
Number(f64)
String(RcStr)
List(Rc<List>)
Set(Rc<Set>)
Map(Rc<Map>)
Table(Rc<Table>)
Function(Rc<Function>)
NativeFunction(Rc<NativeFunction>)
Generator(Rc<RefCell<Generator>>)
NativeGenerator(Rc<RefCell<NativeGenerator>>)
Class(Rc<Class>)
Module(Rc<Module>)
Handle(Rc<HandleData>)

Implementations

impl Value[src]

pub fn f64(&self) -> Result<f64, Error>[src]

pub fn f32(&self) -> Result<f32, Error>[src]

pub fn usize(&self) -> Result<usize, Error>[src]

pub fn u64(&self) -> Result<u64, Error>[src]

pub fn u32(&self) -> Result<u32, Error>[src]

pub fn u16(&self) -> Result<u16, Error>[src]

pub fn u8(&self) -> Result<u8, Error>[src]

pub fn isize(&self) -> Result<isize, Error>[src]

pub fn i64(&self) -> Result<i64, Error>[src]

pub fn i32(&self) -> Result<i32, Error>[src]

pub fn i16(&self) -> Result<i16, Error>[src]

pub fn i8(&self) -> Result<i8, Error>[src]

impl Value[src]

pub fn format_string(fmt: &str, args: Vec<Value>) -> Result<String, Error>[src]

impl Value[src]

Methods for dealing with unpacking values in other values

the easy_* variants are those where a Globals context is not used, but can only unpack List, Set and Map values.

Some of these methods are kind of redundant with many of the TryFrom forms. Some of these redundant unpack methods may be removed in the future.

pub fn unpack_into_set(
    self,
    globals: &mut Globals
) -> Result<IndexSet<Key, RandomState>, Error>
[src]

pub fn unpack_into_map(
    self,
    globals: &mut Globals
) -> Result<IndexMap<Key, Value, RandomState>, Error>
[src]

pub fn unpack(self, globals: &mut Globals) -> Result<Vec<Value>, Error>[src]

pub fn unpack_into<C, T, E>(self, globals: &mut Globals) -> Result<C, Error> where
    C: FromIterator<T>,
    T: TryFrom<Value, Error = E>,
    Error: From<E>, 
[src]

pub fn easy_unpack(self) -> Result<Vec<Value>, Error>[src]

pub fn easy_unpack2(self) -> Result<[Value; 2], Error>[src]

pub fn easy_unpack3(self) -> Result<[Value; 3], Error>[src]

pub fn easy_unpack4(self) -> Result<[Value; 4], Error>[src]

pub fn unpack_keyval(self, globals: &mut Globals) -> Result<(Key, Value), Error>[src]

pub fn unpack2(self, globals: &mut Globals) -> Result<[Value; 2], Error>[src]

pub fn unpack3(self, globals: &mut Globals) -> Result<[Value; 3], Error>[src]

pub fn unpack4(self, globals: &mut Globals) -> Result<[Value; 4], Error>[src]

impl Value[src]

pub fn easy_iter_unpack<F, R>(&self, f: F) -> Result<R, Error> where
    F: FnOnce(EasyIterUnpack<'_>) -> Result<R, Error>, 
[src]

impl Value[src]

pub fn convert<T>(self, globals: &mut Globals) -> Result<T, Error> where
    T: ConvertValue + Clone + Any
[src]

For converting to a native value into a value of the desired type. If the current value is a handle of the given type, it will either unwrap or clone it. If not, it will try to convert it with the ConvertValue trait

pub fn to_xref<T>(&self, globals: &mut Globals) -> Result<XRef<'_, T>, Error> where
    T: ConvertValue + Any
[src]

pub fn to_xref_mut<T>(
    &self,
    globals: &mut Globals
) -> Result<XRefMut<'_, T>, Error> where
    T: ConvertValue + Any
[src]

impl Value[src]

pub fn truthy(&self) -> bool[src]

pub fn debug_typename(&self) -> RcStr[src]

pub fn is(&self, other: &Value) -> bool[src]

pub fn lt(&self, other: &Value) -> Result<bool, Error>[src]

pub fn is_nil(&self) -> bool[src]

pub fn bool(&self) -> Result<bool, Error>[src]

pub fn number(&self) -> Result<f64, Error>[src]

pub fn string(&self) -> Result<&RcStr, Error>[src]

pub fn into_string(self) -> Result<RcStr, Error>[src]

pub fn list(&self) -> Result<&Rc<List>, Error>[src]

pub fn into_list(self) -> Result<Rc<List>, Error>[src]

pub fn set(&self) -> Result<&Rc<Set>, Error>[src]

pub fn into_set(self) -> Result<Rc<Set>, Error>[src]

pub fn map(&self) -> Result<&Rc<Map>, Error>[src]

pub fn into_map(self) -> Result<Rc<Map>, Error>[src]

pub fn function(&self) -> Result<&Rc<Function>, Error>[src]

pub fn is_function(&self) -> bool[src]

pub fn into_function(self) -> Result<Rc<Function>, Error>[src]

pub fn native_function(&self) -> Result<&Rc<NativeFunction>, Error>[src]

pub fn is_native_function(&self) -> bool[src]

pub fn into_native_function(self) -> Result<Rc<NativeFunction>, Error>[src]

pub fn class(&self) -> Result<&Rc<Class>, Error>[src]

pub fn into_class(self) -> Result<Rc<Class>, Error>[src]

pub fn module(&self) -> Result<&Rc<Module>, Error>[src]

pub fn into_module(self) -> Result<Rc<Module>, Error>[src]

pub fn into_handle<T>(self) -> Result<Handle<T>, Error> where
    T: Any
[src]

pub fn is_handle<T>(&self) -> bool where
    T: Any
[src]

pub fn unwrap_handle<T>(self) -> Result<T, Error> where
    T: Any
[src]

pub fn unwrap_or_clone_handle<T>(self) -> Result<T, Error> where
    T: Clone + Any
[src]

pub fn convert_to_int(self) -> Result<i64, Error>[src]

pub fn convert_to_float(self) -> Result<f64, Error>[src]

pub fn convert_to_rcstr(self) -> RcStr[src]

pub fn unwrap_or_clone_string(self) -> Result<String, Error>[src]

pub fn iter(self, _globals: &mut Globals) -> Result<Value, Error>[src]

pub fn get_class(&'a self, globals: &'a Globals) -> &'a Rc<Class>[src]

pub fn getattr_opt(&self, attr: &RcStr) -> Option<Value>[src]

pub fn getattr(&self, attr: &RcStr) -> Result<Value, Error>[src]

pub fn getattrs(&self) -> Vec<RcStr>[src]

pub fn setattr(&self, attr: &RcStr, value: Value) -> Result<(), Error>[src]

pub fn apply(
    &self,
    globals: &mut Globals,
    args: Vec<Value>,
    kwargs: Option<HashMap<RcStr, Value, RandomState>>
) -> Result<Value, Error>
[src]

pub fn apply_method<M>(
    &self,
    globals: &mut Globals,
    method_name: &M,
    args: Vec<Value>,
    kwargs: Option<HashMap<RcStr, Value, RandomState>>
) -> Result<Value, Error> where
    M: Hash + Eq + Debug + ?Sized,
    RcStr: Borrow<M>, 
[src]

pub fn resume(&self, globals: &mut Globals, arg: Value) -> ResumeResult[src]

pub fn to_index(&self, len: usize) -> Result<usize, Error>[src]

pub fn to_slice_index(&self, len: usize) -> Result<usize, Error>[src]

pub fn to_start_index(&self, len: usize) -> Result<usize, Error>[src]

pub fn to_end_index(&self, len: usize) -> Result<usize, Error>[src]

pub fn getitem(
    &self,
    globals: &mut Globals,
    index: Value
) -> Result<Value, Error>
[src]

pub fn setitem(
    &self,
    globals: &mut Globals,
    index: Value,
    value: Value
) -> Result<(), Error>
[src]

Trait Implementations

impl Clone for Value[src]

impl Debug for Value[src]

impl Display for Value[src]

impl<'_> From<&'_ ConstVal> for Value[src]

impl<'_> From<&'_ Key> for Value[src]

impl<'_> From<&'_ Rc<Class>> for Value[src]

impl<'_> From<&'_ Rc<Function>> for Value[src]

impl<'_> From<&'_ Rc<Module>> for Value[src]

impl<'_> From<&'_ Rc<NativeFunction>> for Value[src]

impl<'_> From<&'_ Rc<Table>> for Value[src]

impl<'_> From<&'_ RcStr> for Value[src]

impl<'_> From<&'_ String> for Value[src]

impl<'_> From<&'_ str> for Value[src]

impl<'_, '_> From<(&'_ Key, &'_ Value)> for Value[src]

impl From<()> for Value[src]

impl<A, B> From<(A, B)> for Value where
    Value: From<A>,
    Value: From<B>, 
[src]

impl From<ConstVal> for Value[src]

impl From<Error> for Value[src]

impl From<Function> for Value[src]

impl From<Generator> for Value[src]

impl<T> From<Handle<T>> for Value where
    T: Any
[src]

impl From<HashMap<RcStr, Value, RandomState>> for Value[src]

impl From<IndexMap<Key, Value, RandomState>> for Value[src]

impl From<IndexSet<Key, RandomState>> for Value[src]

impl From<Key> for Value[src]

impl From<Map> for Value[src]

impl From<NativeFunction> for Value[src]

impl From<NativeGenerator> for Value[src]

impl From<Rc<Class>> for Value[src]

impl From<Rc<Function>> for Value[src]

impl From<Rc<Module>> for Value[src]

impl From<Rc<NativeFunction>> for Value[src]

impl From<Rc<Table>> for Value[src]

impl From<RcStr> for Value[src]

impl From<Set> for Value[src]

impl From<String> for Value[src]

impl From<Table> for Value[src]

impl From<Vec<Value>> for Value[src]

impl From<bool> for Value[src]

impl From<char> for Value[src]

impl From<f32> for Value[src]

impl From<f64> for Value[src]

impl From<i16> for Value[src]

impl From<i32> for Value[src]

impl From<i64> for Value[src]

impl From<i8> for Value[src]

impl From<isize> for Value[src]

impl From<u16> for Value[src]

impl From<u32> for Value[src]

impl From<u64> for Value[src]

impl From<u8> for Value[src]

impl From<usize> for Value[src]

impl FromIterator<Value> for List[src]

impl PartialEq<Value> for Value[src]

impl PartialOrd<Value> for Value[src]

impl<'_> TryFrom<&'_ OsStr> for Value[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ OsString> for Value[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ Value> for RcStr[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ Value> for Key[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a Value> for &'a str[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<OsString> for Value[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Value> for RcStr[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Value> for Error[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Value> for Key[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Value> for Encoding[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl !RefUnwindSafe for Value

impl !Send for Value

impl !Sync for Value

impl Unpin for Value

impl !UnwindSafe for Value

Blanket Implementations

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

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

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

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> SetParameter for T

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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.

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