Struct ink_ir::ItemImpl

source ·
pub struct ItemImpl { /* private fields */ }
Expand description

An ink! implementation block.

Note

  • This can be either an inherent implementation block that implements some constructors, messages or internal functions for the storage struct; OR it can be a trait implementation for the storage struct.
  • We try to support all fields that are supported by the underlying syn implementation for syn::ItemImpl even though they are not really required to represent ink!. This is done for consistency with syn.

Implementations§

source§

impl ItemImpl

source

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

Returns all non-ink! specific attributes of the implementation block.

source

pub fn self_type(&self) -> &Type

Returns the Self type of the implementation block.

source

pub fn trait_path(&self) -> Option<&Path>

Returns the trait type path if this is a trait implementation block.

Returns None if this is an inherent implementation block.

source

pub fn trait_ident(&self) -> Option<&Ident>

Returns the trait identifier if this is a trait implementation block.

Returns None if this is an inherent implementation block.

source

pub fn namespace(&self) -> Option<&Namespace>

Returns the namespace of the implementation block if any has been provided.

source

pub fn iter_messages(&self) -> IterMessages<'_>

Returns an iterator yielding the ink! messages of the implementation block.

source

pub fn iter_constructors(&self) -> IterConstructors<'_>

Returns an iterator yielding the ink! messages of the implementation block.

source

pub fn items(&self) -> &[ImplItem]

Returns a slice over the shared references of the items of the impl.

Trait Implementations§

source§

impl Debug for ItemImpl

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<ItemImpl> for InkItem

source§

fn from(impl_block: ItemImpl) -> Self

Converts to this type from the input type.
source§

impl PartialEq<ItemImpl> for ItemImpl

source§

fn eq(&self, other: &ItemImpl) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl ToTokens for ItemImpl

source§

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

We mainly implement this trait for this ink! type to have a derived Spanned implementation for it.

source§

fn to_token_stream(&self) -> TokenStream

Convert self directly into a TokenStream object. Read more
source§

fn into_token_stream(self) -> TokenStreamwhere
    Self: Sized,

Convert self directly into a TokenStream object. Read more
source§

impl TryFrom<ItemImpl> for ItemImpl

§

type Error = Error

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

fn try_from(item_impl: ItemImpl) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Eq for ItemImpl

source§

impl StructuralEq for ItemImpl

source§

impl StructuralPartialEq for ItemImpl

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> Spanned for Twhere
    T: Spanned + ?Sized,

source§

fn span(&self) -> Span

Returns a Span covering the complete contents of this syntax tree node, or Span::call_site() if this node is empty.
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.