pub enum Data<T: FromBytes + ToBytes + Send + 'static> {
Object(T),
Buffer(Bytes),
}
Expand description
This object enables deferred deserialization / ahead-of-time serialization for objects that take a while to deserialize / serialize, in order to allow these operations to be non-blocking.
Variants§
Implementations§
Source§impl<T: FromBytes + ToBytes + Send + 'static> Data<T>
impl<T: FromBytes + ToBytes + Send + 'static> Data<T>
pub fn to_checksum<N: Network>(&self) -> Result<N::TransmissionChecksum>
pub fn into<T2: From<Data<T>> + From<T> + FromBytes + ToBytes + Send + 'static>( self, ) -> Data<T2>
pub fn deserialize_blocking(self) -> Result<T>
pub fn serialize_blocking_into<W: Write>(&self, writer: &mut W) -> Result<()>
Trait Implementations§
Source§impl<'de, T: FromBytes + ToBytes + DeserializeOwned + Send + 'static> Deserialize<'de> for Data<T>
impl<'de, T: FromBytes + ToBytes + DeserializeOwned + Send + 'static> Deserialize<'de> for Data<T>
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserializes the data from a JSON-string or buffer.
impl<T: Eq + FromBytes + ToBytes + Send + 'static> Eq for Data<T>
impl<T: FromBytes + ToBytes + Send + 'static> StructuralPartialEq for Data<T>
Auto Trait Implementations§
impl<T> !Freeze for Data<T>
impl<T> RefUnwindSafe for Data<T>where
T: RefUnwindSafe,
impl<T> Send for Data<T>
impl<T> Sync for Data<T>where
T: Sync,
impl<T> Unpin for Data<T>where
T: Unpin,
impl<T> UnwindSafe for Data<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<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
impl<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
fn take_from_value<D>(
value: &mut Value,
field: &str,
) -> Result<T, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> 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