pub enum Name {
Named(Cow<'static, str>),
Generated(Cow<'static, str>),
}
Expand description
Type that represents a name of a XSD element.
Variants§
Named(Cow<'static, str>)
The name was explicitly set to the given value.
Generated(Cow<'static, str>)
The name was generated.
Implementations§
Source§impl Name
impl Name
Sourcepub const fn named(name: &'static str) -> Self
pub const fn named(name: &'static str) -> Self
Create a new Name::Named
using the passed name
.
Sourcepub const fn generated(name: &'static str) -> Self
pub const fn generated(name: &'static str) -> Self
Create a new Name::Generated
using the passed name
.
Sourcepub fn new_named<T>(name: T) -> Self
pub fn new_named<T>(name: T) -> Self
Create a new Name::Named
using the passed name
.
Sourcepub fn new_generated<T>(name: T) -> Self
pub fn new_generated<T>(name: T) -> Self
Create a new Name::Generated
using the passed name
.
Sourcepub fn is_named(&self) -> bool
pub fn is_named(&self) -> bool
Returns true
if this is a Name::Named
, false
otherwise.
Sourcepub fn is_generated(&self) -> bool
pub fn is_generated(&self) -> bool
Returns true
if this is a Name::Generated
, false
otherwise.
Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Returns the value of Name::Named
or Name::Generated
.
Sourcepub fn as_named_str(&self) -> Option<&str>
pub fn as_named_str(&self) -> Option<&str>
Returns the value of Name::Named
or None
.
Sourcepub fn to_type_name(&self) -> String
pub fn to_type_name(&self) -> String
Formats this name as type name.
Sourcepub fn to_field_name(&self) -> String
pub fn to_field_name(&self) -> String
Formats this name as field name.
Sourcepub fn format_type_name(s: &str) -> String
pub fn format_type_name(s: &str) -> String
Formats the passed string s
as type name.
Sourcepub fn format_field_name(s: &str) -> String
pub fn format_field_name(s: &str) -> String
Formats the passed string s
as field name.
Trait Implementations§
Source§impl NameFallback for &Name
impl NameFallback for &Name
Source§fn apply(self, builder: &mut NameBuilder)
fn apply(self, builder: &mut NameBuilder)
Create the fallback value.
Source§impl NameFallback for Name
impl NameFallback for Name
Source§fn apply(self, builder: &mut NameBuilder)
fn apply(self, builder: &mut NameBuilder)
Create the fallback value.
Source§impl Ord for Name
impl Ord for Name
Source§impl PartialOrd for Name
impl PartialOrd for Name
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§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.