pub struct Name { /* private fields */ }Expand description
Represents names for record, enum and fixed Avro schemas.
Each of these Schemas 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
Implementations§
Source§impl Name
impl Name
Sourcepub fn new(name: impl Into<String> + AsRef<str>) -> AvroResult<Self>
pub fn new(name: impl Into<String> + AsRef<str>) -> AvroResult<Self>
Create a new Name.
Parses the optional namespace from the name string.
aliases will not be defined.
Sourcepub fn new_with_enclosing_namespace(
name: impl Into<String> + AsRef<str>,
enclosing_namespace: NamespaceRef<'_>,
) -> AvroResult<Self>
pub fn new_with_enclosing_namespace( name: impl Into<String> + AsRef<str>, enclosing_namespace: NamespaceRef<'_>, ) -> AvroResult<Self>
Create a new Name using the namespace from enclosing_namespace if absent.
pub fn name(&self) -> &str
pub fn namespace(&self) -> NamespaceRef<'_>
Sourcepub fn fullname(&self, enclosing_namespace: NamespaceRef<'_>) -> String
pub fn fullname(&self, enclosing_namespace: NamespaceRef<'_>) -> 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: NamespaceRef<'_>,
) -> Cow<'_, Name>
pub fn fully_qualified_name( &self, enclosing_namespace: NamespaceRef<'_>, ) -> Cow<'_, Name>
Construct the fully qualified name
assert_eq!(
Name::new("some_name")?.fully_qualified_name(Some("some_namespace")).into_owned(),
Name::new("some_namespace.some_name")?
);
assert_eq!(
Name::new("some_namespace.some_name")?.fully_qualified_name(Some("other_namespace")).into_owned(),
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