pub struct IdentPath { /* private fields */ }
Expand description
Represents an 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 anything else that is defined 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
ident
ifier 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 ident
ifier 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.
Trait Implementations§
Source§impl ToTokens for IdentPath
impl ToTokens for IdentPath
Source§fn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
Source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
impl Eq for IdentPath
impl StructuralPartialEq for IdentPath
Auto Trait Implementations§
impl Freeze for IdentPath
impl RefUnwindSafe for IdentPath
impl !Send for IdentPath
impl !Sync for IdentPath
impl Unpin for IdentPath
impl UnwindSafe for IdentPath
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<X> DeserializeBytes for X
impl<X> DeserializeBytes for X
Source§impl<'de, R, X> DeserializeSync<'de, R> for Xwhere
R: XmlReaderSync<'de>,
X: WithDeserializer,
impl<'de, R, X> DeserializeSync<'de, R> for Xwhere
R: XmlReaderSync<'de>,
X: WithDeserializer,
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
key
and return true
if they are equal.