pub enum Schema {
Show 14 variants
Null,
Boolean,
Int,
Long,
Float,
Double,
Bytes,
String,
Array(Box<Schema>),
Map(Box<Schema>),
Union(UnionSchema),
Record {
name: Name,
doc: Documentation,
fields: Vec<RecordField>,
lookup: HashMap<String, usize>,
},
Enum {
name: Name,
doc: Documentation,
symbols: Vec<String>,
},
Fixed {
name: Name,
size: usize,
},
}
Expand description
Represents any valid Avro schema More information about Avro schemas can be found in the Avro Specification
Variants§
Null
A null
Avro schema.
Boolean
A boolean
Avro schema.
Int
An int
Avro schema.
Long
A long
Avro schema.
Float
A float
Avro schema.
Double
A double
Avro schema.
Bytes
A bytes
Avro schema.
Bytes
represents a sequence of 8-bit unsigned bytes.
String
A string
Avro schema.
String
represents a unicode character sequence.
Array(Box<Schema>)
A array
Avro schema. Avro arrays are required to have the same type for each element.
This variant holds the Schema
for the array element type.
Map(Box<Schema>)
A map
Avro schema.
Map
holds a pointer to the Schema
of its values, which must all be the same schema.
Map
keys are assumed to be string
.
Union(UnionSchema)
A union
Avro schema.
Record
A record
Avro schema.
The lookup
table maps field names to their position in the Vec
of fields
.
Enum
An enum
Avro schema.
Fixed
A fixed
Avro schema.
Implementations§
source§impl Schema
impl Schema
sourcepub fn parse_str(input: &str) -> Result<Self, Error>
pub fn parse_str(input: &str) -> Result<Self, Error>
Create a Schema
from a string representing a JSON Avro schema.
sourcepub fn parse(value: &Value) -> Result<Self, Error>
pub fn parse(value: &Value) -> Result<Self, Error>
Create a Schema
from a serde_json::Value
representing a JSON Avro
schema.
sourcepub fn canonical_form(&self) -> String
pub fn canonical_form(&self) -> String
Converts self
into its Parsing Canonical Form.