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§
Sourcepub fn downgrade(&self) -> WeakSharedContainer
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.
Sourcepub fn pointer_address(&self) -> PointerAddress
pub fn pointer_address(&self) -> PointerAddress
Get the inner PointerAddress.
Sourcepub fn derive_immutable_reference(&self) -> ReferencedSharedContainer
pub fn derive_immutable_reference(&self) -> ReferencedSharedContainer
Creates a new immutable ReferencedSharedContainer pointing to the same inner value as self.
Sourcepub fn try_derive_mutable_reference(
&self,
) -> Result<ReferencedSharedContainer, UnexpectedImmutableReferenceError>
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
Sourcepub fn reference_mutability(&self) -> ReferenceMutability
pub fn reference_mutability(&self) -> ReferenceMutability
Returns the ReferenceMutability of this reference
Sourcepub fn treat_as_move(&self) -> bool
pub fn treat_as_move(&self) -> bool
Returns true if the move indicator is set
pub unsafe fn change_address(&self, new_address: PointerAddress)
pub fn to_string_omit_content(&self) -> String
Sourcepub unsafe fn try_upgrade_to_owned(self) -> Result<OwnedSharedContainer, Self>
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.
pub fn mark_debug(&self, is_debug: bool)
pub fn is_debug(&self) -> bool
Trait Implementations§
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,
fn deserialize_with_ctx<D: Deserializer<'de>>( ctx: &SerdeContext<'_>, d: D, ) -> Result<ReferencedSharedContainer, D::Error>
Source§fn from(value: ReferencedSharedContainer) -> Self
fn from(value: ReferencedSharedContainer) -> Self
Source§fn from(referenced_shared_container: ReferencedSharedContainer) -> Self
fn from(referenced_shared_container: ReferencedSharedContainer) -> Self
Source§fn from(shared: ReferencedSharedContainer) -> Self
fn from(shared: ReferencedSharedContainer) -> Self
fn datex_type(_context: &mut SharedReferencesCache) -> Type
Source§fn serialize_with_ctx<S>(
&self,
ctx: &SerdeContext<'_>,
serializer: S,
) -> Result<S::Ok, S::Error>where
S: Serializer,
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§fn container_mutability(&self) -> SharedContainerMutability
fn container_mutability(&self) -> SharedContainerMutability
Get the SharedContainerMutability of the inner [SelfOwnedSharedContainer].
Source§fn value_container(&self) -> Ref<'_, ValueContainer>
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>
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>
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
fn can_mutate(&self) -> bool
Checks if the reference can be mutated by the local endpoint
Gets a Ref to the currently assigned BaseSharedValueContainer of the shared container (not resolved recursively)
Gets a RefMut to the currently assigned BaseSharedValueContainer of the shared container (not resolved recursively)
Source§fn is_borrowed(&self) -> bool
fn is_borrowed(&self) -> bool
fn inner(&self) -> Ref<'_, SharedContainerInner>
fn inner_mut(&self) -> RefMut<'_, SharedContainerInner>
Source§fn ownership(&self) -> SharedContainerOwnership
fn ownership(&self) -> SharedContainerOwnership
Source§fn observer_data(&self) -> Ref<'_, ObserverData>
fn observer_data(&self) -> Ref<'_, ObserverData>
Source§fn observer_data_mut(&self) -> RefMut<'_, ObserverData>
fn observer_data_mut(&self) -> RefMut<'_, ObserverData>
Source§fn is_uninitialized(&self) -> bool
fn is_uninitialized(&self) -> bool
Source§fn get_current_observers(
&self,
source_id: &TransceiverId,
) -> Vec<ObserverCallback>
fn get_current_observers( &self, source_id: &TransceiverId, ) -> Vec<ObserverCallback>
Source§fn structural_eq(&self, other: &Self) -> bool
fn structural_eq(&self, other: &Self) -> bool
fn to_instructions<'a>( &'a self, visitor: &'a mut dyn ValueVisitor, cache: &mut SharedReferencesCache, ) -> Box<dyn Iterator<Item = Instruction> + 'a>
Source§type Error = ReferencedSharedContainer
type Error = ReferencedSharedContainer
Auto Trait Implementations§
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,
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