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)
Integer
It’s an integer value (non-fractional numbers)
Real
It’s a real value (fractional numbers)
String
It’s a string value (UTF-8 characters)
Array
It’s an Array of values
Function
It’s a function object, that references a Function in the workflow table.
Instance
It’s an instance object, that maps field names to values.
Method
It’s a method object, which merges a function and an instance together into one.
Data
It’s a data object that contains the identifier of the dataset referenced.
IntermediateResult
It’s an intermediate result object that contains the identifier of the dataset or result referenced.
Void
No value
Implementations§
source§impl Value
impl Value
sourcepub fn try_as_bool(self) -> Option<bool>
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
.
sourcepub fn try_as_int(self) -> Option<i64>
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
.
sourcepub fn try_as_string(self) -> Option<String>
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
.
sourcepub fn try_as_array(self) -> Option<Vec<Self>>
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
.
sourcepub fn try_as_func(self) -> Option<usize>
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
.
sourcepub fn try_as_instance(self) -> Option<(HashMap<String, Self>, usize)>
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
.
sourcepub fn try_as_method(self) -> Option<(HashMap<String, Self>, usize, usize)>
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
.
sourcepub fn try_as_intermediate_result(self) -> Option<String>
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.
sourcepub fn cast(self, target: &DataType, table: &SymTable) -> Result<Self, Error>
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.
sourcepub fn data_type(&self, table: &SymTable) -> DataType
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.
sourcepub fn display<'a, 'b>(&'a self, table: &'b SymTable) -> ValueDisplay<'a, 'b>
pub fn display<'a, 'b>(&'a self, table: &'b SymTable) -> ValueDisplay<'a, 'b>
sourcepub fn into_full(self, table: &SymTable) -> FullValue
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§
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> 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request