pub struct Decrypted<B> { /* private fields */ }Expand description
A decryption result awaiting Tunnel::commit_decapsulate.
Implementations§
Source§impl<B> Decrypted<B>
impl<B> Decrypted<B>
Sourcepub fn plaintext(&self) -> Option<&B>
pub fn plaintext(&self) -> Option<&B>
The plaintext of a data message that decrypted.
Decryption proves the message came from the peer with this session’s key, but only
Tunnel::commit_decapsulate checks it against the
replay window and against the session still being current. Until then it may be a replay,
so use it only for work without side effects, such as parsing or prefetching, and act on it
only once it has been committed.
Sourcepub fn map<C>(self, f: impl FnOnce(B, usize) -> C) -> Decrypted<C>
pub fn map<C>(self, f: impl FnOnce(B, usize) -> C) -> Decrypted<C>
Maps the plaintext of a data message before it is committed.
Work that needs only the plaintext, such as parsing it, can thus happen on the thread that
decrypted the message. The same caveat as for Decrypted::plaintext applies: the message
has not been committed yet, so f must have no side effects.
Trait Implementations§
Auto Trait Implementations§
impl<B> Freeze for Decrypted<B>
impl<B> RefUnwindSafe for Decrypted<B>
impl<B> Send for Decrypted<B>
impl<B> Sync for Decrypted<B>
impl<B> Unpin for Decrypted<B>
impl<B> UnsafeUnpin for Decrypted<B>
impl<B> UnwindSafe for Decrypted<B>
Blanket Implementations§
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
Mutably borrows from an owned value. Read more