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
Trait Implementations§
impl StructuralPartialEq for Name
Auto Trait Implementations§
impl Freeze for Name
impl RefUnwindSafe for Name
impl Send for Name
impl Sync for Name
impl Unpin for Name
impl UnwindSafe for Name
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request