Skip to main content

SharedContainer

Enum SharedContainer 

Source
pub enum SharedContainer {
    Owned(OwnedSharedContainer),
    Referenced(ReferencedSharedContainer),
}
Expand description

Top-level wrapper for any owned or referenced shared container, which can either be an owned shared container or a reference to a shared container.

Variants§

§

Owned(OwnedSharedContainer)

An owned shared container (shared X). This is always points to a SharedContainerInner::EndpointOwned

§

Referenced(ReferencedSharedContainer)

A referenced shared container ('shared X or 'mut shared X). This can point to either a SharedContainerInner::EndpointOwned or a SharedContainerInner::External

Implementations§

Source§

impl SharedContainer

Source

pub fn new_owned_with_inferred_allowed_type<T: Into<ValueContainer>>( value_container: T, mutability: SharedContainerMutability, address_provider: &mut SelfOwnedPointerAddressProvider, ) -> Self

Creates a new owned SharedContainer with an initial ValueContainer, a SharedContainerMutability, and a SelfOwnedPointerAddressProvider.

The allowed type is inferred from the value_container’s allowed type.

Source

pub unsafe fn new_owned_with_inferred_allowed_type_unsafe<T: Into<ValueContainer>>( value_container: T, mutability: SharedContainerMutability, address: SelfOwnedPointerAddress, ) -> Self

Creates a new owned SharedContainer with an initial ValueContainer, a SharedContainerMutability, and a SelfOwnedPointerAddress.

The allowed type is inferred from the value_container’s allowed type.

§Safety

The caller must ensure that the address is not used anywhere else.

Source

pub unsafe fn clone_unsafe(&self) -> Self

Creates a new owned SharedContainer with the same contents.

§Safety

The caller must be sure, that the reference on the original self is not used later.

Source

pub fn inner(&self) -> Ref<'_, SharedContainerInner>

Source

pub fn inner_mut(&self) -> RefMut<'_, SharedContainerInner>

Source

pub fn base_shared_container(&self) -> Ref<'_, BaseSharedValueContainer>

Gets a Ref to the currently assigned BaseSharedValueContainer of the shared container (not resolved recursively)

Source

pub fn observe(&self, observer: Observer) -> Result<ObserverId, ObserverError>

Adds an observer to this shared container that will be notified on value changes.

Source

pub fn unobserve(&self, observer_id: ObserverId) -> Result<(), ObserverError>

Source

pub fn base_shared_container_mut(&self) -> RefMut<'_, BaseSharedValueContainer>

Gets a RefMut to the currently assigned BaseSharedValueContainer of the shared container (not resolved recursively)

Source

pub fn value_container(&self) -> Ref<'_, ValueContainer>

Gets a Ref to the currently assigned ValueContainer of the shared container (not resolved recursively)

Source

pub fn allowed_type(&self) -> Ref<'_, TypeDefinition>

Gets a Ref to the currently assigned allowed TypeDefinition of the shared container (not resolved recursively)

Source

pub fn actual_type(&self) -> TypeDefinition

Gets the current actual TypeDefinition of the collapsed inner Value

Source

pub fn value_container_mut(&self) -> RefMut<'_, ValueContainer>

Gets a RefMut to the currently assigned ValueContainer of the shared container (not resolved recursively)

Source

pub fn container_mutability(&self) -> SharedContainerMutability

Get the SharedContainerMutability of the inner container.

Source

pub fn with_collapsed_value_mut<R>(&self, f: impl FnOnce(&mut Value) -> R) -> R

Calls the provided callback with a mut reference to the recursively collapsed inner value of the shared container

Source

pub fn with_collapsed_value<R>(&self, f: impl FnOnce(&Value) -> R) -> R

Calls the provided callback with a reference to the recursively collapsed inner value of the shared container

Source

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

Source

pub fn pointer_address(&self) -> PointerAddress

Source

pub fn derive_immutable_reference(&self) -> ReferencedSharedContainer

Creates a new immutable ReferencedSharedContainer pointing to the same inner value as self.

Source

pub fn try_derive_reference_with_mutability( &self, mutability: ReferenceMutability, ) -> Result<ReferencedSharedContainer, UnexpectedImmutableReferenceError>

