pub struct WithTable<T> {
table: Table,
value: T,
}
Expand description
Wrapper for a type T
that creates a bundle containing both a ID
table and a value T
. That value may contains Node
values
inside it. Serializing WithTable<T>
will serialize IDs only,
skipping values. Deserialization of a WithTable<T>
will
automatically use the table and IDs to reconstruct skipped values.
Fields§
§table: Table
§value: T
Implementations§
Trait Implementations§
source§impl<'de, T: Deserialize<'de>> Deserialize<'de> for WithTable<T>
impl<'de, T: Deserialize<'de>> Deserialize<'de> for WithTable<T>
The deserializer of WithTable<T>
is special. We first decode the
table in order: each (Id, Value)
pair of the table populates the
global table state found in DESERIALIZATION_STATE
. Only then we
can decode the value itself, knowing DESERIALIZATION_STATE
is
complete.
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<T> Freeze for WithTable<T>where
T: Freeze,
impl<T> RefUnwindSafe for WithTable<T>where
T: RefUnwindSafe,
impl<T> Send for WithTable<T>where
T: Send,
impl<T> Sync for WithTable<T>where
T: Sync,
impl<T> Unpin for WithTable<T>where
T: Unpin,
impl<T> UnwindSafe for WithTable<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> 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