pub enum Receiver<T> {
LocalSender {
receiver: UnboundedReceiver<T>,
},
RemoteSender {
sender: UnboundedSender<T>,
receiver: UnboundedReceiver<T>,
},
}Expand description
TODO: Receivers should not be referencable, or at least no be readable from reference, only from owned value
Variants§
Implementations§
Source§impl<T> Receiver<T>
impl<T> Receiver<T>
pub fn new_with_local_sender(receiver: UnboundedReceiver<T>) -> Self
pub fn new_with_remote_sender() -> Self
pub fn receiver(&mut self) -> &mut UnboundedReceiver<T>
Trait Implementations§
Source§impl<T> Classification for Receiver<T>where
T: DatexNativeBase + 'static,
impl<T> Classification for Receiver<T>where
T: DatexNativeBase + 'static,
Source§fn entity_type(&self, _cache: &mut SharedReferencesCache) -> Option<EntityType>
fn entity_type(&self, _cache: &mut SharedReferencesCache) -> Option<EntityType>
Returns the DATEX EntityType of the native value if it has an entity type.
For structural types, this will return None.
The default implementation returns None, indicating that the value does not have an entity type.
Source§fn entity_type_address(&self) -> Option<PointerAddress>
fn entity_type_address(&self) -> Option<PointerAddress>
Returns the PointerAddress of the entity type if it has one.
The default implementation returns None, indicating that the value does not have an entity type address.
It must be ensured that the entity type for the given address is already registered in the runtime.
Source§fn tag(&self) -> Option<ValueTag>
fn tag(&self) -> Option<ValueTag>
Returns a ValueTag if the value has a tag.
The default implementation returns None, indicating that the value does not have a tag.
Source§fn impls(&self) -> Vec<PointerAddress>
fn impls(&self) -> Vec<PointerAddress>
Returns a list of PointerAddresses of the impls associated with the value.
The default implementation returns an empty list, indicating that the value does not have any impls.
Source§fn classification(
&self,
cache: &mut SharedReferencesCache,
) -> ValueClassification
fn classification( &self, cache: &mut SharedReferencesCache, ) -> ValueClassification
Returns the DATEX ValueClassification of the native value.
This tries to resolve the entity type and tag, assuming at most one of them is present.
Source§fn unresolved_classification(&self) -> UnresolvedValueClassification
fn unresolved_classification(&self) -> UnresolvedValueClassification
Returns the unresolved DATEX UnresolvedValueClassification of the native value.
This does not try to resolve the entity, but instead returns the address of the entity type if it has one.
Source§impl<T: DatexNativeBase + 'static> ConvertValue for Receiver<T>
impl<T: DatexNativeBase + 'static> ConvertValue for Receiver<T>
fn to_value(self) -> Value
fn try_from_value(value: Value) -> Result<Self, Value>
fn try_borrow_from_value(value: &Value) -> Result<&Self, ()>
fn try_borrow_mut_from_value(value: &mut Value) -> Result<&mut Self, ()>
Source§impl<T> DatexHash for Receiver<T>where
T: DatexHash,
impl<T> DatexHash for Receiver<T>where
T: DatexHash,
fn datex_hash(&self, state: &mut dyn Hasher)
fn datex_hash_default(&self) -> u64
Source§impl<T: DatexNativeBase + 'static> DatexNative for Receiver<T>
impl<T: DatexNativeBase + 'static> DatexNative for Receiver<T>
impl<T: DatexNativeOnlyStructural + GetDatexType> DatexNativeOnlyStructural for Receiver<T>
If T implements DatexNativeOnlyStructural, then Receiver<T> also implements DatexNativeOnlyStructural.
Source§impl<T: DatexNativeBase + 'static> DatexNativeOps for Receiver<T>
impl<T: DatexNativeBase + 'static> DatexNativeOps for Receiver<T>
fn add_native(&self, _rhs: &dyn DatexNative) -> Option<Box<dyn DatexNative>>
Source§impl<T: DatexNativeBase + GetDatexType + 'static> DatexNativeStructural for Receiver<T>
Receiver<T> always implements DatexNativeStructural.
impl<T: DatexNativeBase + GetDatexType + 'static> DatexNativeStructural for Receiver<T>
Receiver<T> always implements DatexNativeStructural.
Source§fn classification_without_cache(&self) -> ValueClassification
fn classification_without_cache(&self) -> ValueClassification
Returns the DATEX ValueClassification of the native value.
This only checks for the presence of tag, since entity type resolution requires a cache.
Source§impl<'de, T: DeserializeWithSerdeContextDyn> DeserializeWithSerdeContext<'de> for Receiver<T>
impl<'de, T: DeserializeWithSerdeContextDyn> DeserializeWithSerdeContext<'de> for Receiver<T>
fn deserialize_with_ctx<D>(
ctx: &SerdeContext<'_>,
deserializer: D,
) -> Result<Receiver<T>, D::Error>where
D: Deserializer<'de>,
impl<T> Eq for Receiver<T>
Source§impl<T: ConvertValueContainer + FromParts> FromParts for Receiver<T>
impl<T: ConvertValueContainer + FromParts> FromParts for Receiver<T>
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,
Tries to construct the implementing type from the given map parts.
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,
Tries to construct the implementing type from the given list parts.
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,
Tries to construct the implementing type from a single value.
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§impl<T> GetCoreLibTypeId for Receiver<T>
impl<T> GetCoreLibTypeId for Receiver<T>
fn core_lib_type_id(&self) -> CoreLibTypeId
Source§impl<T> GetDatexType for Receiver<T>where
T: GetDatexType,
impl<T> GetDatexType for Receiver<T>where
T: GetDatexType,
fn datex_type(memory: &mut SharedReferencesCache) -> Type
Source§impl<T> HasPartsKind for Receiver<T>
impl<T> HasPartsKind for Receiver<T>
Source§fn parts_kind(&self) -> PartsKind
fn parts_kind(&self) -> PartsKind
Returns the kind of parts that the implementing type can be converted into.
This can be used to check if the conversion is possible before attempting it.
If this returns
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<T: ConvertValueContainer> IntoParts for Receiver<T>
impl<T: ConvertValueContainer> IntoParts for Receiver<T>
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,
Converts the implementing type into its map parts.
Returns an error if the conversion is not possible.
You can check if the conversion is possible by calling
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,
Converts the implementing type into its list parts.
Returns an error if the conversion is not possible.
You can check if the conversion is possible by calling
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,
Converts the implementing type into a single value.
Returns an error if the conversion is not possible.
You can check if the conversion is possible by calling
parts_kind()
and checking if it returns PartsKind::SingleValue.Source§impl<T: ConvertValueContainer> IterParts for Receiver<T>
impl<T: ConvertValueContainer> IterParts for Receiver<T>
fn iter_parts<'a>( &'a self, ) -> Option<Box<dyn Iterator<Item = BorrowedValueContainer<'a>> + 'a>>
fn iter_list_parts<'a>( &'a self, ) -> Option<Box<dyn Iterator<Item = BorrowedValueContainer<'a>> + 'a>>
fn iter_list_parts_mut<'a>( &'a mut self, ) -> Option<Box<dyn Iterator<Item = BorrowedValueContainerMut<'a>> + 'a>>
fn iter_map_parts<'a>( &'a self, ) -> Option<Box<dyn Iterator<Item = (BorrowedValueContainer<'a>, BorrowedValueContainer<'a>)> + 'a>>
fn iter_map_parts_mut<'a>( &'a mut self, ) -> Option<Box<dyn Iterator<Item = (BorrowedValueContainer<'a>, BorrowedValueContainerMut<'a>)> + 'a>>
Source§impl<T: DatexNativeBase + 'static> LocalChildPathResolver for Receiver<T>
impl<T: DatexNativeBase + 'static> LocalChildPathResolver for Receiver<T>
fn resolve_child( &mut self, _key: &ValueContainer, ) -> Result<&mut ValueContainer, UpdateError>
fn resolve_value_for_path( &mut self, first: &ValueContainer, remaining_path: &[ValueContainer], ) -> Result<&mut Value, UpdateError>
Source§impl<T: SerializeWithSerdeContextDyn> SerializeWithSerdeContext for Receiver<T>
impl<T: SerializeWithSerdeContextDyn> SerializeWithSerdeContext for Receiver<T>
fn serialize_with_ctx<S: Serializer>( &self, _ctx: &SerdeContext<'_>, serializer: S, ) -> Result<S::Ok, S::Error>
Source§impl<T> StructuralEq for Receiver<T>
impl<T> StructuralEq for Receiver<T>
Source§fn structural_eq(&self, _other: &Self) -> bool
fn structural_eq(&self, _other: &Self) -> bool
Check if two values are equal, ignoring the type.
Source§impl<T> ToInstructions for Receiver<T>where
T: DatexNativeBase,
impl<T> ToInstructions for Receiver<T>where
T: DatexNativeBase,
fn to_instructions<'a>( &'a self, _visitor: &'a mut dyn ValueVisitor, _cache: &'a mut SharedReferencesCache, ) -> Box<dyn Iterator<Item = Instruction> + 'a>
Source§impl<T: DatexNativeBase + 'static> UpdateCallbackDataAccess for Receiver<T>
impl<T: DatexNativeBase + 'static> UpdateCallbackDataAccess for Receiver<T>
fn get_update_callback_data(&self) -> Option<&UpdateCallbackData>
Source§impl<T: DatexNativeBase + 'static> UpdateHandlerImpl for Receiver<T>
impl<T: DatexNativeBase + 'static> UpdateHandlerImpl for Receiver<T>
fn try_append_entry( &mut self, data: AppendEntryUpdateData, _cache: &RefCell<SharedReferencesCache>, ) -> Result<(), UpdateError>
Source§fn try_update(
&mut self,
operation: UpdateOperation,
source_id: Option<TransceiverId>,
cache: &RefCell<SharedReferencesCache>,
) -> UpdateResult
fn try_update( &mut self, operation: UpdateOperation, source_id: Option<TransceiverId>, cache: &RefCell<SharedReferencesCache>, ) -> UpdateResult
Handles an update operation on the implementing type and returns an UpdateResult.
The replacement operation must be handled at a higher level, as it is not specific to the implementing type - there are special cases, such as Option / Box.
If the optional source_id is provided, it should be used to notify observers of the internal update.
fn try_set_entry( &mut self, _data: SetEntryUpdateData, _cache: &RefCell<SharedReferencesCache>, ) -> Result<Option<ValueContainer>, UpdateError>
fn try_delete_entry( &mut self, _data: DeleteEntryUpdateData, _cache: &RefCell<SharedReferencesCache>, ) -> Result<ValueContainer, UpdateError>
fn try_clear( &mut self, _cache: &RefCell<SharedReferencesCache>, ) -> Result<ValueContainer, UpdateError>
fn try_list_splice( &mut self, _data: ListSpliceUpdateData, _cache: &RefCell<SharedReferencesCache>, ) -> Result<Vec<ValueContainer>, UpdateError>
fn try_increment( &mut self, _data: IncrementUpdateData, _cache: &RefCell<SharedReferencesCache>, ) -> Result<(), UpdateError>
fn try_decrement( &mut self, _data: DecrementUpdateData, _cache: &RefCell<SharedReferencesCache>, ) -> Result<(), UpdateError>
fn try_replace( &mut self, _data: ReplaceUpdateData, _cache: &RefCell<SharedReferencesCache>, ) -> Result<(), UpdateError>
Source§impl<T> ValueAccess for Receiver<T>where
T: DatexNativeBase + GetDatexType,
impl<T> ValueAccess for Receiver<T>where
T: DatexNativeBase + GetDatexType,
Source§fn try_get_property(
&self,
_key: &ValueContainer,
) -> Result<BorrowedValueContainer<'_>, AccessError>
fn try_get_property( &self, _key: &ValueContainer, ) -> Result<BorrowedValueContainer<'_>, AccessError>
Gets a reference to a property on the value if applicable (e.g. for map and structs).
This method returns a BorrowedValueContainer which can be either a ValueContainer or a [Callable] value.
Source§fn try_get_property_mut(
&mut self,
_key: &ValueContainer,
) -> Result<BorrowedValueContainerMut<'_>, AccessError>
fn try_get_property_mut( &mut self, _key: &ValueContainer, ) -> Result<BorrowedValueContainerMut<'_>, AccessError>
Gets a mutable reference to a property on the value if applicable (e.g. for map and structs)
Auto Trait Implementations§
impl<T> !RefUnwindSafe for Receiver<T>
impl<T> !Send for Receiver<T>
impl<T> !Sync for Receiver<T>
impl<T> !UnwindSafe for Receiver<T>
impl<T> Forget for Receiver<T>
impl<T> Freeze for Receiver<T>
impl<T> Move for Receiver<T>
impl<T> Unpin for Receiver<T>
impl<T> UnsafeUnpin for Receiver<T>
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ConvertValueContainer for T
impl<T> ConvertValueContainer for T
Source§fn to_value_container(self) -> ValueContainer
fn to_value_container(self) -> ValueContainer
Convert the value to a ValueContainer
Source§fn as_borrowed_value_container(&self) -> BorrowedValueContainer<'_>
fn as_borrowed_value_container(&self) -> BorrowedValueContainer<'_>
Borrow the value as a BorrowedValueContainer
Source§fn as_borrowed_value_container_mut(&mut self) -> BorrowedValueContainerMut<'_>
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<T, ValueContainer>where
T: Sized,
fn try_from_value_container(
value_container: ValueContainer,
) -> Result<T, ValueContainer>where
T: Sized,
Tries to downcast a ValueContainer into Self
Source§fn try_convert_from_value_container(
value_container: ValueContainer,
) -> Result<T, ()>
fn try_convert_from_value_container( value_container: ValueContainer, ) -> Result<T, ()>
Tries to cast a ValueContainer into the specified type [T].
First, it attempts a direct conversion (downcast) of the ValueContainer
into the type [T].
If that fails, it tries to convert the ValueContainer into map or list parts and then into the type [T].
Source§fn try_borrow_from_value_container(
value_container: &ValueContainer,
) -> Result<&T, ()>where
T: Sized,
fn try_borrow_from_value_container(
value_container: &ValueContainer,
) -> Result<&T, ()>where
T: 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 T, ()>where
T: Sized,
fn try_borrow_mut_from_value_container(
value_container: &mut ValueContainer,
) -> Result<&mut T, ()>where
T: Sized,
Tries to downcast a ValueContainer into a mutable reference of Self
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>
Deserialize a value of type T from a byte slice containing DXB data
impl<T> DatexNativeBase for T
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
Compare self to
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> ⓘ
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 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> ⓘ
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 moreSource§impl<T> SerializeWithSerdeContextDyn for Twhere
T: SerializeWithSerdeContext,
impl<T> SerializeWithSerdeContextDyn for Twhere
T: SerializeWithSerdeContext,
Source§impl<T> TryClone for Twhere
T: Clone + DatexNative,
impl<T> TryClone for Twhere
T: Clone + DatexNative,
Source§impl<T, U> TypeSubset<U> for Twhere
U: TypeSuperset<T>,
impl<T, U> TypeSubset<U> for Twhere
U: TypeSuperset<T>,
Source§fn is_subset_of(&self, other: &U) -> bool
fn is_subset_of(&self, other: &U) -> bool
Returns whether self is a subset of type