pub enum Value {
    Null,
    Bool(bool),
    Int(i64),
    Float(f64),
    ExtFunction(ExtFunction),
    LightUserData(*mut u8),
    Str(Gc<String>),
    Table(Gc<RefCell<Table>>),
    UserData(Gc<RefCell<UserData>>),
    Closure(Gc<RefCell<Closure>>),
    ExtClosure(Gc<RefCell<ExtClosure>>),
}
Expand description

Enum of all lucia values.

Variants§

§

Null

null - A null value.

§

Bool(bool)

bool - A true / false value.

§

Int(i64)

int - A 64-bit integer.

§

Float(f64)

float - A 64-bit floating point number.

§

ExtFunction(ExtFunction)

ext_function - A Rust function pointer.

§

LightUserData(*mut u8)

light_user_data - A raw pointer.

§

Str(Gc<String>)

str - A UTF-8 string.

§

Table(Gc<RefCell<Table>>)

table - A table.

§

UserData(Gc<RefCell<UserData>>)

userdata - A UserData.

§

Closure(Gc<RefCell<Closure>>)

closure - A closure.

§

ExtClosure(Gc<RefCell<ExtClosure>>)

ext_closure - A closure defined in Rust.

Implementations§

source§

impl Value

source

pub fn is_null(&self) -> bool

source

pub fn as_null(&self) -> Option<()>

source§

impl Value

source

pub fn is_bool(&self) -> bool

source

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

source§

impl Value

source

pub fn is_int(&self) -> bool

source

pub fn as_int(&self) -> Option<i64>

source§

impl Value

source

pub fn is_float(&self) -> bool

source

pub fn as_float(&self) -> Option<f64>

source§

impl Value

source§

impl Value

source§

impl Value

source

pub fn is_str(&self) -> bool

source

pub fn as_str(&self) -> Option<&str>

source§

impl Value

source

pub fn is_table(&self) -> bool

source

pub fn as_table(&self) -> Option<Ref<'_, Table>>

source

pub fn as_table_mut(&self) -> Option<RefMut<'_, Table>>

source§

impl Value

source

pub fn is_userdata(&self) -> bool

source

pub fn as_userdata(&self) -> Option<Ref<'_, UserData>>

source

pub fn as_userdata_mut(&self) -> Option<RefMut<'_, UserData>>

source§

impl Value

source

pub fn is_closure(&self) -> bool

source

pub fn as_closure(&self) -> Option<Ref<'_, Closure>>

source

pub fn as_closure_mut(&self) -> Option<RefMut<'_, Closure>>

source§

impl Value

source§

impl Value

source

pub fn value_type(&self) -> ValueType

source

pub fn id(&self) -> Option<NonZeroUsize>

source

pub fn set_error(&mut self) -> bool

source

pub fn is_error(&self) -> bool

source

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

source

pub fn repr(&self) -> String

Trait Implementations§

source§

impl Clone for Value

source§

fn clone(&self) -> Value

Returns a copy 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 Value

source§

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

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

impl Display for Value

source§

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

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

impl Extend<Value> for Table

source§

fn extend<T: IntoIterator<Item = Value>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl From<Value> for String

source§

fn from(value: Value) -> Self

Converts to this type from the input type.
source§

impl From<Value> for bool

source§

fn from(value: Value) -> Self

Converts to this type from the input type.
source§

impl FromIterator<Value> for Table

source§

fn from_iter<T: IntoIterator<Item = Value>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl Hash for Value

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Index<&Value> for Table

§

type Output = Value

The returned type after indexing.
source§

fn index(&self, index: &Value) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl PartialEq<Value> for Value

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Trace for Value

source§

unsafe fn trace(&self)

Marks all contained Gcs.
source§

unsafe fn marked(&self) -> bool

Is this object marked.
source§

impl TryFrom<Value> for f64

§

type Error = BuiltinError

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

fn try_from(value: Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Value> for i64

§

type Error = BuiltinError

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

fn try_from(value: Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Copy for Value

source§

impl Eq for Value

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§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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 Twhere T: Clone,

§

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 Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.