pub enum Schema {
Show 23 variants Null, Boolean, Int, Long, Float, Double, Bytes, String, Array(Box<Schema>), Map(Box<Schema>), Union(UnionSchema), Record { name: Name, aliases: Aliases, doc: Documentation, fields: Vec<RecordField>, lookup: BTreeMap<String, usize>, }, Enum { name: Name, aliases: Aliases, doc: Documentation, symbols: Vec<String>, }, Fixed { name: Name, aliases: Aliases, doc: Documentation, size: usize, }, Decimal { precision: usize, scale: usize, inner: Box<Schema>, }, Uuid, Date, TimeMillis, TimeMicros, TimestampMillis, TimestampMicros, Duration, Ref { name: Name, },
}
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

Fields

name: Name
aliases: Aliases
fields: Vec<RecordField>
lookup: BTreeMap<String, usize>

A record Avro schema.

The lookup table maps field names to their position in the Vec of fields.

Enum

Fields

name: Name
aliases: Aliases
symbols: Vec<String>

An enum Avro schema.

Fixed

Fields

name: Name
aliases: Aliases
size: usize

A fixed Avro schema.

Decimal

Fields

precision: usize
scale: usize
inner: Box<Schema>

Logical type which represents Decimal values. The underlying type is serialized and deserialized as Schema::Bytes or Schema::Fixed.

scale defaults to 0 and is an integer greater than or equal to 0 and precision is an integer greater than 0.

Uuid

A universally unique identifier, annotating a string.

Date

Logical type which represents the number of days since the unix epoch. Serialization format is Schema::Int.

TimeMillis

The time of day in number of milliseconds after midnight with no reference any calendar, time zone or date in particular.

TimeMicros

The time of day in number of microseconds after midnight with no reference any calendar, time zone or date in particular.

TimestampMillis

An instant in time represented as the number of milliseconds after the UNIX epoch.

TimestampMicros

An instant in time represented as the number of microseconds after the UNIX epoch.

Duration

An amount of time defined by a number of months, days and milliseconds.

Ref

Fields

name: Name

Implementations

Converts self into its Parsing Canonical Form.

Generate fingerprint of Schema’s Parsing Canonical Form.

Create a Schema from a string representing a JSON Avro schema.

Create a array of Schema’s from a list of named JSON Avro schemas (Record, Enum, and Fixed).

It is allowed that the schemas have cross-dependencies; these will be resolved during parsing.

If two of the input schemas have the same fullname, an Error will be returned.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Assess equality of two Schema based on Parsing Canonical Form.

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.