Struct 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>

Source

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.

Source

pub fn options(&self) -> &Options

Source

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.

Source

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.

Source

pub fn item(&self) -> &Item

The Item this describes

Source

pub fn path(&self) -> Path

The Path to the item, using the crate name, not the crate:: qualifier, and no arguments on the item.

Source

pub fn attributes(&self) -> &[Attribute]

The Attributes on the Item

Source

pub fn containing_mod_path(&self) -> Path

The Path of the module containing this Item. Provided by argument to the telety attribute.

Source

pub fn macro_ident(&self) -> &Ident

Auto Trait Implementations§

§

impl<'item> Freeze for Telety<'item>

§

impl<'item> RefUnwindSafe for Telety<'item>

§

impl<'item> !Send for Telety<'item>

§

impl<'item> !Sync for Telety<'item>

§

impl<'item> Unpin for Telety<'item>

§

impl<'item> UnwindSafe for Telety<'item>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.