pub struct ZeroMap2d<'a, K0, K1, V> where
K0: ZeroMapKV<'a>,
K1: ZeroMapKV<'a>,
V: ZeroMapKV<'a>,
K0: ?Sized,
K1: ?Sized,
V: ?Sized, { /* private fields */ }
Expand description
A zero-copy, two-dimensional map datastructure .
This is an extension of ZeroMap
that supports two layers of keys. For example,
to map a pair of an integer and a string to a buffer, you can write:
let _: ZeroMap2d<u32, str, [u8]> = unimplemented!();
Internally, ZeroMap2d
stores four zero-copy vectors, one for each type argument plus
one more to match between the two vectors of keys.
Examples
use zerovec::ZeroMap2d;
// Example byte buffer representing the map { 1: {2: "three" } }
let BINCODE_BYTES: &[u8; 53] = &[
2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0,
0, 0, 2, 0, 13, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 116, 104, 114, 101, 101
];
// Deserializing to ZeroMap requires no heap allocations.
let zero_map: ZeroMap2d<u16, u16, str> = bincode::deserialize(BINCODE_BYTES)
.expect("Should deserialize successfully");
assert_eq!(zero_map.get(&1, &2), Ok("three"));
Implementations
sourceimpl<'a, K0, K1, V> ZeroMap2d<'a, K0, K1, V> where
K0: ZeroMapKV<'a>,
K1: ZeroMapKV<'a>,
V: ZeroMapKV<'a>,
K0: ?Sized,
K1: ?Sized,
V: ?Sized,
impl<'a, K0, K1, V> ZeroMap2d<'a, K0, K1, V> where
K0: ZeroMapKV<'a>,
K1: ZeroMapKV<'a>,
V: ZeroMapKV<'a>,
K0: ?Sized,
K1: ?Sized,
V: ?Sized,
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new, empty ZeroMap2d
.
Examples
use zerovec::ZeroMap2d;
let zm: ZeroMap2d<u16, str, str> = ZeroMap2d::new();
assert!(zm.is_empty());
sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Construct a new ZeroMap2d
with a given capacity
sourcepub fn as_borrowed(&'a self) -> ZeroMap2dBorrowed<'a, K0, K1, V>
pub fn as_borrowed(&'a self) -> ZeroMap2dBorrowed<'a, K0, K1, V>
Obtain a borrowed version of this map
sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserve capacity for additional
more elements to be inserted into
the ZeroMap2d
to avoid frequent reallocations.
See Vec::reserve()
for more information.
sourceimpl<'a, K0, K1, V> ZeroMap2d<'a, K0, K1, V> where
K0: ZeroMapKV<'a> + Ord,
K1: ZeroMapKV<'a> + Ord,
V: ZeroMapKV<'a>,
K0: ?Sized,
K1: ?Sized,
V: ?Sized,
impl<'a, K0, K1, V> ZeroMap2d<'a, K0, K1, V> where
K0: ZeroMapKV<'a> + Ord,
K1: ZeroMapKV<'a> + Ord,
V: ZeroMapKV<'a>,
K0: ?Sized,
K1: ?Sized,
V: ?Sized,
sourcepub fn get(&self, key0: &K0, key1: &K1) -> Result<&V::GetType, KeyError>
pub fn get(&self, key0: &K0, key1: &K1) -> Result<&V::GetType, KeyError>
Get the value associated with key0
and key1
, if it exists.
use zerovec::ZeroMap2d;
use zerovec::maps::KeyError;
let mut map = ZeroMap2d::new();
map.insert(&1, "one", "foo");
map.insert(&2, "one", "bar");
map.insert(&2, "two", "baz");
assert_eq!(map.get(&1, "one"), Ok("foo"));
assert_eq!(map.get(&1, "two"), Err(KeyError::K1));
assert_eq!(map.get(&2, "one"), Ok("bar"));
assert_eq!(map.get(&2, "two"), Ok("baz"));
assert_eq!(map.get(&3, "three"), Err(KeyError::K0));
sourcepub fn contains_key0(&self, key0: &K0) -> bool
pub fn contains_key0(&self, key0: &K0) -> bool
Returns whether key0
is contained in this map
use zerovec::ZeroMap2d;
let mut map = ZeroMap2d::new();
map.insert(&1, "one", "foo");
map.insert(&2, "two", "bar");
assert_eq!(map.contains_key0(&1), true);
assert_eq!(map.contains_key0(&3), false);
sourcepub fn insert(
&mut self,
key0: &K0,
key1: &K1,
value: &V
) -> Option<V::OwnedType>
pub fn insert(
&mut self,
key0: &K0,
key1: &K1,
value: &V
) -> Option<V::OwnedType>
Insert value
with key
, returning the existing value if it exists.
See example in Self::get()
.
sourcepub fn remove(&mut self, key0: &K0, key1: &K1) -> Result<V::OwnedType, KeyError>
pub fn remove(&mut self, key0: &K0, key1: &K1) -> Result<V::OwnedType, KeyError>
Remove the value at key
, returning it if it exists.
use zerovec::ZeroMap2d;
use zerovec::maps::KeyError;
let mut map = ZeroMap2d::new();
map.insert(&1, "one", "foo");
map.insert(&2, "two", "bar");
assert_eq!(map.remove(&1, "one"), Ok("foo".to_owned().into_boxed_str()));
assert_eq!(map.get(&1, "one"), Err(KeyError::K0));
assert_eq!(map.remove(&1, "one"), Err(KeyError::K0));
sourcepub fn try_append<'b>(
&mut self,
key0: &'b K0,
key1: &'b K1,
value: &'b V
) -> Option<(&'b K0, &'b K1, &'b V)>
pub fn try_append<'b>(
&mut self,
key0: &'b K0,
key1: &'b K1,
value: &'b V
) -> Option<(&'b K0, &'b K1, &'b V)>
Appends value
with key
to the end of the underlying vector, returning
key
and value
if it failed. Useful for extending with an existing
sorted list.
use zerovec::ZeroMap2d;
use zerovec::maps::KeyError;
let mut map = ZeroMap2d::new();
assert!(map.try_append(&1, "one", "uno").is_none());
assert!(map.try_append(&3, "three", "tres").is_none());
let unsuccessful = map.try_append(&3, "three", "tres-updated");
assert!(unsuccessful.is_some(), "append duplicate of last key");
let unsuccessful = map.try_append(&2, "two", "dos");
assert!(unsuccessful.is_some(), "append out of order");
assert_eq!(map.get(&1, "one"), Ok("uno"));
// contains the original value for the key: 3
assert_eq!(map.get(&3, "three"), Ok("tres"));
// not appended since it wasn't in order
assert_eq!(map.get(&2, "two"), Err(KeyError::K0));
sourcepub fn iter_keys0<'b>(
&'b self
) -> impl Iterator<Item = &'b <K0 as ZeroMapKV<'a>>::GetType>
pub fn iter_keys0<'b>(
&'b self
) -> impl Iterator<Item = &'b <K0 as ZeroMapKV<'a>>::GetType>
Produce an ordered iterator over keys0.
sourcepub fn iter_keys1<'b>(
&'b self,
key0: &K0
) -> Option<impl Iterator<Item = &'b <K1 as ZeroMapKV<'a>>::GetType>>
pub fn iter_keys1<'b>(
&'b self,
key0: &K0
) -> Option<impl Iterator<Item = &'b <K1 as ZeroMapKV<'a>>::GetType>>
Produce an ordered iterator over keys1 for a particular key0, if key0 exists.
sourcepub fn iter_keys1_by_index<'b>(
&'b self,
key0_index: usize
) -> Option<impl Iterator<Item = &'b <K1 as ZeroMapKV<'a>>::GetType>>
pub fn iter_keys1_by_index<'b>(
&'b self,
key0_index: usize
) -> Option<impl Iterator<Item = &'b <K1 as ZeroMapKV<'a>>::GetType>>
Produce an ordered iterator over keys1 for a particular key0_index, if key0_index exists.
This method is designed to interoperate with the enumerated key of iter_keys0
.
Panics
Panics if key0_index
is out of range.
Example
Loop over all elements of a ZeroMap2d:
use zerovec::ZeroMap2d;
let mut map: ZeroMap2d<u16, u16, str> = ZeroMap2d::new();
map.insert(&1, &1, "foo");
map.insert(&2, &3, "bar");
map.insert(&2, &4, "baz");
let mut total_value = 0;
let mut values_it = map.iter_values();
for (key0_index, key0) in map.iter_keys0().enumerate() {
for key1 in map.iter_keys1_by_index(key0_index).unwrap() {
// This code runs for every (key0, key1) pair
total_value += key0.as_unsigned_int() as usize;
total_value += key1.as_unsigned_int() as usize;
total_value += values_it.next().unwrap().len();
}
}
assert_eq!(total_value, 22);
sourcepub fn iter_values<'b>(
&'b self
) -> impl Iterator<Item = &'b <V as ZeroMapKV<'a>>::GetType>
pub fn iter_values<'b>(
&'b self
) -> impl Iterator<Item = &'b <V as ZeroMapKV<'a>>::GetType>
Produce an iterator over values, ordered by the pair (key0,key1)
sourceimpl<'a, K0, K1, V> ZeroMap2d<'a, K0, K1, V> where
K0: ZeroMapKV<'a> + ?Sized + Ord,
K1: ZeroMapKV<'a> + ?Sized + Ord,
V: ZeroMapKV<'a, Container = ZeroVec<'a, V>> + ?Sized,
V: AsULE + Copy,
impl<'a, K0, K1, V> ZeroMap2d<'a, K0, K1, V> where
K0: ZeroMapKV<'a> + ?Sized + Ord,
K1: ZeroMapKV<'a> + ?Sized + Ord,
V: ZeroMapKV<'a, Container = ZeroVec<'a, V>> + ?Sized,
V: AsULE + Copy,
sourcepub fn get_copied(&self, key0: &K0, key1: &K1) -> Option<V>
pub fn get_copied(&self, key0: &K0, key1: &K1) -> Option<V>
For cases when V
is fixed-size, obtain a direct copy of V
instead of V::ULE
Examples
let mut map: ZeroMap2d::<u16, u16, u16> = ZeroMap2d::new();
map.insert(&1, &2, &3);
map.insert(&1, &4, &5);
map.insert(&6, &7, &8);
assert_eq!(map.get_copied(&6, &7), Some(8));
Trait Implementations
sourceimpl<'a, K0, K1, V> Clone for ZeroMap2d<'a, K0, K1, V> where
K0: ZeroMapKV<'a> + ?Sized,
K1: ZeroMapKV<'a> + ?Sized,
V: ZeroMapKV<'a> + ?Sized,
<K0 as ZeroMapKV<'a>>::Container: Clone,
<K1 as ZeroMapKV<'a>>::Container: Clone,
<V as ZeroMapKV<'a>>::Container: Clone,
impl<'a, K0, K1, V> Clone for ZeroMap2d<'a, K0, K1, V> where
K0: ZeroMapKV<'a> + ?Sized,
K1: ZeroMapKV<'a> + ?Sized,
V: ZeroMapKV<'a> + ?Sized,
<K0 as ZeroMapKV<'a>>::Container: Clone,
<K1 as ZeroMapKV<'a>>::Container: Clone,
<V as ZeroMapKV<'a>>::Container: Clone,
sourceimpl<'a, K0, K1, V> Debug for ZeroMap2d<'a, K0, K1, V> where
K0: ZeroMapKV<'a> + ?Sized,
K1: ZeroMapKV<'a> + ?Sized,
V: ZeroMapKV<'a> + ?Sized,
<K0 as ZeroMapKV<'a>>::Container: Debug,
<K1 as ZeroMapKV<'a>>::Container: Debug,
<V as ZeroMapKV<'a>>::Container: Debug,
impl<'a, K0, K1, V> Debug for ZeroMap2d<'a, K0, K1, V> where
K0: ZeroMapKV<'a> + ?Sized,
K1: ZeroMapKV<'a> + ?Sized,
V: ZeroMapKV<'a> + ?Sized,
<K0 as ZeroMapKV<'a>>::Container: Debug,
<K1 as ZeroMapKV<'a>>::Container: Debug,
<V as ZeroMapKV<'a>>::Container: Debug,
sourceimpl<'a, K0, K1, V> Default for ZeroMap2d<'a, K0, K1, V> where
K0: ZeroMapKV<'a>,
K1: ZeroMapKV<'a>,
V: ZeroMapKV<'a>,
K0: ?Sized,
K1: ?Sized,
V: ?Sized,
impl<'a, K0, K1, V> Default for ZeroMap2d<'a, K0, K1, V> where
K0: ZeroMapKV<'a>,
K1: ZeroMapKV<'a>,
V: ZeroMapKV<'a>,
K0: ?Sized,
K1: ?Sized,
V: ?Sized,
sourceimpl<'de, 'a, K0, K1, V> Deserialize<'de> for ZeroMap2d<'a, K0, K1, V> where
K0: ZeroMapKV<'a> + Ord + ?Sized,
K1: ZeroMapKV<'a> + Ord + ?Sized,
V: ZeroMapKV<'a> + ?Sized,
K0::Container: Deserialize<'de>,
K1::Container: Deserialize<'de>,
V::Container: Deserialize<'de>,
K0::OwnedType: Deserialize<'de>,
K1::OwnedType: Deserialize<'de>,
V::OwnedType: Deserialize<'de>,
'de: 'a,
impl<'de, 'a, K0, K1, V> Deserialize<'de> for ZeroMap2d<'a, K0, K1, V> where
K0: ZeroMapKV<'a> + Ord + ?Sized,
K1: ZeroMapKV<'a> + Ord + ?Sized,
V: ZeroMapKV<'a> + ?Sized,
K0::Container: Deserialize<'de>,
K1::Container: Deserialize<'de>,
V::Container: Deserialize<'de>,
K0::OwnedType: Deserialize<'de>,
K1::OwnedType: Deserialize<'de>,
V::OwnedType: Deserialize<'de>,
'de: 'a,
This impl can be made available by enabling the optional serde
feature of the zerovec
crate
sourcefn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<'a, K0, K1, V> From<ZeroMap2dBorrowed<'a, K0, K1, V>> for ZeroMap2d<'a, K0, K1, V> where
K0: ZeroMapKV<'a>,
K1: ZeroMapKV<'a>,
V: ZeroMapKV<'a>,
K0: ?Sized,
K1: ?Sized,
V: ?Sized,
impl<'a, K0, K1, V> From<ZeroMap2dBorrowed<'a, K0, K1, V>> for ZeroMap2d<'a, K0, K1, V> where
K0: ZeroMapKV<'a>,
K1: ZeroMapKV<'a>,
V: ZeroMapKV<'a>,
K0: ?Sized,
K1: ?Sized,
V: ?Sized,
sourcefn from(other: ZeroMap2dBorrowed<'a, K0, K1, V>) -> Self
fn from(other: ZeroMap2dBorrowed<'a, K0, K1, V>) -> Self
Converts to this type from the input type.
sourceimpl<'a, A, B, C, K0, K1, V> FromIterator<(A, B, C)> for ZeroMap2d<'a, K0, K1, V> where
A: Borrow<K0>,
B: Borrow<K1>,
C: Borrow<V>,
K0: ZeroMapKV<'a> + ?Sized + Ord,
K1: ZeroMapKV<'a> + ?Sized + Ord,
V: ZeroMapKV<'a> + ?Sized,
impl<'a, A, B, C, K0, K1, V> FromIterator<(A, B, C)> for ZeroMap2d<'a, K0, K1, V> where
A: Borrow<K0>,
B: Borrow<K1>,
C: Borrow<V>,
K0: ZeroMapKV<'a> + ?Sized + Ord,
K1: ZeroMapKV<'a> + ?Sized + Ord,
V: ZeroMapKV<'a> + ?Sized,
sourceimpl<'a, 'b, K0, K1, V> PartialEq<ZeroMap2d<'b, K0, K1, V>> for ZeroMap2d<'a, K0, K1, V> where
K0: for<'c> ZeroMapKV<'c> + ?Sized,
K1: for<'c> ZeroMapKV<'c> + ?Sized,
V: for<'c> ZeroMapKV<'c> + ?Sized,
<K0 as ZeroMapKV<'a>>::Container: PartialEq<<K0 as ZeroMapKV<'b>>::Container>,
<K1 as ZeroMapKV<'a>>::Container: PartialEq<<K1 as ZeroMapKV<'b>>::Container>,
<V as ZeroMapKV<'a>>::Container: PartialEq<<V as ZeroMapKV<'b>>::Container>,
impl<'a, 'b, K0, K1, V> PartialEq<ZeroMap2d<'b, K0, K1, V>> for ZeroMap2d<'a, K0, K1, V> where
K0: for<'c> ZeroMapKV<'c> + ?Sized,
K1: for<'c> ZeroMapKV<'c> + ?Sized,
V: for<'c> ZeroMapKV<'c> + ?Sized,
<K0 as ZeroMapKV<'a>>::Container: PartialEq<<K0 as ZeroMapKV<'b>>::Container>,
<K1 as ZeroMapKV<'a>>::Container: PartialEq<<K1 as ZeroMapKV<'b>>::Container>,
<V as ZeroMapKV<'a>>::Container: PartialEq<<V as ZeroMapKV<'b>>::Container>,
sourceimpl<'a, K0, K1, V> Serialize for ZeroMap2d<'a, K0, K1, V> where
K0: ZeroMapKV<'a> + Serialize + ?Sized + Ord,
K1: ZeroMapKV<'a> + Serialize + ?Sized + Ord,
V: ZeroMapKV<'a> + Serialize + ?Sized,
K0::Container: Serialize,
K1::Container: Serialize,
V::Container: Serialize,
impl<'a, K0, K1, V> Serialize for ZeroMap2d<'a, K0, K1, V> where
K0: ZeroMapKV<'a> + Serialize + ?Sized + Ord,
K1: ZeroMapKV<'a> + Serialize + ?Sized + Ord,
V: ZeroMapKV<'a> + Serialize + ?Sized,
K0::Container: Serialize,
K1::Container: Serialize,
V::Container: Serialize,
This impl can be made available by enabling the optional serde_serialize
feature of the zerovec
crate
sourceimpl<'a, K0, K1, V> Yokeable<'a> for ZeroMap2d<'static, K0, K1, V> where
K0: 'static + for<'b> ZeroMapKV<'b> + ?Sized,
K1: 'static + for<'b> ZeroMapKV<'b> + ?Sized,
V: 'static + for<'b> ZeroMapKV<'b> + ?Sized,
<K0 as ZeroMapKV<'static>>::Container: for<'b> Yokeable<'b>,
<K1 as ZeroMapKV<'static>>::Container: for<'b> Yokeable<'b>,
<V as ZeroMapKV<'static>>::Container: for<'b> Yokeable<'b>,
impl<'a, K0, K1, V> Yokeable<'a> for ZeroMap2d<'static, K0, K1, V> where
K0: 'static + for<'b> ZeroMapKV<'b> + ?Sized,
K1: 'static + for<'b> ZeroMapKV<'b> + ?Sized,
V: 'static + for<'b> ZeroMapKV<'b> + ?Sized,
<K0 as ZeroMapKV<'static>>::Container: for<'b> Yokeable<'b>,
<K1 as ZeroMapKV<'static>>::Container: for<'b> Yokeable<'b>,
<V as ZeroMapKV<'static>>::Container: for<'b> Yokeable<'b>,
This impl can be made available by enabling the optional yoke
feature of the zerovec
crate
type Output = ZeroMap2d<'a, K0, K1, V>
type Output = ZeroMap2d<'a, K0, K1, V>
This type MUST be Self
with the 'static
replaced with 'a
, i.e. Self<'a>
sourcefn transform(&'a self) -> &'a Self::Output
fn transform(&'a self) -> &'a Self::Output
This method must cast self
between &'a Self<'static>
and &'a Self<'a>
. Read more
sourcefn transform_owned(self) -> Self::Output
fn transform_owned(self) -> Self::Output
This method must cast self
between Self<'static>
and Self<'a>
. Read more
sourceunsafe fn make(from: Self::Output) -> Self
unsafe fn make(from: Self::Output) -> Self
This method can be used to cast away Self<'a>
’s lifetime. Read more
sourcefn transform_mut<F>(&'a mut self, f: F) where
F: 'static + for<'b> FnOnce(&'b mut Self::Output),
fn transform_mut<F>(&'a mut self, f: F) where
F: 'static + for<'b> FnOnce(&'b mut Self::Output),
This method must cast self
between &'a mut Self<'static>
and &'a mut Self<'a>
,
and pass it to f
. Read more
sourceimpl<'zf, 's, K0, K1, V> ZeroFrom<'zf, ZeroMap2d<'s, K0, K1, V>> for ZeroMap2d<'zf, K0, K1, V> where
K0: 'static + for<'b> ZeroMapKV<'b> + ?Sized,
K1: 'static + for<'b> ZeroMapKV<'b> + ?Sized,
V: 'static + for<'b> ZeroMapKV<'b> + ?Sized,
<K0 as ZeroMapKV<'zf>>::Container: ZeroFrom<'zf, <K0 as ZeroMapKV<'s>>::Container>,
<K1 as ZeroMapKV<'zf>>::Container: ZeroFrom<'zf, <K1 as ZeroMapKV<'s>>::Container>,
<V as ZeroMapKV<'zf>>::Container: ZeroFrom<'zf, <V as ZeroMapKV<'s>>::Container>,
impl<'zf, 's, K0, K1, V> ZeroFrom<'zf, ZeroMap2d<'s, K0, K1, V>> for ZeroMap2d<'zf, K0, K1, V> where
K0: 'static + for<'b> ZeroMapKV<'b> + ?Sized,
K1: 'static + for<'b> ZeroMapKV<'b> + ?Sized,
V: 'static + for<'b> ZeroMapKV<'b> + ?Sized,
<K0 as ZeroMapKV<'zf>>::Container: ZeroFrom<'zf, <K0 as ZeroMapKV<'s>>::Container>,
<K1 as ZeroMapKV<'zf>>::Container: ZeroFrom<'zf, <K1 as ZeroMapKV<'s>>::Container>,
<V as ZeroMapKV<'zf>>::Container: ZeroFrom<'zf, <V as ZeroMapKV<'s>>::Container>,
Auto Trait Implementations
impl<'a, K0: ?Sized, K1: ?Sized, V: ?Sized> RefUnwindSafe for ZeroMap2d<'a, K0, K1, V> where
<K0 as ZeroMapKV<'a>>::Container: RefUnwindSafe,
<K1 as ZeroMapKV<'a>>::Container: RefUnwindSafe,
<V as ZeroMapKV<'a>>::Container: RefUnwindSafe,
impl<'a, K0: ?Sized, K1: ?Sized, V: ?Sized> Send for ZeroMap2d<'a, K0, K1, V> where
<K0 as ZeroMapKV<'a>>::Container: Send,
<K1 as ZeroMapKV<'a>>::Container: Send,
<V as ZeroMapKV<'a>>::Container: Send,
impl<'a, K0: ?Sized, K1: ?Sized, V: ?Sized> Sync for ZeroMap2d<'a, K0, K1, V> where
<K0 as ZeroMapKV<'a>>::Container: Sync,
<K1 as ZeroMapKV<'a>>::Container: Sync,
<V as ZeroMapKV<'a>>::Container: Sync,
impl<'a, K0: ?Sized, K1: ?Sized, V: ?Sized> Unpin for ZeroMap2d<'a, K0, K1, V> where
<K0 as ZeroMapKV<'a>>::Container: Unpin,
<K1 as ZeroMapKV<'a>>::Container: Unpin,
<V as ZeroMapKV<'a>>::Container: Unpin,
impl<'a, K0: ?Sized, K1: ?Sized, V: ?Sized> UnwindSafe for ZeroMap2d<'a, K0, K1, V> where
<K0 as ZeroMapKV<'a>>::Container: UnwindSafe,
<K1 as ZeroMapKV<'a>>::Container: UnwindSafe,
<V as ZeroMapKV<'a>>::Container: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more