Enum TraitItem

#[non_exhaustive]
pub enum TraitItem

An item declaration within the definition of a trait.

Syntax tree enum

This type is a syntax tree enum.

Variants

Const(TraitItemConst)

An associated constant within the definition of a trait.

Fn(TraitItemFn)

An associated function within the definition of a trait.

Type(TraitItemType)

An associated type within the definition of a trait.

Macro(TraitItemMacro)

A macro invocation within the definition of a trait.

Verbatim(TokenStream)

Tokens within the definition of a trait not interpreted by Syn.

Important: see [Compatibility notes][crate#verbatim-variants].

Trait Implementations

impl Clone for TraitItem

fn clone(&self) -> Self

impl Parse for TraitItem

fn parse(input: ParseStream<'_>) -> Result<Self>

impl ToTokens for TraitItem

fn to_tokens(&self, tokens: &mut TokenStream)

Auto Trait Implementations

impl !Send for TraitItem

impl !Sync for TraitItem

impl Freeze for TraitItem

impl RefUnwindSafe for TraitItem

impl Unpin for TraitItem

impl UnsafeUnpin for TraitItem

impl UnwindSafe for TraitItem

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

impl<T> CloneToUninit for TraitItem where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for TraitItem

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Spanned for TraitItem where T: Spanned + ?Sized,

fn span(&self) -> Span

impl<T> ToOwned for TraitItem where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

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

fn into(self) -> U

Calls U::from(self).

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

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

type Error = never;
fn try_from(value: U) -> Result<T, never>

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

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