Trait spacetimedb_sats::de::SumAccess
source · pub trait SumAccess<'de> {
type Error: Error;
type Variant: VariantAccess<'de, Error = Self::Error>;
// Required method
fn variant<V: VariantVisitor>(
self,
visitor: V
) -> Result<(V::Output, Self::Variant), Self::Error>;
}
Expand description
Provides a SumVisitor
access to the data of a sum in the input.
An A: SumAccess
object is created by the [D: Deserializer
]
which passes A
to a [V: SumVisitor
] that D
in turn was passed.
A
is then used by V
to split tag and value input apart.
Required Associated Types§
sourcetype Error: Error
type Error: Error
The error type that can be returned if some error occurs during deserialization.
sourcetype Variant: VariantAccess<'de, Error = Self::Error>
type Variant: VariantAccess<'de, Error = Self::Error>
The visitor used to deserialize the content of the sum variant.
Required Methods§
sourcefn variant<V: VariantVisitor>(
self,
visitor: V
) -> Result<(V::Output, Self::Variant), Self::Error>
fn variant<V: VariantVisitor>( self, visitor: V ) -> Result<(V::Output, Self::Variant), Self::Error>
Called to identify which variant to deserialize.
Returns a tuple with the result of identification (V::Output
)
and the input to variant data deserialization.
The visitor
is provided by the Deserializer
.
This method is typically called from SumVisitor::visit_sum
which will provide the V: VariantVisitor
.
Object Safety§
This trait is not object safe.