pub struct Name { /* private fields */ }Expand description
This is the Name type used to name types, functions, etc.
The name can include namespaces.
Clone is O(1).
Implementations§
Source§impl Name
impl Name
Sourcepub fn new(id: Id, path: impl IntoIterator<Item = Id>) -> Self
pub fn new(id: Id, path: impl IntoIterator<Item = Id>) -> Self
A full constructor for Name
Sourcepub fn unqualified_name(id: Id) -> Self
pub fn unqualified_name(id: Id) -> Self
Create a Name with no path (no namespaces).
Sourcepub fn parse_unqualified_name(s: &str) -> Result<Self, Vec<ParseError>>
pub fn parse_unqualified_name(s: &str) -> Result<Self, Vec<ParseError>>
Create a Name with no path (no namespaces).
Returns an error if s is not a valid identifier.
Sourcepub fn namespace_components(&self) -> impl Iterator<Item = &Id>
pub fn namespace_components(&self) -> impl Iterator<Item = &Id>
Get the namespace of the Name, as components
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
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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more