Skip to main content

ValueContainer

Enum ValueContainer 

Source
pub enum ValueContainer {
    Value(Value),
    Reference(Reference),
}

Variants§

§

Value(Value)

§

Reference(Reference)

Implementations§

Source§

impl ValueContainer

Source

pub fn to_value(&self) -> Rc<RefCell<Value>>

Source

pub fn is_type(&self) -> bool

Source

pub fn actual_value_type(&self) -> TypeDefinition

Returns the actual type of the contained value, resolving references if necessary.

Source

pub fn actual_container_type(&self) -> Type

Returns the actual type that describes the value container (e.g. integer or &&mut integer).

Source

pub fn new_value<T: Into<Value>>(value: T) -> ValueContainer

Source

pub fn new_reference<T: Into<Reference>>(value: T) -> ValueContainer

Source

pub fn cast_to_deserializable<T: DeserializeOwned>( &self, ) -> Result<T, DeserializationError>

Casts the contained Value or Reference to the desired type T using serde deserialization.

Source

pub fn from_serializable<T: Serialize>( value: &T, ) -> Result<ValueContainer, SerializationError>

Creates a ValueContainer from a serializable value T using serde serialization.

Source

pub fn maybe_reference(&self) -> Option<&Reference>

Returns the contained Reference if it is a Reference, otherwise returns None.

Source

pub fn with_maybe_reference<F, R>(&self, f: F) -> Option<R>
where F: FnOnce(&Reference) -> R,

Runs a closure with the contained Reference if it is a Reference, otherwise returns None.

Source

pub fn reference_unchecked(&self) -> &Reference

Returns a reference to the contained Reference, panics if it is not a Reference.

Source

pub fn try_get_property<'a>( &self, key: impl Into<ValueKey<'a>>, ) -> Result<ValueContainer, AccessError>

Tries to get a property from the contained Value or Reference.

Source

pub fn try_set_property<'a>( &mut self, source_id: TransceiverId, dif_update_data_or_memory: impl Into<DIFUpdateDataOrMemory<'a>>, key: impl Into<ValueKey<'a>>, val: ValueContainer, ) -> Result<(), AccessError>

Trait Implementations§

Source§

impl Add<&ValueContainer> for &ValueContainer

Source§

type Output = Result<ValueContainer, ValueError>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &ValueContainer) -> Self::Output

Performs the + operation. Read more
Source§

impl Add for ValueContainer

Source§

type Output = Result<ValueContainer, ValueError>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: ValueContainer) -> Self::Output

Performs the + operation. Read more
Source§

impl Apply for ValueContainer

Source§

fn apply( &self, args: &[ValueContainer], ) -> Result<Option<ValueContainer>, ExecutionError>

Applies multiple ValueContainer arguments to self
Source§

fn apply_single( &self, arg: &ValueContainer, ) -> Result<Option<ValueContainer>, ExecutionError>

Applies a single ValueContainer argument to self
Source§

impl Clone for ValueContainer

Source§

fn clone(&self) -> ValueContainer

Returns a duplicate 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 ValueContainer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Deserialize<'a> for ValueContainer

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'a>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for ValueContainer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> From<&'a ValueContainer> for ValueKey<'a>

Source§

fn from(value_container: &'a ValueContainer) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<BorrowedMapKey<'a>> for ValueContainer

Source§

fn from(key: BorrowedMapKey<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<MapKey> for ValueContainer

Source§

fn from(key: MapKey) -> Self

Converts to this type from the input type.
Source§

impl<T: Into<Value>> From<T> for ValueContainer

Source§

fn from(value: T) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<ValueKey<'a>> for ValueContainer

Source§

fn from(value_key: ValueKey<'_>) -> Self

Converts to this type from the input type.
Source§

impl Hash for ValueContainer

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Identity for ValueContainer

Identity checks only returns true if two references are identical. Values are never identical to references or other values.

Source§

fn identical(&self, other: &Self) -> bool

Check if two values are strictly identical (same pointer, same value, same type, same permissions).
Source§

impl Neg for ValueContainer

Source§

type Output = Result<ValueContainer, ValueError>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl PartialEq for ValueContainer

Partial equality for ValueContainer is identical to Hash behavior: Identical references are partially equal, value-equal values are also partially equal. A pointer and a value are never partially equal.

Source§

fn eq(&self, other: &Self) -> 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 Serialize for ValueContainer

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralEq for ValueContainer

Structural equality checks the structural equality of the underlying values, collapsing references to their current resolved values.

Source§

fn structural_eq(&self, other: &Self) -> bool

Check if two values are equal, ignoring the type.
Source§

impl Sub<&ValueContainer> for &ValueContainer

Source§

type Output = Result<ValueContainer, ValueError>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &ValueContainer) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub for ValueContainer

Source§

type Output = Result<ValueContainer, ValueError>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: ValueContainer) -> Self::Output

Performs the - operation. Read more
Source§

impl ValueEq for ValueContainer

Value equality checks the value equality of the underlying values, collapsing references to their current resolved values.

Source§

fn value_eq(&self, other: &Self) -> bool

Check if two values are exactly equal, including the type.
Source§

impl Eq for ValueContainer

Auto Trait Implementations§

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, dest: *mut u8)

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

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,