Struct abi_stable::std_types::map::RHashMap
source · #[repr(C)]pub struct RHashMap<K, V, S = RandomState> { /* private fields */ }
Expand description
An ffi-safe hashmap, which wraps std::collections::HashMap<K, V, S>
,
only requiring the K: Eq + Hash
bounds when constructing it.
Most of the API in HashMap
is implemented here, including the Entry API.
§Example
This example demonstrates how one can use the RHashMap as a dictionary.
use abi_stable::std_types::{RHashMap, RSome, RString, Tuple2};
let mut map = RHashMap::new();
map.insert(
"dictionary",
"A book/document containing definitions of words",
);
map.insert("bibliophile", "Someone who loves books.");
map.insert("pictograph", "A picture representating of a word.");
assert_eq!(
map["dictionary"],
"A book/document containing definitions of words",
);
assert_eq!(map.remove("bibliophile"), RSome("Someone who loves books."),);
assert_eq!(
map.get("pictograph"),
Some(&"A picture representating of a word."),
);
for Tuple2(k, v) in map {
assert!(k == "dictionary" || k == "pictograph");
assert!(
v == "A book/document containing definitions of words" ||
v == "A picture representating of a word.",
"{} => {}",
k,
v,
);
}
Implementations§
source§impl<K, V> RHashMap<K, V, RandomState>
impl<K, V> RHashMap<K, V, RandomState>
source§impl<K, V, S> RHashMap<K, V, S>
impl<K, V, S> RHashMap<K, V, S>
sourcepub fn with_hasher(hash_builder: S) -> RHashMap<K, V, S>
pub fn with_hasher(hash_builder: S) -> RHashMap<K, V, S>
Constructs an empty RHashMap with the passed hash_builder
to hash the keys.
§Example
use abi_stable::std_types::{RHashMap, RString};
use std::collections::hash_map::RandomState;
let s = RandomState::new();
let mut map = RHashMap::<RString, u32, _>::with_hasher(s);
assert!(map.is_empty());
map.insert("Hello".into(), 10);
assert_eq!(map.is_empty(), false);
sourcepub fn with_capacity_and_hasher(
capacity: usize,
hash_builder: S,
) -> RHashMap<K, V, S>
pub fn with_capacity_and_hasher( capacity: usize, hash_builder: S, ) -> RHashMap<K, V, S>
Constructs an empty RHashMap with at least the passed capacity,
and the passed hash_builder
to hash the keys.
§Example
use abi_stable::std_types::{RHashMap, RString};
use std::collections::hash_map::RandomState;
let s = RandomState::new();
let mut map = RHashMap::<RString, u32, _>::with_capacity_and_hasher(10, s);
assert!(map.capacity() >= 10);
source§impl<K, V, S> RHashMap<K, V, S>
impl<K, V, S> RHashMap<K, V, S>
sourcepub fn contains_key<Q>(&self, query: &Q) -> bool
pub fn contains_key<Q>(&self, query: &Q) -> bool
Returns whether the map associates a value with the key.
§Example
use abi_stable::std_types::{RHashMap, RString};
let mut map = RHashMap::<RString, u32>::new();
assert_eq!(map.contains_key("boo"), false);
map.insert("boo".into(), 0);
assert_eq!(map.contains_key("boo"), true);
sourcepub fn get<Q>(&self, query: &Q) -> Option<&V>
pub fn get<Q>(&self, query: &Q) -> Option<&V>
Returns a reference to the value associated with the key.
Returns a None
if there is no entry for the key.
§Example
use abi_stable::std_types::{RHashMap, RString};
let mut map = RHashMap::<RString, u32>::new();
assert_eq!(map.get("boo"), None);
map.insert("boo".into(), 0);
assert_eq!(map.get("boo"), Some(&0));
sourcepub fn get_mut<Q>(&mut self, query: &Q) -> Option<&mut V>
pub fn get_mut<Q>(&mut self, query: &Q) -> Option<&mut V>
Returns a mutable reference to the value associated with the key.
Returns a None
if there is no entry for the key.
§Example
use abi_stable::std_types::{RHashMap, RString};
let mut map = RHashMap::<RString, u32>::new();
assert_eq!(map.get_mut("boo"), None);
map.insert("boo".into(), 0);
assert_eq!(map.get_mut("boo"), Some(&mut 0));
sourcepub fn remove<Q>(&mut self, query: &Q) -> ROption<V>
pub fn remove<Q>(&mut self, query: &Q) -> ROption<V>
Removes the value associated with the key.
§Example
use abi_stable::std_types::{RHashMap, RSome, RNone};
let mut map = vec![(0, 1), (3, 4)].into_iter().collect::<RHashMap<u32, u32>>();
assert_eq!(map.remove(&0), RSome(1));
assert_eq!(map.remove(&0), RNone);
assert_eq!(map.remove(&3), RSome(4));
assert_eq!(map.remove(&3), RNone);
sourcepub fn remove_entry<Q>(&mut self, query: &Q) -> ROption<Tuple2<K, V>>
pub fn remove_entry<Q>(&mut self, query: &Q) -> ROption<Tuple2<K, V>>
Removes the entry for the key.
§Example
use abi_stable::std_types::{RHashMap, RSome, RNone, Tuple2};
let mut map = vec![(0, 1), (3, 4)].into_iter().collect::<RHashMap<u32, u32>>();
assert_eq!(map.remove_entry(&0), RSome(Tuple2(0, 1)));
assert_eq!(map.remove_entry(&0), RNone);
assert_eq!(map.remove_entry(&3), RSome(Tuple2(3, 4)));
assert_eq!(map.remove_entry(&3), RNone);
source§impl<K, V, S> RHashMap<K, V, S>
impl<K, V, S> RHashMap<K, V, S>
sourcepub fn contains_key_p(&self, key: &K) -> bool
pub fn contains_key_p(&self, key: &K) -> bool
Returns whether the map associates a value with the key.
§Example
use abi_stable::std_types::RHashMap;
let mut map = RHashMap::<u32, u32>::new();
assert_eq!(map.contains_key(&11), false);
map.insert(11, 0);
assert_eq!(map.contains_key(&11), true);
sourcepub fn get_p(&self, key: &K) -> Option<&V>
pub fn get_p(&self, key: &K) -> Option<&V>
Returns a reference to the value associated with the key.
Returns a None
if there is no entry for the key.
§Example
use abi_stable::std_types::RHashMap;
let mut map = RHashMap::<u32, u32>::new();
assert_eq!(map.get(&12), None);
map.insert(12, 0);
assert_eq!(map.get(&12), Some(&0));
sourcepub fn get_mut_p(&mut self, key: &K) -> Option<&mut V>
pub fn get_mut_p(&mut self, key: &K) -> Option<&mut V>
Returns a mutable reference to the value associated with the key.
Returns a None
if there is no entry for the key.
§Example
use abi_stable::std_types::RHashMap;
let mut map = RHashMap::<u32, u32>::new();
assert_eq!(map.get_mut(&12), None);
map.insert(12, 0);
assert_eq!(map.get_mut(&12), Some(&mut 0));
sourcepub fn remove_p(&mut self, key: &K) -> ROption<V>
pub fn remove_p(&mut self, key: &K) -> ROption<V>
Removes the value associated with the key.
§Example
use abi_stable::std_types::{RHashMap, RSome, RNone};
let mut map = vec![(0, 1), (3, 4)].into_iter().collect::<RHashMap<u32, u32>>();
assert_eq!(map.remove_p(&0), RSome(1));
assert_eq!(map.remove_p(&0), RNone);
assert_eq!(map.remove_p(&3), RSome(4));
assert_eq!(map.remove_p(&3), RNone);
sourcepub fn remove_entry_p(&mut self, key: &K) -> ROption<Tuple2<K, V>>
pub fn remove_entry_p(&mut self, key: &K) -> ROption<Tuple2<K, V>>
Removes the entry for the key.
§Example
use abi_stable::std_types::{RHashMap, RSome, RNone, Tuple2};
let mut map = vec![(0, 1), (3, 4)].into_iter().collect::<RHashMap<u32, u32>>();
assert_eq!(map.remove_entry_p(&0), RSome(Tuple2(0, 1)));
assert_eq!(map.remove_entry_p(&0), RNone);
assert_eq!(map.remove_entry_p(&3), RSome(Tuple2(3, 4)));
assert_eq!(map.remove_entry_p(&3), RNone);
sourcepub fn index_p(&self, key: &K) -> &V
pub fn index_p(&self, key: &K) -> &V
Returns a reference to the value associated with the key.
§Panics
Panics if the key is not associated with a value.
§Example
use abi_stable::std_types::RHashMap;
let mut map = vec![(0, 1), (3, 4)].into_iter().collect::<RHashMap<u32, u32>>();
assert_eq!(map.index_p(&0), &1);
assert_eq!(map.index_p(&3), &4);
use abi_stable::std_types::RHashMap;
let mut map = RHashMap::<u32, u32>::new();
assert_eq!(map.index_p(&0), &1);
sourcepub fn index_mut_p(&mut self, key: &K) -> &mut V
pub fn index_mut_p(&mut self, key: &K) -> &mut V
Returns a mutable reference to the value associated with the key.
§Panics
Panics if the key is not associated with a value.
§Example
use abi_stable::std_types::RHashMap;
let mut map = vec![(0, 1), (3, 4)].into_iter().collect::<RHashMap<u32, u32>>();
assert_eq!(map.index_mut_p(&0), &mut 1);
assert_eq!(map.index_mut_p(&3), &mut 4);
use abi_stable::std_types::RHashMap;
let mut map = RHashMap::<u32, u32>::new();
assert_eq!(map.index_mut_p(&0), &mut 1);
sourcepub fn insert(&mut self, key: K, value: V) -> ROption<V>
pub fn insert(&mut self, key: K, value: V) -> ROption<V>
Inserts a value into the map, associating it with a key, returning the previous value.
§Example
use abi_stable::std_types::RHashMap;
let mut map = RHashMap::<u32, u32>::new();
map.insert(0, 1);
map.insert(2, 3);
assert_eq!(map[&0], 1);
assert_eq!(map[&2], 3);
sourcepub fn reserve(&mut self, reserved: usize)
pub fn reserve(&mut self, reserved: usize)
Reserves enough space to insert reserved
extra elements without reallocating.
§Example
use abi_stable::std_types::RHashMap;
let mut map = RHashMap::<u32, u32>::new();
map.reserve(10);
sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Removes all the entries in the map.
§Example
use abi_stable::std_types::RHashMap;
let mut map = vec![(0, 1), (3, 4)].into_iter().collect::<RHashMap<u32, u32>>();
assert_eq!(map.contains_key(&0), true);
assert_eq!(map.contains_key(&3), true);
map.clear();
assert_eq!(map.contains_key(&0), false);
assert_eq!(map.contains_key(&3), false);
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the amount of entries in the map.
§Example
use abi_stable::std_types::RHashMap;
let mut map = RHashMap::<u32, u32>::new();
assert_eq!(map.len(), 0);
map.insert(0, 1);
assert_eq!(map.len(), 1);
map.insert(2, 3);
assert_eq!(map.len(), 2);
sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the capacity of the map, the amount of elements it can store without reallocating.
Note that this is a lower bound, since hash maps don’t necessarily have an exact capacity.
§Example
use abi_stable::std_types::RHashMap;
let mut map = RHashMap::<u32, u32>::with_capacity(4);
assert!(map.capacity() >= 4);
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns whether the map contains any entries.
§Example
use abi_stable::std_types::RHashMap;
let mut map = RHashMap::<u32, u32>::new();
assert_eq!(map.is_empty(), true);
map.insert(0, 1);
assert_eq!(map.is_empty(), false);
sourcepub fn iter(&self) -> Iter<'_, K, V>
pub fn iter(&self) -> Iter<'_, K, V>
Iterates over the entries in the map, with references to the values in the map.
This returns a type that implements
Iterator<Item= Tuple2< &K, &V > > + !Send + !Sync + Clone
§Example
use abi_stable::std_types::{RHashMap, Tuple2};
let mut map = RHashMap::<u32, u32>::new();
map.insert(0, 1);
map.insert(3, 4);
let mut list = map.iter().collect::<Vec<_>>();
list.sort();
assert_eq!( list, vec![Tuple2(&0, &1), Tuple2(&3, &4)] );
sourcepub fn iter_mut(&mut self) -> IterMut<'_, K, V>
pub fn iter_mut(&mut self) -> IterMut<'_, K, V>
Iterates over the entries in the map, with mutable references to the values in the map.
This returns a type that implements
Iterator<Item= Tuple2< &K, &mut V > > + !Send + !Sync
§Example
use abi_stable::std_types::{RHashMap, Tuple2};
let mut map = RHashMap::<u32, u32>::new();
map.insert(0, 1);
map.insert(3, 4);
let mut list = map.iter_mut().collect::<Vec<_>>();
list.sort();
assert_eq!( list, vec![Tuple2(&0, &mut 1), Tuple2(&3, &mut 4)] );
sourcepub fn drain(&mut self) -> Drain<'_, K, V>
pub fn drain(&mut self) -> Drain<'_, K, V>
Clears the map, returning an iterator over all the entries that were removed.
This returns a type that implements Iterator<Item= Tuple2< K, V > > + !Send + !Sync
§Example
use abi_stable::std_types::{RHashMap, Tuple2};
let mut map = RHashMap::<u32, u32>::new();
map.insert(0, 1);
map.insert(3, 4);
let mut list = map.drain().collect::<Vec<_>>();
list.sort();
assert_eq!( list, vec![Tuple2(0, 1), Tuple2(3, 4)] );
assert!(map.is_empty());
sourcepub fn entry(&mut self, key: K) -> REntry<'_, K, V>
pub fn entry(&mut self, key: K) -> REntry<'_, K, V>
Gets a handle into the entry in the map for the key, that allows operating directly on the entry.
§Example
use abi_stable::std_types::RHashMap;
let mut map = RHashMap::<u32, u32>::new();
// Inserting an entry that wasn't there before.
{
let mut entry = map.entry(0);
assert_eq!(entry.get(), None);
assert_eq!(entry.or_insert(3), &mut 3);
assert_eq!(map.get(&0), Some(&3));
}
sourcepub fn keys(&self) -> Keys<'_, K, V> ⓘ
pub fn keys(&self) -> Keys<'_, K, V> ⓘ
An iterator visiting all keys in arbitrary order.
The iterator element type is &'a K
.
§Examples
use abi_stable::std_types::RHashMap;
let mut map = RHashMap::new();
map.insert("a", 1);
map.insert("b", 2);
map.insert("c", 3);
for key in map.keys() {
println!("{}", key);
}
sourcepub fn values(&self) -> Values<'_, K, V> ⓘ
pub fn values(&self) -> Values<'_, K, V> ⓘ
An iterator visiting all values in arbitrary order.
The iterator element type is &'a V
.
§Examples
use abi_stable::std_types::RHashMap;
let mut map = RHashMap::new();
map.insert("a", 1);
map.insert("b", 2);
map.insert("c", 3);
for val in map.values() {
println!("{}", val);
}
Trait Implementations§
source§impl<'de, K, V, S> Deserialize<'de> for RHashMap<K, V, S>
impl<'de, K, V, S> Deserialize<'de> for RHashMap<K, V, S>
source§fn 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>,
source§impl<K, V, S> Extend<(K, V)> for RHashMap<K, V, S>
impl<K, V, S> Extend<(K, V)> for RHashMap<K, V, S>
source§fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = (K, V)>,
fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = (K, V)>,
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl<K, V, S> Extend<Tuple2<K, V>> for RHashMap<K, V, S>
impl<K, V, S> Extend<Tuple2<K, V>> for RHashMap<K, V, S>
source§fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = Tuple2<K, V>>,
fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = Tuple2<K, V>>,
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl<K, V, S> GetStaticEquivalent_ for RHashMap<K, V, S>where
K: __StableAbi,
V: __StableAbi,
impl<K, V, S> GetStaticEquivalent_ for RHashMap<K, V, S>where
K: __StableAbi,
V: __StableAbi,
source§type StaticEquivalent = _static_RHashMap<<K as GetStaticEquivalent_>::StaticEquivalent, <V as GetStaticEquivalent_>::StaticEquivalent, ()>
type StaticEquivalent = _static_RHashMap<<K as GetStaticEquivalent_>::StaticEquivalent, <V as GetStaticEquivalent_>::StaticEquivalent, ()>
'static
equivalent of Self
source§impl<'a, K, V, S> IntoIterator for &'a RHashMap<K, V, S>
impl<'a, K, V, S> IntoIterator for &'a RHashMap<K, V, S>
This returns an Iterator<Item= Tuple2< &K, &V > > + !Send + !Sync + Clone
source§impl<'a, K, V, S> IntoIterator for &'a mut RHashMap<K, V, S>
impl<'a, K, V, S> IntoIterator for &'a mut RHashMap<K, V, S>
This returns a type that implements
Iterator<Item= Tuple2< &K, &mut V > > + !Send + !Sync
source§impl<K, V, S> IntoIterator for RHashMap<K, V, S>
impl<K, V, S> IntoIterator for RHashMap<K, V, S>
This returns an Iterator<Item= Tuple2< K, V > >+!Send+!Sync
source§impl<K, V, S> StableAbi for RHashMap<K, V, S>where
K: __StableAbi,
V: __StableAbi,
impl<K, V, S> StableAbi for RHashMap<K, V, S>where
K: __StableAbi,
V: __StableAbi,
source§type IsNonZeroType = False
type IsNonZeroType = False
source§const LAYOUT: &'static TypeLayout = _
const LAYOUT: &'static TypeLayout = _
source§const ABI_CONSTS: AbiConsts = _
const ABI_CONSTS: AbiConsts = _
const
-equivalents of the associated types.impl<K, V, S> Eq for RHashMap<K, V, S>
impl<K, V, S> Send for RHashMap<K, V, S>
impl<K, V, S> Sync for RHashMap<K, V, S>
Auto Trait Implementations§
impl<K, V, S> Freeze for RHashMap<K, V, S>
impl<K, V, S> RefUnwindSafe for RHashMap<K, V, S>
impl<K, V, S> Unpin for RHashMap<K, V, S>
impl<K, V, S> UnwindSafe for RHashMap<K, V, S>
Blanket Implementations§
source§impl<T> AlignerFor<1> for T
impl<T> AlignerFor<1> for T
source§impl<T> AlignerFor<1024> for T
impl<T> AlignerFor<1024> for T
source§type Aligner = AlignTo1024<T>
type Aligner = AlignTo1024<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.source§impl<T> AlignerFor<128> for T
impl<T> AlignerFor<128> for T
source§type Aligner = AlignTo128<T>
type Aligner = AlignTo128<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.source§impl<T> AlignerFor<16> for T
impl<T> AlignerFor<16> for T
source§impl<T> AlignerFor<16384> for T
impl<T> AlignerFor<16384> for T
source§type Aligner = AlignTo16384<T>
type Aligner = AlignTo16384<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.source§impl<T> AlignerFor<2> for T
impl<T> AlignerFor<2> for T
source§impl<T> AlignerFor<2048> for T
impl<T> AlignerFor<2048> for T
source§type Aligner = AlignTo2048<T>
type Aligner = AlignTo2048<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.source§impl<T> AlignerFor<256> for T
impl<T> AlignerFor<256> for T
source§type Aligner = AlignTo256<T>
type Aligner = AlignTo256<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.source§impl<T> AlignerFor<32> for T
impl<T> AlignerFor<32> for T
source§impl<T> AlignerFor<32768> for T
impl<T> AlignerFor<32768> for T
source§type Aligner = AlignTo32768<T>
type Aligner = AlignTo32768<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.source§impl<T> AlignerFor<4> for T
impl<T> AlignerFor<4> for T
source§impl<T> AlignerFor<4096> for T
impl<T> AlignerFor<4096> for T
source§type Aligner = AlignTo4096<T>
type Aligner = AlignTo4096<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.source§impl<T> AlignerFor<512> for T
impl<T> AlignerFor<512> for T
source§type Aligner = AlignTo512<T>
type Aligner = AlignTo512<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.source§impl<T> AlignerFor<64> for T
impl<T> AlignerFor<64> for T
source§impl<T> AlignerFor<8> for T
impl<T> AlignerFor<8> for T
source§impl<T> AlignerFor<8192> for T
impl<T> AlignerFor<8192> for T
source§type Aligner = AlignTo8192<T>
type Aligner = AlignTo8192<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<'a, T> RCowCompatibleRef<'a> for Twhere
T: Clone + 'a,
impl<'a, T> RCowCompatibleRef<'a> for Twhere
T: Clone + 'a,
source§fn as_c_ref(from: &'a T) -> <T as RCowCompatibleRef<'a>>::RefC
fn as_c_ref(from: &'a T) -> <T as RCowCompatibleRef<'a>>::RefC
source§fn as_rust_ref(from: <T as RCowCompatibleRef<'a>>::RefC) -> &'a T
fn as_rust_ref(from: <T as RCowCompatibleRef<'a>>::RefC) -> &'a T
source§impl<S> ROExtAcc for S
impl<S> ROExtAcc for S
source§fn f_get<F>(&self, offset: FieldOffset<S, F, Aligned>) -> &F
fn f_get<F>(&self, offset: FieldOffset<S, F, Aligned>) -> &F
offset
. Read moresource§fn f_get_mut<F>(&mut self, offset: FieldOffset<S, F, Aligned>) -> &mut F
fn f_get_mut<F>(&mut self, offset: FieldOffset<S, F, Aligned>) -> &mut F
offset
. Read moresource§fn f_get_ptr<F, A>(&self, offset: FieldOffset<S, F, A>) -> *const F
fn f_get_ptr<F, A>(&self, offset: FieldOffset<S, F, A>) -> *const F
offset
. Read moresource§fn f_get_mut_ptr<F, A>(&mut self, offset: FieldOffset<S, F, A>) -> *mut F
fn f_get_mut_ptr<F, A>(&mut self, offset: FieldOffset<S, F, A>) -> *mut F
offset
. Read moresource§impl<S> ROExtOps<Aligned> for S
impl<S> ROExtOps<Aligned> for S
source§fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Aligned>, value: F) -> F
fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Aligned>, value: F) -> F
offset
) with value
,
returning the previous value of the field. Read moresource§fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Aligned>) -> Fwhere
F: Copy,
fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Aligned>) -> Fwhere
F: Copy,
source§impl<S> ROExtOps<Unaligned> for S
impl<S> ROExtOps<Unaligned> for S
source§fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, value: F) -> F
fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, value: F) -> F
offset
) with value
,
returning the previous value of the field. Read moresource§fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Unaligned>) -> Fwhere
F: Copy,
fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Unaligned>) -> Fwhere
F: Copy,
source§impl<T> SelfOps for Twhere
T: ?Sized,
impl<T> SelfOps for Twhere
T: ?Sized,
source§fn piped<F, U>(self, f: F) -> U
fn piped<F, U>(self, f: F) -> U
source§fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
piped
except that the function takes &Self
Useful for functions that take &Self
instead of Self
. Read moresource§fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
piped
, except that the function takes &mut Self
.
Useful for functions that take &mut Self
instead of Self
.source§fn mutated<F>(self, f: F) -> Self
fn mutated<F>(self, f: F) -> Self
source§fn observe<F>(self, f: F) -> Self
fn observe<F>(self, f: F) -> Self
source§fn as_ref_<T>(&self) -> &T
fn as_ref_<T>(&self) -> &T
AsRef
,
using the turbofish .as_ref_::<_>()
syntax. Read more