pub struct UnsyncPinTokenLock<T: ?Sized, Keyhole> { /* private fields */ }Expand description
Like PinTokenLock, but the usable Tokens are constrained by
Unsync. This subtle difference allows it to be Sync even if T is
not.
Unlike the unpinned variant UnsyncTokenLock, UnsyncPinTokenLock does
not expose &mut T unless the receiver type is &mut Self. This way, the
pinning invariants are maintained.
See the module-level documentation for more details.
Implementations§
Source§impl<T, Keyhole> UnsyncPinTokenLock<T, Keyhole>
§Construction and Destruction
impl<T, Keyhole> UnsyncPinTokenLock<T, Keyhole>
§Construction and Destruction
Source§impl<T: ?Sized, Keyhole> UnsyncPinTokenLock<T, Keyhole>
§Miscellaneous
impl<T: ?Sized, Keyhole> UnsyncPinTokenLock<T, Keyhole>
§Miscellaneous
Source§impl<T: ?Sized, Keyhole> UnsyncPinTokenLock<T, Keyhole>
§Borrowing
impl<T: ?Sized, Keyhole> UnsyncPinTokenLock<T, Keyhole>
§Borrowing
Sourcepub fn read<'a, K: Token<Keyhole> + Unsync>(&'a self, token: &'a K) -> &'a T
pub fn read<'a, K: Token<Keyhole> + Unsync>(&'a self, token: &'a K) -> &'a T
Get a reference to the contained data. Panic if token doesn’t fit in
the keyhole.
Sourcepub fn read_pin<'a, K: Token<Keyhole> + Unsync>(
self: Pin<&'a Self>,
token: &'a K,
) -> Pin<&'a T>
pub fn read_pin<'a, K: Token<Keyhole> + Unsync>( self: Pin<&'a Self>, token: &'a K, ) -> Pin<&'a T>
Get a pinned reference to the contained data. Panic if token doesn’t fit in
the keyhole.
Sourcepub fn write_pin<'a, K: Token<Keyhole>>(
self: Pin<&'a Self>,
token: &'a mut K,
) -> Pin<&'a mut T>
pub fn write_pin<'a, K: Token<Keyhole>>( self: Pin<&'a Self>, token: &'a mut K, ) -> Pin<&'a mut T>
Get a mutable pinned reference to the contained data. Panic if token doesn’t
fit in the keyhole.
Sourcepub fn try_read<'a, K: Token<Keyhole> + Unsync>(
&'a self,
token: &'a K,
) -> Result<&'a T, BadTokenError>
pub fn try_read<'a, K: Token<Keyhole> + Unsync>( &'a self, token: &'a K, ) -> Result<&'a T, BadTokenError>
Get a reference to the contained data. Return BadTokenError if token
doesn’t fit in the keyhole.
Sourcepub fn try_read_pin<'a, K: Token<Keyhole> + Unsync>(
self: Pin<&'a Self>,
token: &'a K,
) -> Result<Pin<&'a T>, BadTokenError>
pub fn try_read_pin<'a, K: Token<Keyhole> + Unsync>( self: Pin<&'a Self>, token: &'a K, ) -> Result<Pin<&'a T>, BadTokenError>
Get a pinned reference to the contained data. Return BadTokenError if token
doesn’t fit in the keyhole.
Sourcepub fn try_write_pin<'a, K: Token<Keyhole>>(
self: Pin<&'a Self>,
token: &'a mut K,
) -> Result<Pin<&'a mut T>, BadTokenError>
pub fn try_write_pin<'a, K: Token<Keyhole>>( self: Pin<&'a Self>, token: &'a mut K, ) -> Result<Pin<&'a mut T>, BadTokenError>
Get a mutable pinned reference to the contained data. Return BadTokenError if
token doesn’t fit in the keyhole.
Sourcepub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut T>
pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut T>
Get a mutable pinned reference to the contained data.
Source§impl<T, Keyhole> UnsyncPinTokenLock<T, Keyhole>
§Utilities
impl<T, Keyhole> UnsyncPinTokenLock<T, Keyhole>
§Utilities
Sourcepub fn get<K: Token<Keyhole> + Unsync>(&self, token: &K) -> Twhere
T: Clone,
pub fn get<K: Token<Keyhole> + Unsync>(&self, token: &K) -> Twhere
T: Clone,
Get the contained data by cloning. Panic if token doesn’t fit in
the keyhole.
Sourcepub fn try_get<K: Token<Keyhole> + Unsync>(
&self,
token: &K,
) -> Result<T, BadTokenError>where
T: Clone,
pub fn try_get<K: Token<Keyhole> + Unsync>(
&self,
token: &K,
) -> Result<T, BadTokenError>where
T: Clone,
Get the contained data by cloning. Return BadTokenError if token
doesn’t fit in the keyhole.