pub struct ModPath {
pub kind: PathKind,
/* private fields */
}
Fields§
§kind: PathKind
Implementations§
source§impl ModPath
impl ModPath
pub fn from_src(
db: &dyn AstDatabase,
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<'_>
Trait Implementations§
source§impl Ord for ModPath
impl Ord for ModPath
source§impl PartialEq<ModPath> for ModPath
impl PartialEq<ModPath> for ModPath
source§impl PartialOrd<ModPath> for ModPath
impl PartialOrd<ModPath> 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§
§impl<T> Cast for T
impl<T> Cast for T
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.