pub enum ValueContainer {
Local(Value),
Shared(SharedContainer),
}Variants§
Implementations§
Source§impl ValueContainer
impl ValueContainer
Sourcepub fn new_from_option(value: Option<ValueContainer>) -> ValueContainer
pub fn new_from_option(value: Option<ValueContainer>) -> ValueContainer
Unwraps an Option
pub fn owner(&self) -> Endpoint
Sourcepub fn value_container(&self) -> Sheep<'_, ValueContainer>
pub fn value_container(&self) -> Sheep<'_, ValueContainer>
Gets a reference to the inner ValueContainer, regardless of whether it is local or shared.
Sourcepub fn value_container_mut(&mut self) -> SheepMut<'_, ValueContainer>
pub fn value_container_mut(&mut self) -> SheepMut<'_, ValueContainer>
Gets a mutable reference to the inner ValueContainer, regardless of whether it is local or shared.
pub fn collapsed_value(&self) -> CollapsedContainerValue<'_>
pub fn collapsed_value_mut(&mut self) -> CollapsedContainerValueMut<'_>
Sourcepub fn get_cloned_value(&self) -> Value
pub fn get_cloned_value(&self) -> Value
Gets a cloned, collapsed inner value. Use [ValueContainer::with_collapsed_value] instead whenever possible or match the ValueContainer
Sourcepub fn try_as<T>(&self) -> Option<&T>where
T: ConvertValueContainer,
pub fn try_as<T>(&self) -> Option<&T>where
T: ConvertValueContainer,
Tries to get an immutable reference to the value as a specified type. Does not perform any type conversion. This only works for local values, not for shared values.
Sourcepub fn try_as_mut<T>(&mut self) -> Option<&mut T>where
T: ConvertValueContainer,
pub fn try_as_mut<T>(&mut self) -> Option<&mut T>where
T: ConvertValueContainer,
Tries to get a mutable reference to the value as a specified type. Does not perform any type conversion. This only works for local values, not for shared values.
Sourcepub fn try_as_str(&self) -> Option<&str>
pub fn try_as_str(&self) -> Option<&str>
Tries to get an immutable reference to the value as a string slice.
Does not perform any type conversion.
In contrast to ValueContainer::try_as::
Sourcepub fn try_into_value<T>(self) -> Result<T, ValueContainer>where
T: ConvertValueContainer,
pub fn try_into_value<T>(self) -> Result<T, ValueContainer>where
T: ConvertValueContainer,
Tries to get the current collapsed value as a specified type. Does not perform any type conversion. This only works for local values, not for shared values.
Sourcepub fn try_convert_into_value<T>(self) -> Result<T, ()>where
T: ConvertValueContainer + FromParts,
pub fn try_convert_into_value<T>(self) -> Result<T, ()>where
T: ConvertValueContainer + FromParts,
Tries to convert the current value into the specific specified type. Performs a cast between native and core values for local values if necessary, e.g. converting a [CoreValue::Map] into a native rust struct.
Sourcepub fn without_local_observers(self) -> ValueContainer
pub fn without_local_observers(self) -> ValueContainer
Strips any local observers from the given value container. This method should be called when a value is moved from its SharedContainer parent.
Sourcepub fn get_cloned(&self) -> ValueContainer
pub fn get_cloned(&self) -> ValueContainer
Performs a clone used by the “clone” command Local values are just cloned normally For shared value, the inner value container is cloned (shared x -> x)
Sourcepub fn actual_type(&self) -> TypeDefinition
pub fn actual_type(&self) -> TypeDefinition
Returns the actual type of the contained value, resolving shared values if necessary.
Sourcepub fn actual_container_type(&self) -> TypeDefinitionWithMetadata
pub fn actual_container_type(&self) -> TypeDefinitionWithMetadata
Returns the actual type that describes the value container (e.g. integer or ’mut shared mut integer).
Sourcepub fn allowed_or_actual_type(&self) -> Sheep<'_, TypeDefinition>
pub fn allowed_or_actual_type(&self) -> Sheep<'_, TypeDefinition>
For local values, returns the actual type of the value container For shared values, returns the allowed type of the value container
Returns the contained SharedContainer if it is a SharedContainer, otherwise returns None.
Returns a mutable reference to the contained SharedContainer if it is a SharedContainer, otherwise returns None.
Runs a closure with the contained SharedContainer if it is a SharedContainer, otherwise returns None.
Returns a reference to the contained SharedContainer, panics if it is not a SharedContainer.
Sourcepub fn is_uninitialized(&self) -> bool
pub fn is_uninitialized(&self) -> bool
Returns true if the underlying value is uninitialized (recursive).
pub fn is_null(&self) -> bool
Trait Implementations§
Source§impl Add for ValueContainer
impl Add for ValueContainer
Source§type Output = Result<ValueContainer, ValueError>
type Output = Result<ValueContainer, ValueError>
+ operator.Source§impl Add<&ValueContainer> for &ValueContainer
impl Add<&ValueContainer> for &ValueContainer
Source§type Output = Result<ValueContainer, ValueError>
type Output = Result<ValueContainer, ValueError>
+ operator.Source§impl Apply for ValueContainer
impl Apply for ValueContainer
Source§fn try_apply_sync(
&self,
runtime: &Runtime,
args: Vec<ApplyArgument>,
) -> Result<(Option<ValueContainer>, Vec<ValueContainer>), ApplyError>
fn try_apply_sync( &self, runtime: &Runtime, args: Vec<ApplyArgument>, ) -> Result<(Option<ValueContainer>, Vec<ValueContainer>), ApplyError>
Source§async fn try_apply_async(
&self,
runtime: &Runtime,
args: Vec<ApplyArgument>,
) -> Result<(Option<ValueContainer>, Vec<ValueContainer>), ApplyError>
async fn try_apply_async( &self, runtime: &Runtime, args: Vec<ApplyArgument>, ) -> Result<(Option<ValueContainer>, Vec<ValueContainer>), ApplyError>
Source§fn try_apply_sync_checked(
&self,
runtime: &Runtime,
args: Vec<ApplyArgument>,
) -> Result<(Option<ValueContainer>, Vec<ValueContainer>), ApplyError>
fn try_apply_sync_checked( &self, runtime: &Runtime, args: Vec<ApplyArgument>, ) -> Result<(Option<ValueContainer>, Vec<ValueContainer>), ApplyError>
Source§async fn try_apply_async_checked(
&self,
runtime: &Runtime,
args: Vec<ApplyArgument>,
) -> Result<(Option<ValueContainer>, Vec<ValueContainer>), ApplyError>
async fn try_apply_async_checked( &self, runtime: &Runtime, args: Vec<ApplyArgument>, ) -> Result<(Option<ValueContainer>, Vec<ValueContainer>), ApplyError>
Source§impl Classification for ValueContainer
impl Classification for ValueContainer
Source§fn entity_type(&self, cache: &mut SharedReferencesCache) -> Option<EntityType>
fn entity_type(&self, cache: &mut SharedReferencesCache) -> Option<EntityType>
Source§fn entity_type_address(&self) -> Option<PointerAddress>
fn entity_type_address(&self) -> Option<PointerAddress>
Source§fn tag(&self) -> Option<ValueTag>
fn tag(&self) -> Option<ValueTag>
Source§fn impls(&self) -> Vec<PointerAddress>
fn impls(&self) -> Vec<PointerAddress>
Source§fn classification(
&self,
cache: &mut SharedReferencesCache,
) -> ValueClassification
fn classification( &self, cache: &mut SharedReferencesCache, ) -> ValueClassification
Source§fn unresolved_classification(&self) -> UnresolvedValueClassification
fn unresolved_classification(&self) -> UnresolvedValueClassification
Source§impl Clone for ValueContainer
impl Clone for ValueContainer
Source§impl ConvertValueContainer for ValueContainer
impl ConvertValueContainer for ValueContainer
Source§fn to_value_container(self) -> ValueContainer
fn to_value_container(self) -> ValueContainer
Source§fn as_borrowed_value_container(&self) -> BorrowedValueContainer<'_>
fn as_borrowed_value_container(&self) -> BorrowedValueContainer<'_>
Source§fn as_borrowed_value_container_mut(&mut self) -> BorrowedValueContainerMut<'_>
fn as_borrowed_value_container_mut(&mut self) -> BorrowedValueContainerMut<'_>
Source§fn try_from_value_container(
value_container: ValueContainer,
) -> Result<Self, ValueContainer>where
Self: Sized,
fn try_from_value_container(
value_container: ValueContainer,
) -> Result<Self, ValueContainer>where
Self: Sized,
Source§fn try_borrow_from_value_container(
value_container: &ValueContainer,
) -> Result<&Self, ()>where
Self: Sized,
fn try_borrow_from_value_container(
value_container: &ValueContainer,
) -> Result<&Self, ()>where
Self: Sized,
Source§fn try_borrow_mut_from_value_container(
value_container: &mut ValueContainer,
) -> Result<&mut Self, ()>where
Self: Sized,
fn try_borrow_mut_from_value_container(
value_container: &mut ValueContainer,
) -> Result<&mut Self, ()>where
Self: Sized,
Source§fn try_from_bytes(
dxb: Vec<u8>,
runtime: &Runtime,
) -> Result<Self, DeserializationError>
fn try_from_bytes( dxb: Vec<u8>, runtime: &Runtime, ) -> Result<Self, DeserializationError>
Source§fn try_convert_from_value_container(
value_container: ValueContainer,
) -> Result<Self, ()>
fn try_convert_from_value_container( value_container: ValueContainer, ) -> Result<Self, ()>
Source§impl DatexHash for ValueContainer
impl DatexHash for ValueContainer
fn datex_hash(&self, state: &mut dyn Hasher)
fn datex_hash_default(&self) -> u64
Source§impl Debug for ValueContainer
impl Debug for ValueContainer
Source§impl<'de> Deserialize<'de> for ValueContainer
impl<'de> Deserialize<'de> for ValueContainer
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl<'de> DeserializeWithSerdeContext<'de> for ValueContainer
Deserialization for ValueContainer using a SerdeContext to provide access to the memory during deserialization.
impl<'de> DeserializeWithSerdeContext<'de> for ValueContainer
Deserialization for ValueContainer using a SerdeContext to provide access to the memory during deserialization.
fn deserialize_with_ctx<D: Deserializer<'de>>( ctx: &SerdeContext<'_>, d: D, ) -> Result<ValueContainer, D::Error>
Source§impl Display for ValueContainer
Available on non-crate feature value_display only.
impl Display for ValueContainer
value_display only.impl Eq for ValueContainer
Source§impl<'a> From<&'a ValueContainer> for BorrowedValueContainer<'a>
impl<'a> From<&'a ValueContainer> for BorrowedValueContainer<'a>
Source§fn from(value_container: &'a ValueContainer) -> Self
fn from(value_container: &'a ValueContainer) -> Self
Source§impl<'a> From<&'a mut ValueContainer> for BorrowedValueContainer<'a>
impl<'a> From<&'a mut ValueContainer> for BorrowedValueContainer<'a>
Source§fn from(value_container: &'a mut ValueContainer) -> Self
fn from(value_container: &'a mut ValueContainer) -> Self
Source§impl From<ApplyArgument> for ValueContainer
impl From<ApplyArgument> for ValueContainer
Source§fn from(arg: ApplyArgument) -> Self
fn from(arg: ApplyArgument) -> Self
Source§fn from(shared: OwnedSharedContainer) -> Self
fn from(shared: OwnedSharedContainer) -> Self
Source§fn from(shared: ReferencedSharedContainer) -> Self
fn from(shared: ReferencedSharedContainer) -> Self
Source§fn from(shared: SharedContainer) -> Self
fn from(shared: SharedContainer) -> Self
Source§impl From<ValueContainer> for InstructionInput
impl From<ValueContainer> for InstructionInput
Source§fn from(value_container: ValueContainer) -> Self
fn from(value_container: ValueContainer) -> Self
Source§impl From<ValueContainer> for ApplyArgument
impl From<ValueContainer> for ApplyArgument
Source§fn from(value: ValueContainer) -> Self
fn from(value: ValueContainer) -> Self
Source§impl From<ValueContainer> for UpdateReturn
impl From<ValueContainer> for UpdateReturn
Source§fn from(value: ValueContainer) -> Self
fn from(value: ValueContainer) -> Self
Source§impl FromParts for ValueContainer
impl FromParts for ValueContainer
fn try_from_map_parts_with_tag(
parts: Map,
tag: Option<&str>,
) -> Result<Self, ()>where
Self: Sized,
fn try_from_list_parts_with_tag(
parts: List,
tag: Option<&str>,
) -> Result<Self, ()>where
Self: Sized,
fn try_from_single_value_with_tag(
value: ValueContainer,
_tag: Option<&str>,
) -> Result<Self, ()>where
Self: Sized,
Source§fn try_from_map_parts(_parts: Map) -> Result<Self, ()>where
Self: Sized,
fn try_from_map_parts(_parts: Map) -> Result<Self, ()>where
Self: Sized,
Source§fn try_from_list_parts(_parts: List) -> Result<Self, ()>where
Self: Sized,
fn try_from_list_parts(_parts: List) -> Result<Self, ()>where
Self: Sized,
Source§fn try_from_single_value(_value: ValueContainer) -> Result<Self, ()>where
Self: Sized,
fn try_from_single_value(_value: ValueContainer) -> Result<Self, ()>where
Self: Sized,
Source§impl GetCoreLibTypeId for ValueContainer
impl GetCoreLibTypeId for ValueContainer
fn core_lib_type_id(&self) -> CoreLibTypeId
Source§impl GetDatexType for ValueContainer
impl GetDatexType for ValueContainer
fn datex_type(_context: &mut SharedReferencesCache) -> Type
Source§impl HasPartsKind for ValueContainer
impl HasPartsKind for ValueContainer
Source§fn parts_kind(&self) -> PartsKind
fn parts_kind(&self) -> PartsKind
PartsKind::None, then the conversion is not possible.
If this returns PartsKind::List, then the conversion is possible and try_into_list_parts() can be called.
If this returns PartsKind::Map, then the conversion is possible and try_into_map_parts() can be called.
If this returns PartsKind::SingleValue, then the conversion is possible and try_from_single_value() can be called.Source§impl Hash for ValueContainer
impl Hash for ValueContainer
Source§impl Identity for ValueContainer
Identity checks only returns true if two references are identical.
Values are never identical to references or other values.
impl Identity for ValueContainer
Identity checks only returns true if two references are identical. Values are never identical to references or other values.
Source§impl IntoParts for ValueContainer
impl IntoParts for ValueContainer
Source§fn try_into_map_parts<'a>(self: Box<Self>) -> Result<Map, ()>where
Self: 'a,
fn try_into_map_parts<'a>(self: Box<Self>) -> Result<Map, ()>where
Self: 'a,
parts_kind()
and checking if it returns PartsKind::Map.Source§fn try_into_list_parts<'a>(self: Box<Self>) -> Result<List, ()>where
Self: 'a,
fn try_into_list_parts<'a>(self: Box<Self>) -> Result<List, ()>where
Self: 'a,
parts_kind()
and checking if it returns PartsKind::List.Source§fn try_into_single_value<'a>(self: Box<Self>) -> Result<ValueContainer, ()>where
Self: 'a,
fn try_into_single_value<'a>(self: Box<Self>) -> Result<ValueContainer, ()>where
Self: 'a,
parts_kind()
and checking if it returns PartsKind::SingleValue.Source§impl Neg for ValueContainer
impl Neg for ValueContainer
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.
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§impl Serialize for ValueContainer
impl Serialize for ValueContainer
Source§impl SerializeWithSerdeContext for ValueContainer
impl SerializeWithSerdeContext for ValueContainer
fn serialize_with_ctx<S>(
&self,
ctx: &SerdeContext<'_>,
serializer: S,
) -> Result<S::Ok, S::Error>where
S: Serializer,
Source§impl StructuralEq for ValueContainer
Structural equality checks the structural equality of the underlying values, collapsing
references to their current resolved values.
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
fn structural_eq(&self, other: &Self) -> bool
Source§impl Sub for ValueContainer
impl Sub for ValueContainer
Source§type Output = Result<ValueContainer, ValueError>
type Output = Result<ValueContainer, ValueError>
- operator.Source§impl Sub<&ValueContainer> for &ValueContainer
impl Sub<&ValueContainer> for &ValueContainer
Source§type Output = Result<ValueContainer, ValueError>
type Output = Result<ValueContainer, ValueError>
- operator.Source§impl ToInstructions for ValueContainer
impl ToInstructions for ValueContainer
fn to_instructions<'a>( &'a self, visitor: &'a mut dyn ValueVisitor, cache: &'a mut SharedReferencesCache, ) -> Box<dyn Iterator<Item = Instruction> + 'a>
Source§impl<'a> TryFrom<&'a ValueContainer> for &'a str
impl<'a> TryFrom<&'a ValueContainer> for &'a str
Source§impl<'a> TryFrom<&'a mut ValueContainer> for BorrowedValueContainerMut<'a>
impl<'a> TryFrom<&'a mut ValueContainer> for BorrowedValueContainerMut<'a>
Source§impl TryFrom<UpdateReturn> for ValueContainer
impl TryFrom<UpdateReturn> for ValueContainer
Source§impl TryFrom<ValueContainer> for Type
impl TryFrom<ValueContainer> for Type
Source§impl UpdateHandler for ValueContainer
impl UpdateHandler for ValueContainer
fn try_handle_update( &mut self, update: Update, cache: &RefCell<SharedReferencesCache>, ) -> UpdateResult
fn try_set_entry( &mut self, path: Vec<ValueContainer>, source_id: TransceiverId, data: SetEntryUpdateData, cache: &RefCell<SharedReferencesCache>, ) -> Result<Option<ValueContainer>, UpdateError>
fn try_delete_entry( &mut self, path: Vec<ValueContainer>, source_id: TransceiverId, data: DeleteEntryUpdateData, cache: &RefCell<SharedReferencesCache>, ) -> Result<Option<ValueContainer>, UpdateError>
fn try_append_entry( &mut self, path: Vec<ValueContainer>, source_id: TransceiverId, data: AppendEntryUpdateData, cache: &RefCell<SharedReferencesCache>, ) -> Result<(), UpdateError>
fn try_clear( &mut self, path: Vec<ValueContainer>, source_id: TransceiverId, cache: &RefCell<SharedReferencesCache>, ) -> Result<ValueContainer, UpdateError>
fn try_list_splice( &mut self, path: Vec<ValueContainer>, source_id: TransceiverId, data: ListSpliceUpdateData, cache: &RefCell<SharedReferencesCache>, ) -> Result<Vec<ValueContainer>, UpdateError>
fn try_increment( &mut self, path: Vec<ValueContainer>, source_id: TransceiverId, data: IncrementUpdateData, cache: &RefCell<SharedReferencesCache>, ) -> Result<(), UpdateError>
fn try_decrement( &mut self, path: Vec<ValueContainer>, source_id: TransceiverId, data: DecrementUpdateData, cache: &RefCell<SharedReferencesCache>, ) -> Result<(), UpdateError>
fn try_replace( &mut self, path: Vec<ValueContainer>, source_id: TransceiverId, data: ReplaceUpdateData, cache: &RefCell<SharedReferencesCache>, ) -> Result<(), UpdateError>
Auto Trait Implementations§
impl !RefUnwindSafe for ValueContainer
impl !Send for ValueContainer
impl !Sync for ValueContainer
impl !UnwindSafe for ValueContainer
impl Forget for ValueContainer
impl Freeze for ValueContainer
impl Move for ValueContainer
impl Unpin for ValueContainer
impl UnsafeUnpin for ValueContainer
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,
impl<T> DatexNativeBase for T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> DeserializeWithSerdeContextDyn for Twhere
T: for<'de> DeserializeWithSerdeContext<'de>,
impl<T> DeserializeWithSerdeContextDyn for Twhere
T: for<'de> DeserializeWithSerdeContext<'de>,
fn deserialize_with_ctx_dyn<'de>( ctx: &SerdeContext<'_>, deserializer: &mut dyn Deserializer<'de>, ) -> Result<T, Error>
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> GetAllowedType for Twhere
T: GetDatexType,
impl<T> GetAllowedType for Twhere
T: GetDatexType,
fn allowed_type(&self, cache: &mut SharedReferencesCache) -> TypeDefinition
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