[][src]Enum rune_testing::Value

pub enum Value {
    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<Value>>),
    Tuple(Shared<Tuple>),
    Object(Shared<HashMap<String, Value, RandomState>>),
    Future(Shared<Future>),
    Stream(Shared<Stream>),
    Generator(Shared<Generator>),
    GeneratorState(Shared<GeneratorState>),
    Option(Shared<Option<Value>>),
    Result(Shared<Result<Value, Value>>),
    TypedTuple(Shared<TypedTuple>),
    VariantTuple(Shared<VariantTuple>),
    TypedObject(Shared<TypedObject>),
    VariantObject(Shared<VariantObject>),
    Function(Shared<Function>),
    Any(Shared<Any>),
}

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.

A vector containing any values.

Tuple(Shared<Tuple>)

A tuple.

Object(Shared<HashMap<String, Value, RandomState>>)

An object.

Future(Shared<Future>)

A stored future.

Stream(Shared<Stream>)

A Stream.

Generator(Shared<Generator>)

A stored generator.

GeneratorState(Shared<GeneratorState>)

Generator state.

Option(Shared<Option<Value>>)

An empty value indicating nothing.

A stored result in a slot.

TypedTuple(Shared<TypedTuple>)

A tuple with a well-defined type.

VariantTuple(Shared<VariantTuple>)

A tuple variant with a well-defined type.

TypedObject(Shared<TypedObject>)

An object with a well-defined type.

VariantObject(Shared<VariantObject>)

An object variant with a well-defined type.

Function(Shared<Function>)

A stored function pointer.

Any(Shared<Any>)

An opaque value that can be downcasted.

Implementations

impl Value[src]

pub fn vec(vec: Vec<Value>) -> Value[src]

Construct a vector.

pub fn tuple(vec: Vec<Value>) -> Value[src]

Construct a tuple.

pub fn typed_tuple(hash: Hash, vec: Vec<Value>) -> Value[src]

Construct a typed tuple.

pub fn variant_tuple(enum_hash: Hash, hash: Hash, vec: Vec<Value>) -> Value[src]

Construct a typed tuple.

pub fn into_unit(self) -> Result<(), VmError>[src]

Try to coerce value into a unit.

pub fn into_bool(self) -> Result<bool, VmError>[src]

Try to coerce value into a boolean.

pub fn into_byte(self) -> Result<u8, VmError>[src]

Try to coerce value into a byte.

pub fn into_char(self) -> Result<char, VmError>[src]

Try to coerce value into a character.

pub fn into_integer(self) -> Result<i64, VmError>[src]

Try to coerce value into an integer.

pub fn into_float(self) -> Result<f64, VmError>[src]

Try to coerce value into a float.

pub fn into_result(self) -> Result<Shared<Result<Value, Value>>, VmError>[src]

Try to coerce value into a result.

pub fn into_future(self) -> Result<Shared<Future>, VmError>[src]

Try to coerce value into a future.

pub fn into_generator(self) -> Result<Shared<Generator>, VmError>[src]

Try to coerce value into a generator.

pub fn into_stream(self) -> Result<Shared<Stream>, VmError>[src]

Try to coerce value into a stream.

pub fn into_generator_state(self) -> Result<Shared<GeneratorState>, VmError>[src]

Try to coerce value into a future.

pub fn into_option(self) -> Result<Shared<Option<Value>>, VmError>[src]

Try to coerce value into an option.

pub fn into_string(self) -> Result<Shared<String>, VmError>[src]

Try to coerce value into a string.

pub fn into_bytes(self) -> Result<Shared<Bytes>, VmError>[src]

Try to coerce value into bytes.

pub fn into_vec(self) -> Result<Shared<Vec<Value>>, VmError>[src]

Try to coerce value into a vector.

pub fn into_tuple(self) -> Result<Shared<Tuple>, VmError>[src]

Try to coerce value into a tuple.

pub fn into_object(
    self
) -> Result<Shared<HashMap<String, Value, RandomState>>, VmError>
[src]

Try to coerce value into an object.

pub fn into_function(self) -> Result<Shared<Function>, VmError>[src]

Try to coerce value into a function pointer.

pub fn into_any(self) -> Result<Shared<Any>, VmError>[src]

Try to coerce value into an opaque value.

pub unsafe fn unsafe_into_any_ref<T>(
    self
) -> Result<(*const T, RawOwnedRef), VmError> where
    T: Any
[src]

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.

pub unsafe fn unsafe_into_any_mut<T>(
    self
) -> Result<(*mut T, RawOwnedMut), VmError> where
    T: Any
[src]

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.

pub fn value_type(&self) -> Result<Type, VmError>[src]

Get the type information for the current value.

pub fn type_info(&self) -> Result<TypeInfo, VmError>[src]

Get the type information for the current value.

Trait Implementations

impl Clone for Value[src]

impl Debug for Value[src]

impl<'de> Deserialize<'de> for Value[src]

Deserialize implementation for value pointers.

impl From<()> for Value[src]

impl From<Any> for Value[src]

impl From<Arc<StaticString>> for Value[src]

impl From<Bytes> for Value[src]

impl From<Function> for Value[src]

impl From<Future> for Value[src]

impl From<Generator> for Value[src]

impl From<GeneratorState> for Value[src]

impl From<Shared<Any>> for Value[src]

impl From<Shared<Bytes>> for Value[src]

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

impl From<Shared<Future>> for Value[src]

impl From<Shared<Generator>> for Value[src]

impl From<Shared<GeneratorState>> for Value[src]

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

impl From<Shared<Option<Value>>> for Value[src]

impl From<Shared<Result<Value, Value>>> for Value[src]

impl From<Shared<Stream>> for Value[src]

impl From<Shared<String>> for Value[src]

impl From<Shared<Tuple>> for Value[src]

impl From<Shared<TypedObject>> for Value[src]

impl From<Shared<TypedTuple>> for Value[src]

impl From<Shared<VariantObject>> for Value[src]

impl From<Shared<VariantTuple>> for Value[src]

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

impl From<Stream> for Value[src]

impl From<String> for Value[src]

impl From<Tuple> for Value[src]

impl From<TypedObject> for Value[src]

impl From<TypedTuple> for Value[src]

impl From<VariantObject> for Value[src]

impl From<VariantTuple> for Value[src]

impl From<bool> for Value[src]

impl From<char> for Value[src]

impl From<f64> for Value[src]

impl From<i64> for Value[src]

impl From<u8> for Value[src]

impl FromValue for Value[src]

impl Serialize for Value[src]

Serialize implementation for value pointers.

impl<'_> ToValue for &'_ Value[src]

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> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

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

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

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToValue for T where
    Value: From<T>, 
[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<T> UnsafeFromValue for T where
    T: FromValue
[src]

type Output = T

The output type from the unsafe coercion.

type Guard = ()

The raw guard returned. Read more

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