pub struct Map { /* private fields */ }Implementations§
Source§impl Map
impl Map
Sourcepub fn try_delete_with_source(
&mut self,
key: &ValueContainer,
source: Option<TransceiverId>,
) -> Result<ValueContainer, MapAccessError>
pub fn try_delete_with_source( &mut self, key: &ValueContainer, source: Option<TransceiverId>, ) -> Result<ValueContainer, MapAccessError>
Removes a key from the map, returning the value if it existed.
Sourcepub unsafe fn try_delete_unchecked_with_source(
&mut self,
key: &ValueContainer,
source: Option<TransceiverId>,
) -> Result<ValueContainer, KeyNotFoundError>
pub unsafe fn try_delete_unchecked_with_source( &mut self, key: &ValueContainer, source: Option<TransceiverId>, ) -> Result<ValueContainer, KeyNotFoundError>
Removes a key from the map, returning the value if it existed. Also works for structural maps, but creates a map that no longer matches the assumed type.
§Safety
The map should no longer be used after this operation.
Sourcepub fn try_clear_with_source(
&mut self,
source: Option<TransceiverId>,
) -> Result<ValueContainer, MapAccessError>
pub fn try_clear_with_source( &mut self, source: Option<TransceiverId>, ) -> Result<ValueContainer, MapAccessError>
Clears all entries in the map, returning an error if the map is not dynamic.
Source§impl Map
impl Map
pub fn try_new( entries: impl Into<MapEntries>, allow_only_text_keys: bool, ) -> Result<Self, UnexpectedPropertyError>
pub fn new_structural(entries: Vec<(ValueContainer, ValueContainer)>) -> Self
pub fn new_dynamic( entries: IndexMap<ValueContainer, ValueContainer, RandomState>, ) -> Self
pub fn try_convert_to<T: FromParts>(self) -> Result<T, ()>
pub fn is_structural(&self) -> bool
pub fn size(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn try_get(
&self,
key: &ValueContainer,
) -> Result<&ValueContainer, KeyNotFoundError>
pub fn try_get( &self, key: &ValueContainer, ) -> Result<&ValueContainer, KeyNotFoundError>
Gets a value in the map by reference. Returns None if the key is not found.
pub fn try_get_mut( &mut self, key: &ValueContainer, ) -> Result<&mut ValueContainer, KeyNotFoundError>
Sourcepub fn has(&self, key: &ValueContainer) -> bool
pub fn has(&self, key: &ValueContainer) -> bool
Checks if the map contains the given key.
Sourcepub fn ensure_only_properties(
&self,
allowed: &[&str],
) -> Result<(), UnexpectedPropertyError>
pub fn ensure_only_properties( &self, allowed: &[&str], ) -> Result<(), UnexpectedPropertyError>
Ensures that the map only contains the given allowed keys, returning an error if any unexpected keys are found. This should only be called on structural maps, as it relies on the assumption that the map will not be modified after construction.
Sourcepub fn iter_local_values_mut(
&mut self,
) -> impl Iterator<Item = (&ValueContainer, &mut Value)>
pub fn iter_local_values_mut( &mut self, ) -> impl Iterator<Item = (&ValueContainer, &mut Value)>
Returns an iterator over the local values in the map, skipping any children that have a ValueContainer::Shared value
Sourcepub fn try_delete(
&mut self,
key: &ValueContainer,
) -> Result<ValueContainer, MapAccessError>
pub fn try_delete( &mut self, key: &ValueContainer, ) -> Result<ValueContainer, MapAccessError>
Removes a key from the map, returning the value if it existed.
Sourcepub unsafe fn try_delete_unchecked(
&mut self,
key: &ValueContainer,
) -> Result<ValueContainer, KeyNotFoundError>
pub unsafe fn try_delete_unchecked( &mut self, key: &ValueContainer, ) -> Result<ValueContainer, KeyNotFoundError>
Removes a key from the map, returning the value if it existed. Also works for structural maps, but creates a map that no longer matches the assumed type.
§Safety
The map should no longer be used after this operation. FIXME: find a way to pass static str keys here
Sourcepub fn try_clear(&mut self) -> Result<ValueContainer, MapAccessError>
pub fn try_clear(&mut self) -> Result<ValueContainer, MapAccessError>
Clears all entries in the map, returning an error if the map is not dynamic.
Trait Implementations§
Source§impl Classification for Map
impl Classification for Map
Source§fn entity_type(&self, _cache: &mut SharedReferencesCache) -> Option<EntityType>
fn entity_type(&self, _cache: &mut SharedReferencesCache) -> Option<EntityType>
Source§fn entity_type_address(&self) -> Option<PointerAddress>
fn entity_type_address(&self) -> Option<PointerAddress>
Source§fn tag(&self) -> Option<ValueTag>
fn tag(&self) -> Option<ValueTag>
Source§fn impls(&self) -> Vec<PointerAddress>
fn impls(&self) -> Vec<PointerAddress>
Source§fn classification(
&self,
cache: &mut SharedReferencesCache,
) -> ValueClassification
fn classification( &self, cache: &mut SharedReferencesCache, ) -> ValueClassification
Source§fn unresolved_classification(&self) -> UnresolvedValueClassification
fn unresolved_classification(&self) -> UnresolvedValueClassification
Source§impl ConvertValue for Map
impl ConvertValue for Map
fn to_value(self) -> Value
fn try_from_value(value: Value) -> Result<Self, Value>
fn try_borrow_from_value(value: &Value) -> Result<&Map, ()>
fn try_borrow_mut_from_value(value: &mut Value) -> Result<&mut Map, ()>
Source§impl DatexHash for Map
impl DatexHash for Map
fn datex_hash(&self, state: &mut dyn Hasher)
fn datex_hash_default(&self) -> u64
Source§impl DatexNative for Map
impl DatexNative for Map
Source§impl DatexNativeOps for Map
impl DatexNativeOps for Map
fn add_native(&self, _rhs: &dyn DatexNative) -> Option<Box<dyn DatexNative>>
Source§impl DatexNativeStructural for Map
impl DatexNativeStructural for Map
Source§fn classification_without_cache(&self) -> ValueClassification
fn classification_without_cache(&self) -> ValueClassification
Source§impl<'de> DeserializeWithSerdeContext<'de> for Map
impl<'de> DeserializeWithSerdeContext<'de> for Map
fn deserialize_with_ctx<D>(
ctx: &SerdeContext<'_>,
deserializer: D,
) -> Result<Self, D::Error>where
D: Deserializer<'de>,
impl Eq for Map
Source§impl<K, V> From<IndexMap<K, V, RandomState>> for Map
impl<K, V> From<IndexMap<K, V, RandomState>> for Map
Source§fn from(map: IndexMap<K, V, RandomState>) -> Self
fn from(map: IndexMap<K, V, RandomState>) -> Self
Source§impl From<MapEntries> for Map
impl From<MapEntries> for Map
Source§fn from(entries: MapEntries) -> Self
fn from(entries: MapEntries) -> Self
Source§impl From<Vec<(ValueContainer, ValueContainer)>> for Map
impl From<Vec<(ValueContainer, ValueContainer)>> for Map
Source§fn from(vec: Vec<(ValueContainer, ValueContainer)>) -> Self
fn from(vec: Vec<(ValueContainer, ValueContainer)>) -> Self
Create a dynamic map from a vector of value containers.
Source§impl<K, V> FromIterator<(K, V)> for Map
impl<K, V> FromIterator<(K, V)> for Map
Source§impl FromParts for Map
impl FromParts for Map
fn try_from_map_parts_with_tag(
parts: Map,
_tag: Option<&str>,
) -> Result<Self, ()>where
Self: Sized,
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,
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,
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,
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 GetCoreLibTypeId for Map
impl GetCoreLibTypeId for Map
fn core_lib_type_id(&self) -> CoreLibTypeId
Source§impl GetDatexType for Map
impl GetDatexType for Map
fn datex_type(_context: &mut SharedReferencesCache) -> Type
Source§impl HasPartsKind for Map
impl HasPartsKind for Map
Source§fn parts_kind(&self) -> PartsKind
fn parts_kind(&self) -> PartsKind
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 InternalMutabilityUpdateHandler for Map
impl InternalMutabilityUpdateHandler for Map
fn set_update_callback_data(&mut self, observe_data: Option<UpdateCallbackData>)
Source§fn set_child_update_callback_data(
&self,
child_key: impl Into<ValueContainer>,
child_value: &mut Value,
)
fn set_child_update_callback_data( &self, child_key: impl Into<ValueContainer>, child_value: &mut Value, )
Source§fn set_child_update_callback_data_if_local(
&self,
child_key: &(impl Into<ValueContainer> + Clone),
child_value: &mut ValueContainer,
)
fn set_child_update_callback_data_if_local( &self, child_key: &(impl Into<ValueContainer> + Clone), child_value: &mut ValueContainer, )
Source§fn maybe_trigger_update_callback(
&self,
source_id: Option<TransceiverId>,
update_operation_generator: impl FnOnce() -> UpdateOperation,
)
fn maybe_trigger_update_callback( &self, source_id: Option<TransceiverId>, update_operation_generator: impl FnOnce() -> UpdateOperation, )
Source§impl IntoIterator for Map
impl IntoIterator for Map
Source§type Item = (ValueContainer, ValueContainer)
type Item = (ValueContainer, ValueContainer)
Source§type IntoIter = IntoMapIterator
type IntoIter = IntoMapIterator
Source§impl<'a> IntoIterator for &'a mut Map
impl<'a> IntoIterator for &'a mut Map
Source§type Item = (&'a ValueContainer, &'a mut ValueContainer)
type Item = (&'a ValueContainer, &'a mut ValueContainer)
Source§type IntoIter = MapMutIterator<'a>
type IntoIter = MapMutIterator<'a>
Source§impl IntoParts for Map
impl IntoParts for Map
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,
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,
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,
parts_kind()
and checking if it returns PartsKind::SingleValue.Source§impl IterParts for Map
impl IterParts for Map
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>>
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>>
Source§impl LocalChildPathResolver for Map
impl LocalChildPathResolver for Map
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 SerializeWithSerdeContext for Map
impl SerializeWithSerdeContext for Map
fn serialize_with_ctx<S>(
&self,
ctx: &SerdeContext<'_>,
serializer: S,
) -> Result<S::Ok, S::Error>where
S: Serializer,
Source§impl StructuralEq for Map
impl StructuralEq for Map
Source§fn structural_eq(&self, other: &Self) -> bool
fn structural_eq(&self, other: &Self) -> bool
Source§impl ToInstructions for Map
impl ToInstructions for Map
fn to_instructions<'a>( &'a self, visitor: &'a mut dyn ValueVisitor, cache: &'a mut SharedReferencesCache, ) -> Box<dyn Iterator<Item = Instruction> + 'a>
Source§impl UpdateCallbackDataAccess for Map
impl UpdateCallbackDataAccess for Map
fn get_update_callback_data(&self) -> Option<&UpdateCallbackData>
Source§impl UpdateHandlerImpl for Map
impl UpdateHandlerImpl for Map
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>
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
fn try_append_entry( &mut self, _data: AppendEntryUpdateData, _cache: &RefCell<SharedReferencesCache>, ) -> Result<(), 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 ValueAccess for Map
impl ValueAccess for Map
Source§fn try_get_property(
&self,
key: &ValueContainer,
) -> Result<BorrowedValueContainer<'_>, AccessError>
fn try_get_property( &self, key: &ValueContainer, ) -> Result<BorrowedValueContainer<'_>, AccessError>
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>
Auto Trait Implementations§
impl !RefUnwindSafe for Map
impl !Send for Map
impl !Sync for Map
impl !UnwindSafe for Map
impl Forget for Map
impl Freeze for Map
impl Move for Map
impl Unpin for Map
impl UnsafeUnpin for Map
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> ConvertValueContainer for T
impl<T> ConvertValueContainer for T
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<T, ValueContainer>where
T: Sized,
fn try_from_value_container(
value_container: ValueContainer,
) -> Result<T, ValueContainer>where
T: Sized,
Source§fn try_convert_from_value_container(
value_container: ValueContainer,
) -> Result<T, ()>
fn try_convert_from_value_container( value_container: ValueContainer, ) -> Result<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,
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,
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>
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
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