pub struct IdentPath { /* private fields */ }Expand description
Represents a identifier path.
A identifier path is the full path of a specific identifier in the code,
like std::str::FromStr. The identified object can be a constant, a type,
a trait or any thing else that is define within a module.
The identifier path contains two parts:
- The identifier itself, which is more or less the name of the object to identify, and
- the math of the module the object is provided at.
Implementations§
Source§impl IdentPath
impl IdentPath
Sourcepub fn from_parts<I>(path: I, ident: Ident2) -> Selfwhere
I: IntoIterator<Item = Ident2>,
pub fn from_parts<I>(path: I, ident: Ident2) -> Selfwhere
I: IntoIterator<Item = Ident2>,
Crates a new IdentPath instance from the passed module path and the
identifier of the object to refer to.
Sourcepub fn from_ident(ident: Ident2) -> Self
pub fn from_ident(ident: Ident2) -> Self
Creates a new IdentPath from the passed object identifier without a
module path.
Sourcepub fn with_ident(self, ident: Ident2) -> Self
pub fn with_ident(self, ident: Ident2) -> Self
Changes the identifier of this identifier path to the passed ident.
Sourcepub fn with_path<I>(self, path: I) -> Selfwhere
I: IntoIterator<Item = Ident2>,
pub fn with_path<I>(self, path: I) -> Selfwhere
I: IntoIterator<Item = Ident2>,
Changes the module path of this identifier path to the passed path.
Sourcepub fn into_parts(self) -> (Ident2, Option<ModulePath>)
pub fn into_parts(self) -> (Ident2, Option<ModulePath>)
Splits this identifier path into it’s two main parts, the identifier and the module path.
Sourcepub fn relative_to(&self, dst: &ModulePath) -> TokenStream
pub fn relative_to(&self, dst: &ModulePath) -> TokenStream
Creates a new IdentPath that is relative to the passed dst module path.
This uses the super keyword to create a relative path from the passed dst module path
and this identifier path. The relative path is returned as token stream.