Enum serde_reflection::VariantFormat
source · [−]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
sourceimpl VariantFormat
impl VariantFormat
Trait Implementations
sourceimpl Clone for VariantFormat
impl Clone for VariantFormat
sourcefn clone(&self) -> VariantFormat
fn clone(&self) -> VariantFormat
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for VariantFormat
impl Debug for VariantFormat
sourceimpl Default for VariantFormat
impl Default for VariantFormat
sourceimpl<'de> Deserialize<'de> for VariantFormat
impl<'de> Deserialize<'de> for VariantFormat
sourcefn 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
sourceimpl FormatHolder for VariantFormat
impl FormatHolder for VariantFormat
sourcefn 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. Read more
sourcefn 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 more
sourcefn 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
sourcefn is_unknown(&self) -> bool
fn is_unknown(&self) -> bool
Whether this format is a variable with no known value yet.
sourceimpl PartialEq<VariantFormat> for VariantFormat
impl PartialEq<VariantFormat> for VariantFormat
sourcefn eq(&self, other: &VariantFormat) -> bool
fn eq(&self, other: &VariantFormat) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &VariantFormat) -> bool
fn ne(&self, other: &VariantFormat) -> bool
This method tests for !=
.
sourceimpl Serialize for VariantFormat
impl Serialize for VariantFormat
impl Eq for VariantFormat
impl StructuralEq for VariantFormat
impl StructuralPartialEq for VariantFormat
Auto Trait Implementations
impl !RefUnwindSafe for VariantFormat
impl !Send for VariantFormat
impl !Sync for VariantFormat
impl Unpin for VariantFormat
impl !UnwindSafe for VariantFormat
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more