pub enum Value<'gc> {
Nil,
Boolean(bool),
Integer(i64),
Number(f64),
String(String<'gc>),
Table(Table<'gc>),
Function(Function<'gc>),
Thread(Thread<'gc>),
UserData(UserData<'gc>),
}Variants§
Nil
Boolean(bool)
Integer(i64)
Number(f64)
String(String<'gc>)
Table(Table<'gc>)
Function(Function<'gc>)
Thread(Thread<'gc>)
UserData(UserData<'gc>)
Implementations§
Source§impl<'gc> Value<'gc>
impl<'gc> Value<'gc>
pub fn type_name(self) -> &'static str
pub fn display<W: Write>(self, w: W) -> Result<(), Error>
pub fn is_nil(self) -> bool
pub fn not(self) -> Value<'gc>
Sourcepub fn to_number(self) -> Option<f64>
pub fn to_number(self) -> Option<f64>
Interprets Numbers, Integers, and Strings as a Number, if possible.
Sourcepub fn to_integer(self) -> Option<i64>
pub fn to_integer(self) -> Option<i64>
Interprets Numbers, Integers, and Strings as an Integer, if possible.
pub fn to_constant(self) -> Option<Constant<String<'gc>>>
Trait Implementations§
Source§impl<'gc> Collect for Value<'gc>
impl<'gc> Collect for Value<'gc>
Source§fn needs_trace() -> bool
fn needs_trace() -> bool
As an optimization, if this type can never hold a
Gc pointer and trace is unnecessary
to call, you may implement this method and return false. The default implementation returns
true, signaling that Collect::trace must be called.Source§fn trace(&self, cc: &Collection)
fn trace(&self, cc: &Collection)
Must call
Collect::trace on all held Gc pointers. If this type holds inner types that
implement Collect, a valid implementation would simply call Collect::trace on all the
held values to ensure this.Source§impl<'gc: 'b, 'a, 'b, 'c> Extend<&'b Value<'gc>> for &'c mut Stack<'gc, 'a>
impl<'gc: 'b, 'a, 'b, 'c> Extend<&'b Value<'gc>> for &'c mut Stack<'gc, 'a>
Source§fn extend<T: IntoIterator<Item = &'b Value<'gc>>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = &'b Value<'gc>>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
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)
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<'gc: 'b, 'a, 'b> Extend<&'a Value<'gc>> for Stack<'gc, 'a>
impl<'gc: 'b, 'a, 'b> Extend<&'a Value<'gc>> for Stack<'gc, 'a>
Source§fn extend<T: IntoIterator<Item = &'a Value<'gc>>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = &'a Value<'gc>>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
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)
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<'gc, 'a, 'b> Extend<Value<'gc>> for &'b mut Stack<'gc, 'a>
impl<'gc, 'a, 'b> Extend<Value<'gc>> for &'b mut Stack<'gc, 'a>
Source§fn extend<T: IntoIterator<Item = Value<'gc>>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Value<'gc>>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
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)
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<'gc, 'a> Extend<Value<'gc>> for Stack<'gc, 'a>
impl<'gc, 'a> Extend<Value<'gc>> for Stack<'gc, 'a>
Source§fn extend<T: IntoIterator<Item = Value<'gc>>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Value<'gc>>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
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)
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<'a, 'gc> IntoValue<'gc> for &'a Value<'gc>
impl<'a, 'gc> IntoValue<'gc> for &'a Value<'gc>
fn into_value(self, ctx: Context<'gc>) -> Value<'gc>
Source§impl<'gc> IntoValue<'gc> for Value<'gc>
impl<'gc> IntoValue<'gc> for Value<'gc>
fn into_value(self, _: Context<'gc>) -> Value<'gc>
Source§impl<'gc> Stashable<'gc> for Value<'gc>
impl<'gc> Stashable<'gc> for Value<'gc>
type Stashed = StaticValue
fn stash(self, roots: &DynamicRootSet<'gc>, mc: &Mutation<'gc>) -> Self::Stashed
impl<'gc> Copy for Value<'gc>
Auto Trait Implementations§
impl<'gc> Freeze for Value<'gc>
impl<'gc> !RefUnwindSafe for Value<'gc>
impl<'gc> !Send for Value<'gc>
impl<'gc> !Sync for Value<'gc>
impl<'gc> Unpin for Value<'gc>
impl<'gc> !UnwindSafe for Value<'gc>
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