#[non_exhaustive]pub enum Format {
Show 26 variants
Variable(Variable<Self>),
TypeName(QualifiedTypeName),
Unit,
Bool,
I8,
I16,
I32,
I64,
I128,
U8,
U16,
U32,
U64,
U128,
F32,
F64,
Char,
Str,
Bytes,
Uuid,
Option(Box<Self>),
Seq(Box<Self>),
Set(Box<Self>),
Map {
key: Box<Self>,
value: Box<Self>,
},
Tuple(Vec<Self>),
TupleArray {
content: Box<Self>,
size: usize,
},
}Expand description
The shape of a value type — an AST node describing how a field, variant payload, or nested value is serialized.
Primitives are leaf nodes; composites (Option, Seq, Map, Tuple)
contain nested Format nodes; and TypeName is a reference to a ContainerFormat in
the Registry.
Format and ContainerFormat are separate types, not variants of the same enum.
A ContainerFormat is a type declaration (a struct or enum definition) that holds Format
nodes as its children (field types, variant payloads). A Format is a type usage — and
Format::TypeName closes the loop by referencing back to a ContainerFormat in the registry.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Variable(Variable<Self>)
A placeholder for a format not yet known at construction time. Format::unknown() creates
one of these, and it is also the Default value for Format. Fields start as variables
and are filled in as the RegistryBuilder processes each type,
resolving to a concrete format (e.g. U32, Str, TypeName(...)). Not involved in code
generation — all variables must be resolved before
RegistryBuilder::build completes.
TypeName(QualifiedTypeName)
A reference to a named container type in the Registry.
Unit
Bool
I8
I16
I32
I64
I128
U8
U16
U32
U64
U128
F32
F64
Char
Str
Bytes
Uuid
A UUID. On the wire this is identical to Bytes (16 raw bytes,
length-prefixed) for non-human-readable encoders (e.g. bincode), and a
lowercase hyphenated string for human-readable encoders (e.g. JSON).
Foreign-language emitters map this to the native UUID type for the
target language (e.g. Foundation.UUID in Swift, java.util.UUID in
Kotlin, System.Guid in C#, branded string in TypeScript).
Option(Box<Self>)
The format of Option<T>.
Seq(Box<Self>)
A sequence, e.g. the format of Vec<Foo>.
Set(Box<Self>)
A set, e.g. the format of HashSet<Foo>.
Map
A map, e.g. the format of BTreeMap<K, V>.
Tuple(Vec<Self>)
A tuple, e.g. the format of (Foo, Bar).
TupleArray
Alias for (Foo, ... Foo).
E.g. the format of [Foo; N].
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Format
impl<'de> Deserialize<'de> for Format
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>,
Source§impl Emitter<Kotlin> for Format
impl Emitter<Kotlin> for Format
Source§fn write<W: IndentWrite>(&self, w: &mut W, lang: &Kotlin) -> Result<()>
fn write<W: IndentWrite>(&self, w: &mut W, lang: &Kotlin) -> Result<()>
IndentWrite. Read moreSource§impl Emitter<Swift> for Format
impl Emitter<Swift> for Format
Source§fn write<W: IndentWrite>(&self, w: &mut W, lang: &Swift) -> Result<()>
fn write<W: IndentWrite>(&self, w: &mut W, lang: &Swift) -> Result<()>
IndentWrite. Read moreSource§impl Emitter<TypeScript> for Format
impl Emitter<TypeScript> for Format
Source§fn write<W: IndentWrite>(&self, w: &mut W, lang: &TypeScript) -> Result<()>
fn write<W: IndentWrite>(&self, w: &mut W, lang: &TypeScript) -> Result<()>
IndentWrite. Read moreimpl Eq for Format
Source§impl FormatHolder for Format
impl FormatHolder for Format
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<()>
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<()>
self in a depth-first way. Read more