pub struct ModPath {
pub kind: PathKind,
/* private fields */
}Fields§
§kind: PathKindImplementations§
source§impl ModPath
impl ModPath
pub fn from_src( db: &dyn ExpandDatabase, path: Path, hygiene: &Hygiene ) -> Option<ModPath>
pub fn from_segments( kind: PathKind, segments: impl IntoIterator<Item = Name> ) -> ModPath
sourcepub const fn from_kind(kind: PathKind) -> ModPath
pub const fn from_kind(kind: PathKind) -> ModPath
Creates a ModPath from a PathKind, with no extra path segments.
pub fn segments(&self) -> &[Name]
pub fn push_segment(&mut self, segment: Name)
pub fn pop_segment(&mut self) -> Option<Name>
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of segments in the path (counting special segments like $crate and
super).
pub fn is_ident(&self) -> bool
pub fn is_self(&self) -> bool
pub fn is_Self(&self) -> bool
sourcepub fn as_ident(&self) -> Option<&Name>
pub fn as_ident(&self) -> Option<&Name>
If this path is a single identifier, like foo, return its name.
pub fn unescaped(&self) -> UnescapedModPath<'_>
pub fn display<'a>(&'a self, db: &'a dyn ExpandDatabase) -> impl Display + 'a
Trait Implementations§
source§impl Ord for ModPath
impl Ord for ModPath
source§impl PartialEq for ModPath
impl PartialEq for ModPath
source§impl PartialOrd for ModPath
impl PartialOrd for ModPath
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl Eq for ModPath
impl StructuralEq for ModPath
impl StructuralPartialEq for ModPath
Auto Trait Implementations§
impl RefUnwindSafe for ModPath
impl Send for ModPath
impl Sync for ModPath
impl Unpin for ModPath
impl UnwindSafe for ModPath
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
§impl<T> Cast for T
impl<T> Cast for T
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§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<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.