Tries to create a new mutable or immutable ReferencedSharedContainer pointing to the same inner value as this OwnedSharedContainer. Returns an Err if the requested mutability is ReferenceMutability::Mutable, but the current reference_mutability is ReferenceMutability::Immutable or the container itself is not mutable

Source

pub fn try_derive_mutable_reference( &self, ) -> Result<ReferencedSharedContainer, UnexpectedImmutableReferenceError>

Tries to create a new mutable ReferencedSharedContainer pointing to the same inner value as this OwnedSharedContainer. Returns an Err if the current reference_mutability is ReferenceMutability::Immutable or the container itself is not mutable

Source

pub fn try_get_owned( &self, ) -> Result<&OwnedSharedContainer, UnexpectedSharedContainerOwnershipError>

Returns the owned shared container if it is owned, otherwise returns an error.

Source

pub fn derive_reference_with_max_mutability(&self) -> ReferencedSharedContainer

Clones the shared container as a mutable reference if possible, otherwise as an immutable reference

Source

pub fn can_mutate(&self) -> bool

Checks if the shared container can be mutated by the local endpoint

Source

pub fn ownership(&self) -> SharedContainerOwnership

Returns the SharedContainerOwnership of this shared container

Trait Implementations§

Source§

impl Apply for SharedContainer

Source§

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

Applies multiple ValueContainer arguments to self
Source§

fn try_apply_single( &self, arg: &ValueContainer, ) -> Result<Option<ValueContainer>, ApplyError>

Applies a single ValueContainer argument to self
Source§

impl Clone for SharedContainer

Custom clone implementation for SharedContainer. A SharedContainer::Owned cannot be cloned as is, only a new reference can be created A SharedContainer::Referenced can be cloned normally

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl DatexProxyTypes for SharedContainer

Source§

impl DatexValueContainerProxy for SharedContainer

Source§

impl DatexValueContainerProxyDeserialize for SharedContainer

Source§

fn try_from_value_container( value: ValueContainer, ) -> Result<Self, TryFromDatexValueError>

Source§

fn try_from_map_property( value: Result<ValueContainer, KeyNotFoundError>, ) -> Result<Self, TryFromDatexValueError>

Source§

fn try_from_bytes( dxb: Vec<u8>, runtime: &Runtime, ) -> Result<Self, DeserializationError>

Deserialize a value of type T from a byte slice containing DXB data
Source§

impl DatexValueContainerProxyInfallibleSerialize for SharedContainer

Source§

impl DatexValueContainerProxySerialize for SharedContainer

Source§

impl Debug for SharedContainer

Source§

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

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

impl Display for SharedContainer

Source§

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

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

impl Eq for SharedContainer

Source§

impl From<OwnedSharedContainer> for SharedContainer

Source§

fn from(value: OwnedSharedContainer) -> Self

Converts to this type from the input type.
Source§

impl From<ReferencedSharedContainer> for SharedContainer

Source§

fn from(value: ReferencedSharedContainer) -> Self

Converts to this type from the input type.
Source§

impl From<SharedContainer> for BorrowedValueContainer<'_>

Source§

fn from(shared_container: SharedContainer) -> Self

Converts to this type from the input type.
Source§

impl From<SharedContainerContainingNominalType> for SharedContainer

Source§

fn from(value: SharedContainerContainingNominalType) -> Self

Converts to this type from the input type.
Source§

impl Hash for SharedContainer

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 SharedContainer

Two references are identical if they point to the same inner value (Rc pointer equality)

Source§

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

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

impl PartialEq for SharedContainer

PartialEq corresponds to pointer equality / identity for Reference.

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 StructuralEq for SharedContainer

Source§

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

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

impl<T: DatexValueContainerProxy> TryFrom<SharedContainer> for Shared<T>

Source§

type Error = TryFromDatexValueError

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

fn try_from(container: SharedContainer) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<SharedContainer> for SharedContainerContainingNominalType

Source§

type Error = ()

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

fn try_from(value: SharedContainer) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl ValueEq for SharedContainer

Source§

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

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

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

Checks if this value is equivalent to the given key. Read more
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, U> TypeSubset<U> for T
where U: TypeSuperset<T>,

Source§

fn is_subset_of(&self, other: &U) -> bool

Returns whether self is a subset of type