Skip to main content

ReferencedSharedContainer

Struct ReferencedSharedContainer 

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

Wrapper struct for a reference to a shared value (i.e. 'shared X or 'mut shared X).

The inner value can either be a SharedContainerInner::EndpointOwned or SharedContainerInner::External

Implementations§

Source§

impl ReferencedSharedContainer

Source

pub fn downgrade(&self) -> WeakSharedContainer

Downgrades the ReferencedSharedContainer to a WeakSharedContainer, which can be upgraded back to a strong reference if the inner value is still alive.

Source

pub fn pointer_address(&self) -> PointerAddress

Get the inner 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_mutable_reference( &self, ) -> Result<ReferencedSharedContainer, UnexpectedImmutableReferenceError>

Tries to create a new mutable ReferencedSharedContainer pointing to the same inner value as self. Returns an Err if the current reference_mutability is ReferenceMutability::Immutable

Source

pub fn reference_mutability(&self) -> ReferenceMutability

Returns the ReferenceMutability of this reference

Source

pub fn treat_as_move(&self) -> bool

Returns true if the move indicator is set

Source

pub unsafe fn change_address(&self, new_address: PointerAddress)

Source

pub fn to_string_omit_content(&self) -> String

Source

pub unsafe fn try_upgrade_to_owned(self) -> Result<OwnedSharedContainer, Self>

Tries to upgrade this ReferencedSharedContainer to an OwnedSharedContainer. If the move indicator is set, the inner value is moved into a new OwnedSharedContainer and returned. If the move indicator is not set, an Err is returned with the original ReferencedSharedContainer. Panics if the move indicator is set but the address is not a [SelfOwnedPointerAddress].

§Safety

The caller must ensure that no other OwnedSharedContainer for the same inner value exists if move_indicator is set.

Source

pub fn mark_debug(&self, is_debug: bool)

Source

pub fn is_debug(&self) -> bool

Trait Implementations§

Source§

impl Clone for ReferencedSharedContainer

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 ConvertValueContainer for ReferencedSharedContainer

Source§

fn to_value_container(self) -> ValueContainer

Convert the value to a ValueContainer
Source§

fn as_borrowed_value_container(&self) -> BorrowedValueContainer<'_>

Borrow the value as a BorrowedValueContainer
Source§

fn as_borrowed_value_container_mut(&mut self) -> BorrowedValueContainerMut<'_>

Borrow the value as a mutable BorrowedValueContainer
Source§

fn try_from_value_container( value_container: ValueContainer, ) -> Result<Self, ValueContainer>
where Self: Sized,

Tries to downcast a ValueContainer into Self
Source§

fn try_borrow_from_value_container( value_container: &ValueContainer, ) -> Result<&Self, ()>
where Self: Sized,

Tries to downcast a ValueContainer into a reference of Self
Source§

fn try_borrow_mut_from_value_container( value_container: &mut ValueContainer, ) -> Result<&mut Self, ()>
where Self: Sized,

Tries to downcast a ValueContainer into a mutable reference of Self
Source§

impl Debug for ReferencedSharedContainer

Source§

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

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

impl<'de> DeserializeWithSerdeContext<'de> for ReferencedSharedContainer

Source§

impl Display for ReferencedSharedContainer

Available on non-crate feature value_display only.
Source§

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

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

impl Eq for ReferencedSharedContainer

Source§

impl From<ReferencedSharedContainer> for SharedContainer

Source§

fn from(value: ReferencedSharedContainer) -> Self

Converts to this type from the input type.
Source§

impl From<ReferencedSharedContainer> for BorrowedValueContainer<'_>

Source§

fn from(referenced_shared_container: ReferencedSharedContainer) -> Self

Converts to this type from the input type.
Source§

impl From<ReferencedSharedContainer> for ValueContainer

Source§

fn from(shared: ReferencedSharedContainer) -> Self

Converts to this type from the input type.
Source§

impl GetDatexType for ReferencedSharedContainer

Source§

impl Hash for ReferencedSharedContainer

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 ReferencedSharedContainer

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 ReferencedSharedContainer

PartialEq corresponds to pointer equality / identity for Reference.

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl SerializeWithSerdeContext for ReferencedSharedContainer

Source§

fn serialize_with_ctx<S>( &self, ctx: &SerdeContext<'_>, serializer: S, ) -> Result<S::Ok, S::Error>
where S: Serializer,

SAFETY: The caller of the serialize method must either

  • guarantee that no direct value (accessible without borrow) is an owned shared value (this can be guaranteed by calling clone on the top level value before passing it to SerializeWithSerdeContext)
  • or guarantee that the value is dropped after calling serialize, so that the owned shared value is not leaked after serialization.
Source§

impl SharedContainerCommon for ReferencedSharedContainer

Source§

fn container_mutability(&self) -> SharedContainerMutability

Get the SharedContainerMutability of the inner [SelfOwnedSharedContainer].

Source§

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

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

Source§

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

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

Source§

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

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

Source§

fn can_mutate(&self) -> bool

Checks if the reference can be mutated by the local endpoint

Source§

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

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

Source§

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

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

Source§

fn is_borrowed(&self) -> bool

Checks if the Rc in the shared container is currently borrowed mutably or immutably
Source§

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

Source§

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

Source§

fn ownership(&self) -> SharedContainerOwnership

Returns the SharedContainerOwnership of this shared container
Source§

fn observer_data(&self) -> Ref<'_, ObserverData>

Returns a reference to the observer data of the shared container
Source§

fn observer_data_mut(&self) -> RefMut<'_, ObserverData>

Returns a mutable reference to the observer data of the shared container
Source§

fn is_uninitialized(&self) -> bool

Returns true if the shared container is uninitialized (i.e., it has no value assigned yet)
Source§

fn get_current_observers( &self, source_id: &TransceiverId, ) -> Vec<ObserverCallback>

Returns a list of all ObserverCallbacks that are currently active for the given TransceiverId
Source§

impl StructuralEq for ReferencedSharedContainer

Source§

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

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

impl ToInstructions for ReferencedSharedContainer

Source§

fn to_instructions<'a>( &'a self, visitor: &'a mut dyn ValueVisitor, cache: &mut SharedReferencesCache, ) -> Box<dyn Iterator<Item = Instruction> + 'a>

Source§

impl<T: DatexNativeBase + 'static> TryFrom<&ReferencedSharedContainer> for Sender<T>

Source§

type Error = ()

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

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

Performs the conversion.
Source§

impl<T: DatexNative + 'static> TryFrom<ReferencedSharedContainer> for SharedRef<T>

Source§

type Error = ReferencedSharedContainer

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

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

Performs the conversion.
Source§

impl ValueEq for ReferencedSharedContainer

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> DeserializeWithSerdeContextDyn for T
where T: for<'de> DeserializeWithSerdeContext<'de>,

Source§

fn deserialize_with_ctx_dyn<'de>( ctx: &SerdeContext<'_>, deserializer: &mut dyn Deserializer<'de>, ) -> Result<T, Error>

Source§

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

Source§

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

Source§

impl<T> DynEq for T
where T: Any,

Source§

default fn dyn_eq(&self, _other: &(dyn Any + 'static)) -> bool

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> GetAllowedType for T
where T: GetDatexType,

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

Source§

fn with_ctx<'a>(&'a self, ctx: &'a SerdeContext<'a>) -> Box<dyn Serialize + 'a>

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

Source§

default fn try_clone(&self) -> Result<Value, ()>

Attempts to clone Self into a new Value.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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