pub struct Value {
pub inner: CoreValue,
pub actual_type: Box<TypeDefinition>,
}Fields§
§inner: CoreValue§actual_type: Box<TypeDefinition>Implementations§
Source§impl Value
impl Value
pub fn callable( name: Option<String>, signature: CallableSignature, body: CallableBody, ) -> Self
pub fn is_type(&self) -> bool
pub fn is_null(&self) -> bool
pub fn is_text(&self) -> bool
pub fn is_integer_i8(&self) -> bool
pub fn is_bool(&self) -> bool
pub fn is_map(&self) -> bool
pub fn is_list(&self) -> bool
pub fn actual_type(&self) -> &TypeDefinition
Sourcepub fn has_default_type(&self) -> bool
pub fn has_default_type(&self) -> bool
Returns true if the current Value’s actual type is the same as its default type E.g. if the type is integer for an Integer value, or integer/u8 for a typed integer value This will return false for an integer value if the actual type is one of the following:
- an ImplType<integer, x>
- a new nominal type containing an integer TODO #604: this does not match all cases of default types from the point of view of the compiler - integer variants (despite bigint) can be distinguished based on the instruction code, but for text variants, the variant must be included in the compiler output - so we need to handle theses cases as well. Generally speaking, all variants except the few integer variants should never be considered default types.
Sourcepub fn try_get_property<'a>(
&self,
key: impl Into<ValueKey<'a>>,
) -> Result<ValueContainer, AccessError>
pub fn try_get_property<'a>( &self, key: impl Into<ValueKey<'a>>, ) -> Result<ValueContainer, AccessError>
Gets a property on the value if applicable (e.g. for map and structs)
Sourcepub fn try_set_property<'a>(
&mut self,
key: impl Into<ValueKey<'a>>,
val: ValueContainer,
) -> Result<(), AccessError>
pub fn try_set_property<'a>( &mut self, key: impl Into<ValueKey<'a>>, val: ValueContainer, ) -> Result<(), AccessError>
Sets a property on the value if applicable (e.g. for maps)
Methods from Deref<Target = CoreValue>§
Sourcepub fn is_collection_value(&self) -> bool
pub fn is_collection_value(&self) -> bool
Check if the CoreValue is a combined value type (List, Map) that contains inner ValueContainers.
Sourcepub fn default_type_definition(&self) -> TypeDefinition
pub fn default_type_definition(&self) -> TypeDefinition
Get the default type of the CoreValue type definition. This method uses the CoreLibPointerId to retrieve the corresponding type reference from the core library. For example, a CoreValue::TypedInteger(i32) will return the type ref integer/i32
pub fn cast_to_type(&self) -> Option<&Type>
pub fn cast_to_text(&self) -> Text
pub fn cast_to_bool(&self) -> Option<Boolean>
pub fn cast_to_decimal(&self) -> Option<Decimal>
pub fn cast_to_typed_decimal( &self, variant: DecimalTypeVariant, ) -> Option<TypedDecimal>
pub fn _cast_to_integer_internal(&self) -> Option<TypedInteger>
pub fn cast_to_integer(&self) -> Option<Integer>
pub fn cast_to_typed_integer( &self, variant: IntegerTypeVariant, ) -> Option<TypedInteger>
pub fn cast_to_endpoint(&self) -> Option<Endpoint>
pub fn cast_to_list(&self) -> Option<List>
pub fn cast_to_map(&self) -> Option<Map>
Trait Implementations§
Source§impl<T> AddAssign<T> for Value
impl<T> AddAssign<T> for Value
Source§fn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
+= operation. Read moreSource§impl Apply for Value
impl Apply for Value
Source§fn apply(
&self,
args: &[ValueContainer],
) -> Result<Option<ValueContainer>, ExecutionError>
fn apply( &self, args: &[ValueContainer], ) -> Result<Option<ValueContainer>, ExecutionError>
Source§fn apply_single(
&self,
arg: &ValueContainer,
) -> Result<Option<ValueContainer>, ExecutionError>
fn apply_single( &self, arg: &ValueContainer, ) -> Result<Option<ValueContainer>, ExecutionError>
Source§impl StructuralEq for Value
Two values are structurally equal, if their inner values are structurally equal, regardless
of the actual_type of the values
impl StructuralEq for Value
Two values are structurally equal, if their inner values are structurally equal, regardless of the actual_type of the values
Source§fn structural_eq(&self, other: &Self) -> bool
fn structural_eq(&self, other: &Self) -> bool
Source§impl ValueEq for Value
Value equality corresponds to partial equality:
Both type and inner value are the same
impl ValueEq for Value
Value equality corresponds to partial equality: Both type and inner value are the same
impl Eq for Value
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 UnsafeUnpin 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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more