Enum brane_exe::value::Value

source ·
pub enum Value {
    Boolean {
        value: bool,
    },
    Integer {
        value: i64,
    },
    Real {
        value: f64,
    },
    String {
        value: String,
    },
    Array {
        values: Vec<Self>,
    },
    Function {
        def: usize,
    },
    Instance {
        values: HashMap<String, Self>,
        def: usize,
    },
    Method {
        values: HashMap<String, Self>,
        cdef: usize,
        fdef: usize,
    },
    Data {
        name: String,
    },
    IntermediateResult {
        name: String,
    },
    Void,
}
Expand description

Defines a single Value while executing a Workflow. That’s basically an instantiated DataType.

Variants§

§

Boolean

It’s a boolean value (true/false)

Fields

§value: bool
§

Integer

It’s an integer value (non-fractional numbers)

Fields

§value: i64
§

Real

It’s a real value (fractional numbers)

Fields

§value: f64
§

String

It’s a string value (UTF-8 characters)

Fields

§value: String
§

Array

It’s an Array of values

Fields

§values: Vec<Self>
§

Function

It’s a function object, that references a Function in the workflow table.

Fields

§def: usize
§

Instance

It’s an instance object, that maps field names to values.

Fields

§values: HashMap<String, Self>
§def: usize
§

Method

It’s a method object, which merges a function and an instance together into one.

Fields

§values: HashMap<String, Self>
§cdef: usize
§fdef: usize
§

Data

It’s a data object that contains the identifier of the dataset referenced.

Fields

§name: String
§

IntermediateResult

It’s an intermediate result object that contains the identifier of the dataset or result referenced.

Fields

§name: String
§

Void

No value

Implementations§

source§

impl Value

source

pub fn try_as_bool(self) -> Option<bool>

Returns the top value on the stack as if it was a boolean.

§Returns

The boolean value if it actually was a boolean, or else None.

source

pub fn try_as_int(self) -> Option<i64>

Returns the top value on the stack as if it was an integer.

§Returns

The integer value if it actually was a integer, or else None.

source

pub fn try_as_string(self) -> Option<String>

Returns the top value on the stack as if it was a string.

§Returns

The string value if it actually was a string, or else None.

source

pub fn try_as_array(self) -> Option<Vec<Self>>

Returns the top value on the stack as if it was an array (of any type).

§Returns

An array of values if it actually was an array, or else None.

source

pub fn try_as_func(self) -> Option<usize>

Returns the top value on the stack as if it was a callable (function) of some sort (of any signature).

§Returns

The function’s index if it actually was a callable, or else None.

source

pub fn try_as_instance(self) -> Option<(HashMap<String, Self>, usize)>

Returns the top value on the stack as if it was an instance (of any type).

§Returns

A tuple with the definition and the map of field names -> values if it actually was an instance, or else None.

source

pub fn try_as_method(self) -> Option<(HashMap<String, Self>, usize, usize)>

Returns the top value on the stack as if it was a method (of any type).

§Returns

A tuple with the definition and the map of field names -> values if it actually was an instance, or else None.

source

pub fn try_as_intermediate_result(self) -> Option<String>

Returns the top value on the stack as if it was an IntermediateResult.

§Returns

The name of the intermediate result, if any.

source

pub fn cast(self, target: &DataType, table: &SymTable) -> Result<Self, Error>

Attempts to cast this Value to another one, according to the casting rules.

§Arguments
  • target: The target type to cast to.
  • table: The VirtualSymTable that we use to resolve specific data types.
§Returns

A new Value that contains the casted representation of this value.

§Errors

This function errors if this value is not casteable to the given type.

source

pub fn data_type(&self, table: &SymTable) -> DataType

Returns the DataType of this Value. Note that the following properties may be assumed:

  • The datatype is never Void (since it is a value)
  • Because it is runtime, it always has a non-Any type (i.e., it’s always resolved).
§Arguments
  • table: The VirtualSymTable that we use to resolve specific data types.
source

pub fn display<'a, 'b>(&'a self, table: &'b SymTable) -> ValueDisplay<'a, 'b>

Allows the Value to be displayed with resolved definitions.

§Arguments
  • table: The VirtualSymTable to resolve the definitions with.
§Returns

A ValueDisplay that implements the resolving Display for a Value.

source

pub fn to_full(&self, table: &SymTable) -> FullValue

Converts this Value into a FullValue by resolving the necessary definitions.

§Arguments
  • table: The VirtualSymTable that contains the definitions which we will resolve.
§Returns

A new FullValue instance that is a copy of this Value.

source

pub fn into_full(self, table: &SymTable) -> FullValue

Converts this Value into a FullValue by resolving the necessary definitions.

This overload consumes self, allowing for a more efficient conversion in cases where object are concerned.

§Arguments
  • table: The VirtualSymTable that contains the definitions which we will resolve.
§Returns

A new FullValue instance that is a copy of this Value.

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 From<&Value> for StackSlot

source§

fn from(value: &Value) -> Self

Converts to this type from the input type.
source§

impl From<Value> for StackSlot

source§

fn from(value: Value) -> Self

Converts to this type from the input type.
source§

impl PartialEq for Value

source§

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

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

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

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

impl StructuralPartialEq for Value

Auto Trait Implementations§

§

impl Freeze for Value

§

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 T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FromRef<T> for T
where T: Clone,

source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

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

fn in_current_span(self) -> Instrumented<Self>

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

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

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> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> ToOwned for T
where T: Clone,

source§

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, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

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

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

Performs the conversion.
source§

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

source§

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

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

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

Performs the conversion.
source§

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

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T