Struct apache_avro::schema::Name
source · pub struct Name {
pub name: String,
pub namespace: Namespace,
}
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: Namespace
Implementations§
source§impl Name
impl Name
sourcepub fn new(name: &str) -> AvroResult<Self>
pub fn new(name: &str) -> AvroResult<Self>
Create a new Name
.
Parses the optional namespace
from the name
string.
aliases
will not be defined.
sourcepub fn fullname(&self, default_namespace: Namespace) -> String
pub fn fullname(&self, default_namespace: Namespace) -> String
Return the fullname
of this Name
More information about fullnames can be found in the Avro specification
sourcepub fn fully_qualified_name(&self, enclosing_namespace: &Namespace) -> Name
pub fn fully_qualified_name(&self, enclosing_namespace: &Namespace) -> Name
Return the fully qualified name needed for indexing or searching for the schema within a schema/schema env context. Puts the enclosing namespace into the name’s namespace for clarity in schema/schema env parsing
ⓘ
use apache_avro::schema::Name;
assert_eq!(
Name::new("some_name")?.fully_qualified_name(&Some("some_namespace".into())),
Name::new("some_namespace.some_name")?
);
assert_eq!(
Name::new("some_namespace.some_name")?.fully_qualified_name(&Some("other_namespace".into())),
Name::new("some_namespace.some_name")?
);
Trait Implementations§
source§impl<'de> Deserialize<'de> for Name
impl<'de> Deserialize<'de> for Name
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Name
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
Mutably borrows from an owned value. Read more
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)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)