Trait linotype::PinningOwnedProjection
source · [−]pub trait PinningOwnedProjection: Sealed {
type K;
type V;
fn unpin(self) -> OwnedProjection<Self::K, Self::V>
where
Self::V: Unpin;
fn get<Q>(&self, key: &Q) -> Option<Pin<&Self::V>>
where
Self::K: Borrow<Q>,
Q: ?Sized + Eq;
fn get_mut<Q>(&mut self, key: &Q) -> Option<Pin<&mut Self::V>>
where
Self::K: Borrow<Q>,
Q: ?Sized + Eq;
fn reproject_try_by_keyed_try_with_keyed<'a: 'b, 'b, T, Q, S, F, I, E>(
&'a mut self,
items_selectors_factories: I
) -> Box<dyn Iterator<Item = Result<(T, Pin<&'a mut Self::V>), E>> + 'b>
where
Self::K: Borrow<Q>,
T: 'b,
Q: 'b + ?Sized + Eq + ToOwned<Owned = Self::K>,
S: 'b + FnOnce(&mut T) -> Result<&Q, E>,
F: 'b + FnOnce(&mut T, &Self::K) -> Result<Self::V, E>,
I: 'b + IntoIterator<Item = (T, S, F)>,
E: 'b;
fn reproject_try_by_try_with<'a: 'b, 'b, T, Q, S, F, I, E>(
&'a mut self,
items: I,
selector: S,
factory: F
) -> Box<dyn Iterator<Item = Result<(T, Pin<&'a mut Self::V>), E>> + 'b>
where
Self::K: Borrow<Q>,
T: 'b,
Q: 'b + ?Sized + Eq + ToOwned<Owned = Self::K>,
S: 'b + FnMut(&mut T) -> Result<&Q, E>,
F: 'b + FnMut(&mut T, &Self::K) -> Result<Self::V, E>,
I: 'b + IntoIterator<Item = T>,
E: 'b;
fn reproject_by_keyed_with_keyed<'a: 'b, 'b, T, Q, S, F, I>(
&'a mut self,
items_selectors_factories: I
) -> Box<dyn Iterator<Item = (T, Pin<&'a mut Self::V>)> + 'b>
where
Self::K: Borrow<Q>,
T: 'b,
Q: 'b + ?Sized + Eq + ToOwned<Owned = Self::K>,
S: 'b + FnOnce(&mut T) -> &Q,
F: 'b + FnOnce(&mut T, &Self::K) -> Self::V,
I: 'b + IntoIterator<Item = (T, S, F)>;
fn reproject_by_with<'a: 'b, 'b, T, Q, S, F, I>(
&'a mut self,
items: I,
selector: S,
factory: F
) -> Box<dyn Iterator<Item = (T, Pin<&'a mut Self::V>)> + 'b>
where
Self::K: Borrow<Q>,
T: 'b,
Q: 'b + ?Sized + Eq + ToOwned<Owned = Self::K>,
S: 'b + FnMut(&mut T) -> &Q,
F: 'b + FnMut(&mut T, &Self::K) -> Self::V,
I: 'b + IntoIterator<Item = T>;
}
Expand description
The value-pinning OwnedProjection
API.
This can’t be associated directly because self: Pin<Self>
is currently not a valid method receiver.
A note about performance
Due to Rust language limitations (as of v1.58.1), it is currently not possible to give most of the methods in this trait their proper return types. This means quite a lot of them (at least formally) heap-allocate and use dynamic dispatch.
As a workaround, it is presently legal to reinterpret a Pin<OwnedProjection<K, V>>
as OwnedProjection<K, V>
,
and to call methods that exist in both APIs in their OwnedProjection<K, V>
that way as long as you treat their returned value references as pinning.
Associated Types
Required methods
Converts this instance back into a non-pinning OwnedProjection<K, V>
.
After calling this, drop implementation panics won’t cause a double anymore, even without the "std"
feature.
Retrieves a reference to the first value associated with key
, iff available.
Retrieves a mutable reference to the first value associated with key
, iff available.
fn reproject_try_by_keyed_try_with_keyed<'a: 'b, 'b, T, Q, S, F, I, E>(
&'a mut self,
items_selectors_factories: I
) -> Box<dyn Iterator<Item = Result<(T, Pin<&'a mut Self::V>), E>> + 'b> where
Self::K: Borrow<Q>,
T: 'b,
Q: 'b + ?Sized + Eq + ToOwned<Owned = Self::K>,
S: 'b + FnOnce(&mut T) -> Result<&Q, E>,
F: 'b + FnOnce(&mut T, &Self::K) -> Result<Self::V, E>,
I: 'b + IntoIterator<Item = (T, S, F)>,
E: 'b,
fn reproject_try_by_keyed_try_with_keyed<'a: 'b, 'b, T, Q, S, F, I, E>(
&'a mut self,
items_selectors_factories: I
) -> Box<dyn Iterator<Item = Result<(T, Pin<&'a mut Self::V>), E>> + 'b> where
Self::K: Borrow<Q>,
T: 'b,
Q: 'b + ?Sized + Eq + ToOwned<Owned = Self::K>,
S: 'b + FnOnce(&mut T) -> Result<&Q, E>,
F: 'b + FnOnce(&mut T, &Self::K) -> Result<Self::V, E>,
I: 'b + IntoIterator<Item = (T, S, F)>,
E: 'b,
Lazily updates this map according to a sequence of item, fallible selector and fallible factory triples.
Values that aren’t reused are dropped together with the returned iterator or on the next .reproject…
method call.
fn reproject_try_by_try_with<'a: 'b, 'b, T, Q, S, F, I, E>(
&'a mut self,
items: I,
selector: S,
factory: F
) -> Box<dyn Iterator<Item = Result<(T, Pin<&'a mut Self::V>), E>> + 'b> where
Self::K: Borrow<Q>,
T: 'b,
Q: 'b + ?Sized + Eq + ToOwned<Owned = Self::K>,
S: 'b + FnMut(&mut T) -> Result<&Q, E>,
F: 'b + FnMut(&mut T, &Self::K) -> Result<Self::V, E>,
I: 'b + IntoIterator<Item = T>,
E: 'b,
fn reproject_try_by_try_with<'a: 'b, 'b, T, Q, S, F, I, E>(
&'a mut self,
items: I,
selector: S,
factory: F
) -> Box<dyn Iterator<Item = Result<(T, Pin<&'a mut Self::V>), E>> + 'b> where
Self::K: Borrow<Q>,
T: 'b,
Q: 'b + ?Sized + Eq + ToOwned<Owned = Self::K>,
S: 'b + FnMut(&mut T) -> Result<&Q, E>,
F: 'b + FnMut(&mut T, &Self::K) -> Result<Self::V, E>,
I: 'b + IntoIterator<Item = T>,
E: 'b,
Lazily updates this map according to a sequence of items, a fallible selector and fallible factory.
Values that aren’t reused are dropped together with the returned iterator or on the next .reproject…
method call.
fn reproject_by_keyed_with_keyed<'a: 'b, 'b, T, Q, S, F, I>(
&'a mut self,
items_selectors_factories: I
) -> Box<dyn Iterator<Item = (T, Pin<&'a mut Self::V>)> + 'b> where
Self::K: Borrow<Q>,
T: 'b,
Q: 'b + ?Sized + Eq + ToOwned<Owned = Self::K>,
S: 'b + FnOnce(&mut T) -> &Q,
F: 'b + FnOnce(&mut T, &Self::K) -> Self::V,
I: 'b + IntoIterator<Item = (T, S, F)>,
fn reproject_by_keyed_with_keyed<'a: 'b, 'b, T, Q, S, F, I>(
&'a mut self,
items_selectors_factories: I
) -> Box<dyn Iterator<Item = (T, Pin<&'a mut Self::V>)> + 'b> where
Self::K: Borrow<Q>,
T: 'b,
Q: 'b + ?Sized + Eq + ToOwned<Owned = Self::K>,
S: 'b + FnOnce(&mut T) -> &Q,
F: 'b + FnOnce(&mut T, &Self::K) -> Self::V,
I: 'b + IntoIterator<Item = (T, S, F)>,
Lazily updates this map according to a sequence of item, selector and factory triples.
Values that aren’t reused are dropped together with the returned iterator or on the next .reproject…
method call.
fn reproject_by_with<'a: 'b, 'b, T, Q, S, F, I>(
&'a mut self,
items: I,
selector: S,
factory: F
) -> Box<dyn Iterator<Item = (T, Pin<&'a mut Self::V>)> + 'b> where
Self::K: Borrow<Q>,
T: 'b,
Q: 'b + ?Sized + Eq + ToOwned<Owned = Self::K>,
S: 'b + FnMut(&mut T) -> &Q,
F: 'b + FnMut(&mut T, &Self::K) -> Self::V,
I: 'b + IntoIterator<Item = T>,
fn reproject_by_with<'a: 'b, 'b, T, Q, S, F, I>(
&'a mut self,
items: I,
selector: S,
factory: F
) -> Box<dyn Iterator<Item = (T, Pin<&'a mut Self::V>)> + 'b> where
Self::K: Borrow<Q>,
T: 'b,
Q: 'b + ?Sized + Eq + ToOwned<Owned = Self::K>,
S: 'b + FnMut(&mut T) -> &Q,
F: 'b + FnMut(&mut T, &Self::K) -> Self::V,
I: 'b + IntoIterator<Item = T>,
Lazily updates this map according to a sequence of items, a selector and a factory.
Values that aren’t reused are dropped together with the returned iterator or on the next .reproject…
method call.