Enum rune::Value[][src]

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)

Tuple Fields

0: bool

A boolean.

Byte(u8)

Tuple Fields

0: u8

A single byte.

Char(char)

Tuple Fields

0: char

A character.

Integer(i64)

Tuple Fields

0: i64

A number.

Float(f64)

Tuple Fields

0: f64

A float.

Type(Hash)

Tuple Fields

0: Hash

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

StaticString(Arc<StaticString>)

Tuple Fields

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>)

Tuple Fields

A UTF-8 string.

Bytes(Shared<Bytes>)

Tuple Fields

A byte string.

Vec(Shared<Vec>)

Tuple Fields

0: Shared<Vec>

A vector containing any values.

Tuple(Shared<Tuple>)

Tuple Fields

A tuple.

Object(Shared<Object>)

Tuple Fields

An object.

Range(Shared<Range>)

Tuple Fields

A range.

Future(Shared<Future>)

Tuple Fields

A stored future.

Stream(Shared<Stream<Vm>>)

Tuple Fields

A Stream.

Generator(Shared<Generator<Vm>>)

Tuple Fields

A stored generator.

GeneratorState(Shared<GeneratorState>)

Tuple Fields

Generator state.

Option(Shared<Option<Value>>)

Tuple Fields

An empty value indicating nothing.

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

Tuple Fields

A stored result in a slot.

UnitStruct(Shared<UnitStruct>)

Tuple Fields

An struct with a well-defined type.

TupleStruct(Shared<TupleStruct>)

Tuple Fields

A tuple with a well-defined type.

Struct(Shared<Struct>)

Tuple Fields

An struct with a well-defined type.

Variant(Shared<Variant>)

Tuple Fields

The variant of an enum.

Function(Shared<Function>)

Tuple Fields

A stored function pointer.

Format(Box<Format>)

Tuple Fields

0: Box<Format>

A value being formatted.

Iterator(Shared<Iterator>)

Tuple Fields

An iterator.

Any(Shared<AnyObj>)

Tuple Fields

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.

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

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

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

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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.