pub struct QualifiedName(/* private fields */);
Expand description
A qualified name consists of a list of identifiers, separated by ::
,
e.g. a::b::c
Implementations§
Source§impl QualifiedName
impl QualifiedName
Sourcepub fn new(ids: Vec<Identifier>, src_ref: SrcRef) -> Self
pub fn new(ids: Vec<Identifier>, src_ref: SrcRef) -> Self
Create QualifiedName
from Identifier
s.
ids
: Identifiers that concatenate to the qualified name.src_ref
: Reference for the whole name.
Sourcepub fn from_id(id: Identifier) -> Self
pub fn from_id(id: Identifier) -> Self
Create QualifiedName
from single Identifier
.
Sourcepub fn no_ref(ids: Vec<Identifier>) -> Self
pub fn no_ref(ids: Vec<Identifier>) -> Self
Create qualified name from identifier
s without source code reference.
ids
: Identifiers that concatenate to the qualified name.
Sourcepub fn single_identifier(&self) -> Option<&Identifier>
pub fn single_identifier(&self) -> Option<&Identifier>
If the QualifiedName only consists of a single identifier, return it
Sourcepub fn is_qualified(&self) -> bool
pub fn is_qualified(&self) -> bool
Returns true if self is a qualified name with multiple ids in it
Sourcepub fn is_within(&self, module: &QualifiedName) -> bool
pub fn is_within(&self, module: &QualifiedName) -> bool
Tells if self is in a specified module
Sourcepub fn is_builtin(&self) -> bool
pub fn is_builtin(&self) -> bool
Returns true
if this name is in builtin module
Sourcepub fn remove_first(&self) -> Self
pub fn remove_first(&self) -> Self
remove the first name from path
Sourcepub fn remove_last(self) -> Self
pub fn remove_last(self) -> Self
remove the first name from path
Sourcepub fn push(&mut self, id: Identifier)
pub fn push(&mut self, id: Identifier)
Append identifier to name
Sourcepub fn split_first(&self) -> (Identifier, QualifiedName)
pub fn split_first(&self) -> (Identifier, QualifiedName)
Split name into first id and the rest
Sourcepub fn with_prefix(&self, prefix: &QualifiedName) -> Self
pub fn with_prefix(&self, prefix: &QualifiedName) -> Self
Add given prefix to name
Sourcepub fn with_suffix(&self, suffix: Identifier) -> Self
pub fn with_suffix(&self, suffix: Identifier) -> Self
Add a given identifier as suffix.
Sourcepub fn dissolve_super(&self, within: QualifiedName) -> (Self, Self)
pub fn dissolve_super(&self, within: QualifiedName) -> (Self, Self)
If name includes any “super” ids those will be dissolved.
Trait Implementations§
Source§impl Clone for QualifiedName
impl Clone for QualifiedName
Source§fn clone(&self) -> QualifiedName
fn clone(&self) -> QualifiedName
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for QualifiedName
impl Debug for QualifiedName
Source§impl Default for QualifiedName
impl Default for QualifiedName
Source§fn default() -> QualifiedName
fn default() -> QualifiedName
Returns the “default value” for a type. Read more
Source§impl DerefMut for QualifiedName
impl DerefMut for QualifiedName
Source§impl Display for QualifiedName
impl Display for QualifiedName
Source§impl Eval for QualifiedName
impl Eval for QualifiedName
Source§impl From<&Identifier> for QualifiedName
impl From<&Identifier> for QualifiedName
Source§fn from(id: &Identifier) -> Self
fn from(id: &Identifier) -> Self
Converts to this type from the input type.
Source§impl From<&Path> for QualifiedName
impl From<&Path> for QualifiedName
Source§impl From<Identifier> for QualifiedName
impl From<Identifier> for QualifiedName
Source§fn from(id: Identifier) -> Self
fn from(id: Identifier) -> Self
Converts to this type from the input type.
Source§impl From<QualifiedName> for String
impl From<QualifiedName> for String
Source§fn from(value: QualifiedName) -> Self
fn from(value: QualifiedName) -> Self
Converts to this type from the input type.
Source§impl From<Refer<Vec<Identifier>>> for QualifiedName
impl From<Refer<Vec<Identifier>>> for QualifiedName
Source§impl FromIterator<Identifier> for QualifiedName
impl FromIterator<Identifier> for QualifiedName
Source§fn from_iter<T: IntoIterator<Item = Identifier>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = Identifier>>(iter: T) -> Self
Creates a value from an iterator. Read more
Source§impl FromIterator<QualifiedName> for QualifiedNames
impl FromIterator<QualifiedName> for QualifiedNames
Source§fn from_iter<T: IntoIterator<Item = QualifiedName>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = QualifiedName>>(iter: T) -> Self
Creates a value from an iterator. Read more
Source§impl Hash for QualifiedName
impl Hash for QualifiedName
Source§impl Ord for QualifiedName
impl Ord for QualifiedName
Source§fn cmp(&self, other: &QualifiedName) -> Ordering
fn cmp(&self, other: &QualifiedName) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl Parse for QualifiedName
impl Parse for QualifiedName
fn parse(pair: Pair<'_>) -> ParseResult<Self>
Source§impl PartialEq for QualifiedName
impl PartialEq for QualifiedName
Source§impl PartialOrd for QualifiedName
impl PartialOrd for QualifiedName
Source§impl SrcReferrer for QualifiedName
impl SrcReferrer for QualifiedName
Source§impl TreeDisplay for QualifiedName
impl TreeDisplay for QualifiedName
Source§impl TryFrom<&str> for QualifiedName
impl TryFrom<&str> for QualifiedName
Source§impl TryFrom<String> for QualifiedName
impl TryFrom<String> for QualifiedName
Source§impl Deref for QualifiedName
impl Deref for QualifiedName
impl Eq for QualifiedName
impl StructuralPartialEq for QualifiedName
Auto Trait Implementations§
impl Freeze for QualifiedName
impl RefUnwindSafe for QualifiedName
impl Send for QualifiedName
impl Sync for QualifiedName
impl Unpin for QualifiedName
impl UnwindSafe for QualifiedName
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string()
Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString
. Read more