pub enum ContainerFormat {
UnitStruct,
NewTypeStruct(Box<Format>),
TupleStruct(Vec<Format>),
Struct(Vec<Named<Format>>),
Enum(BTreeMap<u32, Named<VariantFormat>>),
}
Expand description
Serde-based serialization format for named “container” types. In Rust, those are enums and structs.
Variants§
UnitStruct
An empty struct, e.g. struct A
.
NewTypeStruct(Box<Format>)
A struct with a single unnamed parameter, e.g. struct A(u16)
TupleStruct(Vec<Format>)
A struct with several unnamed parameters, e.g. struct A(u16, u32)
Struct(Vec<Named<Format>>)
A struct with named parameters, e.g. struct A { a: Foo }
.
Enum(BTreeMap<u32, Named<VariantFormat>>)
An enum, that is, an enumeration of variants. Each variant has a unique name and index within the enum.
Trait Implementations§
Source§impl Clone for ContainerFormat
impl Clone for ContainerFormat
Source§fn clone(&self) -> ContainerFormat
fn clone(&self) -> ContainerFormat
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 ContainerFormat
impl Debug for ContainerFormat
Source§impl<'de> Deserialize<'de> for ContainerFormat
impl<'de> Deserialize<'de> for ContainerFormat
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 ContainerFormat
impl FormatHolder for ContainerFormat
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: ContainerFormat) -> Result<()>
fn unify(&mut self, format: ContainerFormat) -> 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 ContainerFormat
impl PartialEq for ContainerFormat
Source§impl Serialize for ContainerFormat
impl Serialize for ContainerFormat
impl Eq for ContainerFormat
impl StructuralPartialEq for ContainerFormat
Auto Trait Implementations§
impl Freeze for ContainerFormat
impl !RefUnwindSafe for ContainerFormat
impl !Send for ContainerFormat
impl !Sync for ContainerFormat
impl Unpin for ContainerFormat
impl !UnwindSafe for ContainerFormat
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