pub enum Value {
Show 28 variants Unit, Bool(bool), Byte(u8), Char(char), Integer(i64), Float(f64), Type(Hash), StaticString(Arc<StaticString>), String(Shared<String>), Bytes(Shared<Bytes>), Vec(Shared<Vec>), Tuple(Shared<Tuple>), Object(Shared<Object>), Range(Shared<Range>), Future(Shared<Future>), Stream(Shared<Stream<Vm>>), Generator(Shared<Generator<Vm>>), GeneratorState(Shared<GeneratorState>), Option(Shared<Option<Value>>), Result(Shared<Result<Value, Value>>), UnitStruct(Shared<UnitStruct>), TupleStruct(Shared<TupleStruct>), Struct(Shared<Struct>), Variant(Shared<Variant>), Function(Shared<Function>), Format(Box<Format>), Iterator(Shared<Iterator>), Any(Shared<AnyObj>),
}
Expand description

An entry on the stack.

Variants

Unit

The unit value.

Bool(bool)

A boolean.

Byte(u8)

A single byte.

Char(char)

A character.

Integer(i64)

A number.

Float(f64)

A float.

Type(Hash)

A type hash. Describes a type in the virtual machine.

StaticString(Arc<StaticString>)

A static string.

While Rc<str> would’ve been enough to store an unsized str, either Box<str> or String must be used to reduce the size of the type to 8 bytes, to ensure that a stack value is 16 bytes in size.

Rc<str> on the other hand wraps a so-called fat pointer, which is 16 bytes.

String(Shared<String>)

A UTF-8 string.

Bytes(Shared<Bytes>)

A byte string.

Vec(Shared<Vec>)

A vector containing any values.

Tuple(Shared<Tuple>)

A tuple.

Object(Shared<Object>)

An object.

Range(Shared<Range>)

A range.

Future(Shared<Future>)

A stored future.

Stream(Shared<Stream<Vm>>)

A Stream.

Generator(Shared<Generator<Vm>>)

A stored generator.

GeneratorState(Shared<GeneratorState>)

Generator state.

Option(Shared<Option<Value>>)

An empty value indicating nothing.

Result(Shared<Result<Value, Value>>)

A stored result in a slot.

UnitStruct(Shared<UnitStruct>)

An struct with a well-defined type.

TupleStruct(Shared<TupleStruct>)

A tuple with a well-defined type.

Struct(Shared<Struct>)

An struct with a well-defined type.

Variant(Shared<Variant>)

The variant of an enum.

Function(Shared<Function>)

A stored function pointer.

Format(Box<Format>)

A value being formatted.

Iterator(Shared<Iterator>)

An iterator.

Any(Shared<AnyObj>)

An opaque value that can be downcasted.

Implementations

Format the value using the Protocol::STRING_DISPLAY protocol.

Requires a work buffer buf which will be used in case the value provided requires out-of-line formatting. This must be cleared between calls and can be re-used.

You must use Vm::with to specify which virtual machine this function is called inside.

Panics

This function will panic if called outside of a virtual machine.

Debug format the value using the Protocol::STRING_DEBUG protocol.

You must use Vm::with to specify which virtual machine this function is called inside.

Panics

This function will panic if called outside of a virtual machine.

Convert value into an iterator using the Protocol::INTO_ITER protocol.

You must use Vm::with to specify which virtual machine this function is called inside.

Panics

This function will panic if called outside of a virtual machine.

Coerce into future, or convert into a future using the Protocol::INTO_FUTURE protocol.

You must use Vm::with to specify which virtual machine this function is called inside.

Panics

This function will panic if called outside of a virtual machine.

Coerce into a shared future, or convert into a future using the Protocol::INTO_FUTURE protocol.

You must use Vm::with to specify which virtual machine this function is called inside.

Panics

This function will panic if called outside of a virtual machine.

Retrieves a human readable type name for the current value.

You must use Vm::with to specify which virtual machine this function is called inside.

Panics

This function will panic if called outside of a virtual machine.

Construct a vector.

Construct a tuple.

Construct an empty.

Construct a typed tuple.

Construct an empty variant.

Construct a tuple variant.

Take the interior value.

Try to coerce value into a unit.

Try to coerce value into a boolean.

Try to coerce value into a boolean.

Try to coerce value into a byte.

Try to coerce value into a character.

Try to coerce value into an integer.

Try to coerce value into a float.

Try to coerce value into a result.

Try to coerce value into a generator.

Try to coerce value into a stream.

Try to coerce value into a future.

Try to coerce value into an option.

Try to coerce value into a string.

Try to coerce value into bytes.

Try to coerce value into a vector.

Try to coerce value into a tuple.

Try to coerce value into an object.

Try to coerce value into a range.

Try to coerce value into a function pointer.

Try to coerce value into a format spec.

Try to coerce value into an iterator.

Try to coerce value into an opaque value.

Try to coerce value into a ref and an associated guard.

Safety

This coerces a strong guard to the value into its raw components.

It is up to the caller to ensure that the returned pointer does not outlive the returned guard, not the virtual machine the value belongs to.

Try to coerce value into a ref and an associated guard.

Safety

This coerces a strong guard to the value into its raw components.

It is up to the caller to ensure that the returned pointer does not outlive the returned guard, not the virtual machine the value belongs to.

Get the type hash for the current value.

One notable feature is that the type of a variant is its container enum, and not the type hash of the variant itself.

Get the type information for the current value.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize implementation for value pointers.

Deserialize this value from the given Serde deserializer. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Creates a value from an iterator. Read more

Try to convert to the given type, from the given value.

Serialize implementation for value pointers.

Serialize this value into the given Serde serializer. Read more

Convert into a value.

Convert into a value.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more