pub enum VariantFormat {
Variable(Variable<VariantFormat>),
Unit,
NewType(Box<Format>),
Tuple(Vec<Format>),
Struct(Vec<Named<Format>>),
}
Expand description
Description of a variant in an enum.
Variants§
Variable(Variable<VariantFormat>)
A variant whose format is initially unknown. Used internally for tracing. Not (de)serializable.
Unit
A variant without parameters, e.g. A
in enum X { A }
NewType(Box<Format>)
A variant with a single unnamed parameter, e.g. A
in enum X { A(u16) }
Tuple(Vec<Format>)
A struct with several unnamed parameters, e.g. A
in enum X { A(u16, u32) }
Struct(Vec<Named<Format>>)
A struct with named parameters, e.g. A
in enum X { A { a: Foo } }
Implementations§
Source§impl VariantFormat
impl VariantFormat
Trait Implementations§
Source§impl Clone for VariantFormat
impl Clone for VariantFormat
Source§fn clone(&self) -> VariantFormat
fn clone(&self) -> VariantFormat
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for VariantFormat
impl Debug for VariantFormat
Source§impl Default for VariantFormat
impl Default for VariantFormat
Source§impl<'de> Deserialize<'de> for VariantFormat
impl<'de> Deserialize<'de> for VariantFormat
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
Source§impl FormatHolder for VariantFormat
impl FormatHolder for VariantFormat
Source§fn visit<'a>(
&'a self,
f: &mut dyn FnMut(&'a Format) -> Result<()>,
) -> Result<()>
fn visit<'a>( &'a self, f: &mut dyn FnMut(&'a Format) -> Result<()>, ) -> Result<()>
Visit all the formats in
self
in a depth-first way.
Variables are not supported and will cause an error.Source§fn visit_mut(
&mut self,
f: &mut dyn FnMut(&mut Format) -> Result<()>,
) -> Result<()>
fn visit_mut( &mut self, f: &mut dyn FnMut(&mut Format) -> Result<()>, ) -> Result<()>
Mutably visit all the formats in
self
in a depth-first way. Read moreSource§fn unify(&mut self, format: VariantFormat) -> Result<()>
fn unify(&mut self, format: VariantFormat) -> Result<()>
Update variables and add missing enum variants so that the terms match.
This is a special case of term unification: Read more
Source§fn is_unknown(&self) -> bool
fn is_unknown(&self) -> bool
Whether this format is a variable with no known value yet.
Source§impl PartialEq for VariantFormat
impl PartialEq for VariantFormat
Source§impl Serialize for VariantFormat
impl Serialize for VariantFormat
impl Eq for VariantFormat
impl StructuralPartialEq for VariantFormat
Auto Trait Implementations§
impl Freeze for VariantFormat
impl !RefUnwindSafe for VariantFormat
impl !Send for VariantFormat
impl !Sync for VariantFormat
impl Unpin for VariantFormat
impl !UnwindSafe for VariantFormat
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