pub type SendSyncAnyMap = Map<dyn Any + Send + Sync>;
Expand description
Sync version
Aliased Type§
struct SendSyncAnyMap { /* private fields */ }
Implementations
Source§impl<A: ?Sized + UncheckedAnyExt> Map<A>
impl<A: ?Sized + UncheckedAnyExt> Map<A>
Sourcepub fn with_capacity(capacity: usize) -> Map<A>
pub fn with_capacity(capacity: usize) -> Map<A>
Creates an empty collection with the given initial capacity.
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the number of elements the collection can hold without reallocating.
Sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional
more elements to be inserted
in the collection. The collection may reserve more space to avoid
frequent reallocations.
§Panics
Panics if the new allocation size overflows usize
.
Sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrinks the capacity of the collection as much as possible. It will drop down as much as possible while maintaining the internal rules and possibly leaving some space in accordance with the resize policy.
Source§impl<A: ?Sized + UncheckedAnyExt> Map<A>
impl<A: ?Sized + UncheckedAnyExt> Map<A>
Sourcepub fn get<T: IntoBox<A>>(&self) -> Option<&T>
pub fn get<T: IntoBox<A>>(&self) -> Option<&T>
Returns a reference to the value stored in the collection for the type
T
, if it exists.
Sourcepub fn get_mut<T: IntoBox<A>>(&mut self) -> Option<&mut T>
pub fn get_mut<T: IntoBox<A>>(&mut self) -> Option<&mut T>
Returns a mutable reference to the value stored in the collection for
the type T
, if it exists.
Sourcepub fn insert<T: IntoBox<A>>(&mut self, value: T) -> Option<T>
pub fn insert<T: IntoBox<A>>(&mut self, value: T) -> Option<T>
Sets the value stored in the collection for the type T
.
If the collection already had a value of type T
, that value is
returned. Otherwise, None
is returned.
Sourcepub fn remove<T: IntoBox<A>>(&mut self) -> Option<T>
pub fn remove<T: IntoBox<A>>(&mut self) -> Option<T>
Removes the T
value from the collection,
returning it if there was one or None
if there was not.