pub struct QualifiedName<'a>(/* private fields */);Expand description
A representation of a qualified name, like typing.List.
Implementations§
Source§impl<'a> QualifiedName<'a>
impl<'a> QualifiedName<'a>
Sourcepub fn from_dotted_name(name: &'a str) -> QualifiedName<'a>
pub fn from_dotted_name(name: &'a str) -> QualifiedName<'a>
Create a QualifiedName from a dotted name.
assert_eq!(QualifiedName::from_dotted_name("typing.List").segments(), ["typing", "List"]);
assert_eq!(QualifiedName::from_dotted_name("list").segments(), ["", "list"]);Sourcepub fn user_defined(name: &'a str) -> QualifiedName<'a>
pub fn user_defined(name: &'a str) -> QualifiedName<'a>
Creates a name that’s guaranteed not be a built in
Sourcepub fn builtin(name: &'a str) -> QualifiedName<'a>
pub fn builtin(name: &'a str) -> QualifiedName<'a>
Creates a qualified name for a built in
pub fn segments(&self) -> &[&'a str]
Sourcepub fn is_unresolved_import(&self) -> bool
pub fn is_unresolved_import(&self) -> bool
If the call path is dot-prefixed, it’s an unresolved relative import.
Ex) [".foo", "bar"] -> ".foo.bar"
pub fn starts_with(&self, other: &QualifiedName<'_>) -> bool
Sourcepub fn append_member(self, member: &'a str) -> QualifiedName<'a>
pub fn append_member(self, member: &'a str) -> QualifiedName<'a>
Appends a member to the qualified name.
Sourcepub fn extend_members<T>(self, members: T) -> QualifiedName<'a>where
T: IntoIterator<Item = &'a str>,
pub fn extend_members<T>(self, members: T) -> QualifiedName<'a>where
T: IntoIterator<Item = &'a str>,
Extends the qualified name using the given members.
Trait Implementations§
Source§impl<'a> Clone for QualifiedName<'a>
impl<'a> Clone for QualifiedName<'a>
Source§fn clone(&self) -> QualifiedName<'a>
fn clone(&self) -> QualifiedName<'a>
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<'a> Debug for QualifiedName<'a>
impl<'a> Debug for QualifiedName<'a>
Source§impl Display for QualifiedName<'_>
impl Display for QualifiedName<'_>
Source§impl<'a> FromIterator<&'a str> for QualifiedName<'a>
impl<'a> FromIterator<&'a str> for QualifiedName<'a>
Source§fn from_iter<T>(iter: T) -> QualifiedName<'a>where
T: IntoIterator<Item = &'a str>,
fn from_iter<T>(iter: T) -> QualifiedName<'a>where
T: IntoIterator<Item = &'a str>,
Creates a value from an iterator. Read more
Source§impl<'a> Hash for QualifiedName<'a>
impl<'a> Hash for QualifiedName<'a>
Source§impl<'a> PartialEq for QualifiedName<'a>
impl<'a> PartialEq for QualifiedName<'a>
impl<'a> Eq for QualifiedName<'a>
impl<'a> StructuralPartialEq for QualifiedName<'a>
Auto Trait Implementations§
impl<'a> Freeze for QualifiedName<'a>
impl<'a> RefUnwindSafe for QualifiedName<'a>
impl<'a> Send for QualifiedName<'a>
impl<'a> Sync for QualifiedName<'a>
impl<'a> Unpin for QualifiedName<'a>
impl<'a> UnsafeUnpin for QualifiedName<'a>
impl<'a> UnwindSafe for QualifiedName<'a>
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> 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.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, U> OverflowingInto<U> for Twhere
U: OverflowingFrom<T>,
impl<T, U> OverflowingInto<U> for Twhere
U: OverflowingFrom<T>,
fn overflowing_into(self) -> (U, bool)
Source§impl<T, U> RoundingInto<U> for Twhere
U: RoundingFrom<T>,
impl<T, U> RoundingInto<U> for Twhere
U: RoundingFrom<T>,
fn rounding_into(self, rm: RoundingMode) -> (U, Ordering)
Source§impl<T, U> SaturatingInto<U> for Twhere
U: SaturatingFrom<T>,
impl<T, U> SaturatingInto<U> for Twhere
U: SaturatingFrom<T>,
fn saturating_into(self) -> U
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