Struct telety_impl::Telety
source · 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.
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.
sourcepub fn attributes(&self) -> &[Attribute]
pub fn attributes(&self) -> &[Attribute]
sourcepub fn containing_mod_path(&self) -> Path
pub fn containing_mod_path(&self) -> Path
sourcepub fn unique_ident(&self) -> Ident
pub fn unique_ident(&self) -> Ident
A (reasonably) unique Ident for this item.