pub struct Name {
pub name: String,
pub namespace: Option<String>,
pub aliases: Option<Vec<String>>,
}
Expand description
Represents names for record
, enum
and fixed
Avro schemas.
Each of these Schema
s have a fullname
composed of two parts:
- a name
- a namespace
aliases
can also be defined, to facilitate schema evolution.
More information about schema names can be found in the Avro specification
Fields§
§name: String
§namespace: Option<String>
§aliases: Option<Vec<String>>
Implementations§
source§impl Name
impl Name
sourcepub fn is_valid(name: &str) -> bool
pub fn is_valid(name: &str) -> bool
Reports whether the given string is a valid Avro name.
See: https://avro.apache.org/docs/1.11.1/specification/#names
sourcepub fn validate(name: &str) -> Result<(), AvroError>
pub fn validate(name: &str) -> Result<(), AvroError>
Returns an error if the given name is invalid.
sourcepub fn make_valid(name: &str) -> String
pub fn make_valid(name: &str) -> String
Rewrites name
to be valid.
Any non alphanumeric characters are replaced with underscores. If the
name begins with a number, it is prefixed with _
.
make_valid
is not injective. Multiple invalid names are mapped to the
the same valid name.
sourcepub fn parse(complex: &Map<String, Value>) -> Result<Self, AvroError>
pub fn parse(complex: &Map<String, Value>) -> Result<Self, AvroError>
Parse a serde_json::map::Map
into a Name
.
sourcepub fn parse_simple(name: &str) -> Result<Self, AvroError>
pub fn parse_simple(name: &str) -> Result<Self, AvroError>
Parses a name from a simple string.
sourcepub fn fullname(&self, default_namespace: &str) -> FullName
pub fn fullname(&self, default_namespace: &str) -> FullName
Return the fullname
of this Name
More information about fullnames can be found in the Avro specification