pub struct PathData {
pub path: IdentPath,
pub usings: SmallVec<[String; 1]>,
pub generics: SmallVec<[IdentPath; 1]>,
}
Expand description
Represents a type ready to be resolved and rendered for a specific module.
It contains information like the actual path to the type, a list of generics and a list of usings to add to the module.
Fields§
§path: IdentPath
Actual path of the target type.
usings: SmallVec<[String; 1]>
Usings to add for this target type.
generics: SmallVec<[IdentPath; 1]>
Generics of this target type.
Implementations§
Source§impl PathData
impl PathData
Sourcepub fn with_generic(self, path: IdentPath) -> Self
pub fn with_generic(self, path: IdentPath) -> Self
Add a generic argument to the path data.
Sourcepub fn with_using<P: Into<String>>(self, path: P) -> Self
pub fn with_using<P: Into<String>>(self, path: P) -> Self
Add a using to the path data.
Sourcepub fn into_included(self) -> Self
pub fn into_included(self) -> Self
Make the path data to an included path data instead of a absolute one.
Sourcepub fn resolve_relative_to(&self, path: &ModulePath) -> TokenStream
pub fn resolve_relative_to(&self, path: &ModulePath) -> TokenStream
Resolves the target type relative to the passed module path
and
returns the rendered type as TokenStream
.
Methods from Deref<Target = IdentPath>§
Sourcepub fn module(&self) -> Option<&ModulePath>
pub fn module(&self) -> Option<&ModulePath>
Returns the module path for this identifier path.
Sourcepub fn is_absolute(&self) -> bool
pub fn is_absolute(&self) -> bool
Returns true
if the path is absolute, false
otherwise.
Sourcepub fn relative_to(&self, dst: &ModulePath) -> TokenStream
pub fn relative_to(&self, dst: &ModulePath) -> TokenStream
Creates a TokenStream
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.