pub struct Telety<'item> { /* private fields */ }
Expand description
Wraps an Item which has the #[telety]
attribute to provide additional information
allowing it to be reflected outside its original context.
Implementations§
Source§impl<'item> Telety<'item>
impl<'item> Telety<'item>
Sourcepub fn new(item: &'item Item) -> Result<Self>
pub fn new(item: &'item Item) -> Result<Self>
Generate telety information for the Item.
The item must have a proper #[telety(...)]
attribute.
Usually this item will come from the telety-generated macro with the same name as the item.
pub fn options(&self) -> &Options
Sourcepub fn alias_map(&self) -> &Map<'_>
pub fn alias_map(&self) -> &Map<'_>
Provides the alias::Map for this item, which describes the mapping of types appearing in the item to the aliases created for them.
Sourcepub fn generics_visitor<'a>(
&self,
generic_arguments: impl IntoIterator<Item = &'a GenericArgument>,
) -> Result<ApplyGenericArguments<'_>>
pub fn generics_visitor<'a>( &self, generic_arguments: impl IntoIterator<Item = &'a GenericArgument>, ) -> Result<ApplyGenericArguments<'_>>
Create a visitor which substitutes generic parameters as if this type were monomorphized
with the provided generic arguments.
For example, if we have a type:
#[telety(crate)]
struct S<T, U, V = T>(T, U, V);
and provided the arguments [i32, u64]
,
the visitor would replace types T
with i32
,
U
with u64
, and V
with i32
.
See syn::visit_mut.
Sourcepub fn path(&self) -> Path
pub fn path(&self) -> Path
The Path to the item, using the crate name, not the crate::
qualifier,
and no arguments on the item.