pub struct FieldsWalker<'r, R: BorrowedReader + 'r> { /* private fields */ }Expand description
Walker for a revisioned enum. Generated by #[revisioned(...)].
Implementations§
Source§impl<'r, R: BorrowedReader + 'r> FieldsWalker<'r, R>
impl<'r, R: BorrowedReader + 'r> FieldsWalker<'r, R>
Sourcepub fn discriminant(&self) -> u32
pub fn discriminant(&self) -> u32
Variant discriminant on the wire (for Wire) or on the
re-encoded current-rev bytes (for the borrowed / owned arms).
Use
walk_revisioned_variant_name
to map this to a variant identifier.
Sourcepub fn is_value(&self) -> bool
pub fn is_value(&self) -> bool
Returns true if the wire’s discriminant identifies this variant
at the wire revision (or, for borrowed / owned walkers, on the
current-rev bytes).
Sourcepub fn into_value(
self,
) -> Result<<Box<Selector> as WalkRevisioned>::Walker<'r, R>, Error>
pub fn into_value( self, ) -> Result<<Box<Selector> as WalkRevisioned>::Walker<'r, R>, Error>
Walk into the payload of the #variant_ident variant.
Errors with revision::Error::Deserialize if the
wire encoding does not identify this variant. Errors
with revision::Error::Conversion in materialised
mode (older-rev convert_fn types); callers should
use decode_<variant> in that case.
Sourcepub fn decode_value(self) -> Result<Box<Selector>, Error>
pub fn decode_value(self) -> Result<Box<Selector>, Error>
Decode and return the inner value of the #variant_ident
variant directly. Unlike into_<variant>, this works on
every repr (Wire, OptimisedBorrowed, ConvertedOwned)
because it deserialises by value rather than handing back
a sub-walker.
Sourcepub fn value_view(self) -> Result<VariantView<'r, Box<Selector>>, Error>
pub fn value_view(self) -> Result<VariantView<'r, Box<Selector>>, Error>
Return the variant payload as a VariantView.
Works on every repr. OptimisedBorrowed (the common
optimised-enum case) hands back a borrowed slice with
the source’s 'r lifetime — no allocation. Wire
walkers re-encode (one allocation); ConvertedOwned
(cross-revision convert_fn) walkers move the owned
bytes.
Use decode_<variant> when you
want the inner type by value directly.
Sourcepub fn is_select(&self) -> bool
pub fn is_select(&self) -> bool
Returns true if the wire’s discriminant identifies this variant
at the wire revision (or, for borrowed / owned walkers, on the
current-rev bytes).
Sourcepub fn into_select(
self,
) -> Result<<Vec<Field> as WalkRevisioned>::Walker<'r, R>, Error>
pub fn into_select( self, ) -> Result<<Vec<Field> as WalkRevisioned>::Walker<'r, R>, Error>
Walk into the payload of the #variant_ident variant.
Errors with revision::Error::Deserialize if the
wire encoding does not identify this variant. Errors
with revision::Error::Conversion in materialised
mode (older-rev convert_fn types); callers should
use decode_<variant> in that case.
Sourcepub fn decode_select(self) -> Result<Vec<Field>, Error>
pub fn decode_select(self) -> Result<Vec<Field>, Error>
Decode and return the inner value of the #variant_ident
variant directly. Unlike into_<variant>, this works on
every repr (Wire, OptimisedBorrowed, ConvertedOwned)
because it deserialises by value rather than handing back
a sub-walker.
Sourcepub fn select_view(self) -> Result<VariantView<'r, Vec<Field>>, Error>
pub fn select_view(self) -> Result<VariantView<'r, Vec<Field>>, Error>
Return the variant payload as a VariantView.
Works on every repr. OptimisedBorrowed (the common
optimised-enum case) hands back a borrowed slice with
the source’s 'r lifetime — no allocation. Wire
walkers re-encode (one allocation); ConvertedOwned
(cross-revision convert_fn) walkers move the owned
bytes.
Use decode_<variant> when you
want the inner type by value directly.