Trait spacetimedb_sats::de::SumVisitor
source · pub trait SumVisitor<'de> {
type Output;
// Required methods
fn sum_name(&self) -> Option<&str>;
fn visit_sum<A: SumAccess<'de>>(
self,
data: A
) -> Result<Self::Output, A::Error>;
// Provided method
fn is_option(&self) -> bool { ... }
}
Expand description
A visitor walking through a Deserializer
for sums.
This side is provided by a Deserialize
implementation
when calling Deserializer::deserialize_sum
.
Required Associated Types§
Required Methods§
sourcefn visit_sum<A: SumAccess<'de>>(self, data: A) -> Result<Self::Output, A::Error>
fn visit_sum<A: SumAccess<'de>>(self, data: A) -> Result<Self::Output, A::Error>
Drives the deserialization of a sum value.
This method will ask the data format (A: SumAccess
)
which variant of the sum to select in terms of a variant name / tag.
A
will use a VariantVisitor
, that SumVisitor
has provided,
to translate into something that is meaningful for visit_sum
, e.g., an index.
The data format will also return an object (VariantAccess
)
that can deserialize the contents of the variant.
Provided Methods§
Object Safety§
This trait is not object safe.