pub struct WithEncoded<T>(_, pub T);
Available on crate feature
network
only.Expand description
Generic wrapper with encoded Bytes, such as transaction data.
Tuple Fields§
§1: T
Implementations§
Source§impl<T> WithEncoded<T>
impl<T> WithEncoded<T>
Sourcepub const fn new(bytes: Bytes, value: T) -> WithEncoded<T>
pub const fn new(bytes: Bytes, value: T) -> WithEncoded<T>
Wraps the value with the bytes.
Sourcepub const fn encoded_bytes(&self) -> &Bytes
pub const fn encoded_bytes(&self) -> &Bytes
Get the encoded bytes
Sourcepub fn into_encoded_bytes(self) -> Bytes
pub fn into_encoded_bytes(self) -> Bytes
Returns ownership of the encoded bytes.
Sourcepub fn into_value(self) -> T
pub fn into_value(self) -> T
Returns ownership of the underlying value.
Sourcepub fn transform<F>(self) -> WithEncoded<F>where
F: From<T>,
pub fn transform<F>(self) -> WithEncoded<F>where
F: From<T>,
Transform the value
Sourcepub fn map<U, F>(self, op: F) -> WithEncoded<U>where
F: FnOnce(T) -> U,
pub fn map<U, F>(self, op: F) -> WithEncoded<U>where
F: FnOnce(T) -> U,
Maps the inner value to a new value using the given function.
Source§impl<T> WithEncoded<T>where
T: Encodable2718,
impl<T> WithEncoded<T>where
T: Encodable2718,
Sourcepub fn from_2718_encodable(value: T) -> WithEncoded<T>
pub fn from_2718_encodable(value: T) -> WithEncoded<T>
Wraps the value with the Encodable2718::encoded_2718
bytes.
Source§impl<T> WithEncoded<Option<T>>
impl<T> WithEncoded<Option<T>>
Sourcepub fn transpose(self) -> Option<WithEncoded<T>>
pub fn transpose(self) -> Option<WithEncoded<T>>
returns None
if the inner value is None
, otherwise returns Some(WithEncoded<T>)
.
Trait Implementations§
Source§impl<T> Clone for WithEncoded<T>where
T: Clone,
impl<T> Clone for WithEncoded<T>where
T: Clone,
Source§fn clone(&self) -> WithEncoded<T>
fn clone(&self) -> WithEncoded<T>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T> Debug for WithEncoded<T>where
T: Debug,
impl<T> Debug for WithEncoded<T>where
T: Debug,
Source§impl<T> From<(Bytes, T)> for WithEncoded<T>
impl<T> From<(Bytes, T)> for WithEncoded<T>
Source§fn from(value: (Bytes, T)) -> WithEncoded<T>
fn from(value: (Bytes, T)) -> WithEncoded<T>
Converts to this type from the input type.
Source§impl<T> PartialEq for WithEncoded<T>where
T: PartialEq,
impl<T> PartialEq for WithEncoded<T>where
T: PartialEq,
impl<T> Eq for WithEncoded<T>where
T: Eq,
impl<T> StructuralPartialEq for WithEncoded<T>
Auto Trait Implementations§
impl<T> !Freeze for WithEncoded<T>
impl<T> RefUnwindSafe for WithEncoded<T>where
T: RefUnwindSafe,
impl<T> Send for WithEncoded<T>where
T: Send,
impl<T> Sync for WithEncoded<T>where
T: Sync,
impl<T> Unpin for WithEncoded<T>where
T: Unpin,
impl<T> UnwindSafe for WithEncoded<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more