Skip to main content

OwnedSharedContainer

Struct OwnedSharedContainer 

Source
pub struct OwnedSharedContainer { /* private fields */ }
Expand description

Wrapper struct for an owned shared value (i.e. shared X) It is guaranteed that the inner value is a SharedContainerInner::EndpointOwned.

(OwnedSharedContainer implies SharedContainerInner::EndpointOwned, but not vice versa, since a SharedContainerInner::EndpointOwned can be wrapped in a ReferencedSharedContainer)

When holding an OwnedSharedContainer, it is guaranteed that the contained SharedContainerInner is not moved and changed to SharedContainerInner::External. Only an OwnedSharedContainer can be moved to another endpoint or location.

Implementations§

Source§

impl OwnedSharedContainer

Source

pub fn new_from_self_owned_container( container: SelfOwnedSharedContainer, ) -> Self

Creates a new owned container from an SelfOwnedSharedContainer

Source

pub fn try_new( value_container: ValueContainer, allowed_type: TypeDefinition, mutability: SharedContainerMutability, address: SelfOwnedPointerAddress, ) -> Result<Self, SharedValueCreationError>

Tries to create a new OwnedSharedContainer with an initial ValueContainer, an allowed TypeDefinition, a SharedContainerMutability and an SelfOwnedPointerAddress.

If the allowed type is not a superset of the ValueContainer’s allowed type, an error is returned

Source

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

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

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

Source

pub unsafe fn new_with_inferred_allowed_type_unsafe( value_container: ValueContainer, mutability: SharedContainerMutability, address: SelfOwnedPointerAddress, ) -> Self

Creates a new OwnedSharedContainer with an initial ValueContainer, a SharedContainerMutability, and an 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 OwnedSharedContainer with the same inner value as the current one.

§Safety

The caller must ensure 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 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 [Type] of the shared container (not resolved recursively)

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 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 as_self_owned_shared_container( &self, ) -> Ref<'_, SelfOwnedSharedContainer>

Get a Ref to the inner SelfOwnedSharedContainer. It is guaranteed that the contained SharedContainerInner is always a SharedContainerInner::EndpointOwned.

Source

pub fn as_self_owned_shared_container_mut( &self, ) -> RefMut<'_, SelfOwnedSharedContainer>

Get a RefMut to the inner SelfOwnedSharedContainer. It is guaranteed that the contained SharedContainerInner is always a SharedContainerInner::EndpointOwned.

Source

pub fn pointer_address(&self) -> Ref<'_, SelfOwnedPointerAddress>

Get a Ref to the inner SelfOwnedPointerAddress. It is guaranteed that the pointer address is always a SelfOwnedPointerAddress.

Source

pub fn container_mutability(&self) -> SharedContainerMutability

Source

pub fn derive_immutable_reference(&self) -> ReferencedSharedContainer

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

Source

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

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

Source

pub fn derive_with_max_mutability(&self) -> ReferencedSharedContainer

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

Source

pub unsafe fn move_to_remote( self, remote_address: RemotePointerAddress, memory: &SharedReferencesCache, )

Moves an owned shared container by converting it to a ReferencedSharedContainer with a RemotePointerAddress pointing to the given remote address. Drops the original owned shared container

§Safety

The caller must ensure that the RemotePointerAddress does not yet exist in the SharedReferencesCache

Trait Implementations§

Source§

impl DatexProxyTypes for OwnedSharedContainer

Source§

impl DatexValueContainerProxy for OwnedSharedContainer

Source§

impl DatexValueContainerProxyDeserialize for OwnedSharedContainer

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 OwnedSharedContainer

Source§

impl DatexValueContainerProxySerialize for OwnedSharedContainer

Source§

impl Debug for OwnedSharedContainer

Source§

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

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

impl Display for OwnedSharedContainer

Source§

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

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

impl Eq for OwnedSharedContainer

Source§

impl From<OwnedSharedContainer> for SharedContainer

Source§

fn from(value: OwnedSharedContainer) -> Self

Converts to this type from the input type.
Source§

impl Hash for OwnedSharedContainer

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 OwnedSharedContainer

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 OwnedSharedContainer

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 OwnedSharedContainer

Source§

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

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

impl ValueEq for OwnedSharedContainer

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<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> 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