Enum ink_ir::ImplItem

source ·
pub enum ImplItem {
    Constructor(Constructor),
    Message(Message),
    Other(ImplItem),
}
Expand description

An item within an ink! implementation block.

Can be either

Note

Based on syn::ImplItem with special variants for ink! impl items.

Variants§

§

Constructor(Constructor)

A #[ink(constructor)] marked inherent function.

§

Message(Message)

A #[ink(message)] marked method.

§

Other(ImplItem)

Any other implementation block item.

Implementations§

source§

impl ImplItem

source

pub fn is_message(&self) -> bool

Returns true if the impl block item is an ink! message.

source

pub fn filter_map_message(&self) -> Option<&Message>

Returns Some if self is an ink! message.

Otherwise, returns None.

source

pub fn is_constructor(&self) -> bool

Returns true if the impl block item is an ink! message.

source

pub fn filter_map_constructor(&self) -> Option<&Constructor>

Returns Some if self is an ink! constructor.

Otherwise, returns None.

source

pub fn is_other_item(&self) -> bool

Returns true if the impl block item is a non ink! specific item.

source

pub fn filter_map_other_item(&self) -> Option<&ImplItem>

Returns Some if self is a not an ink! specific item.

Otherwise, returns None.

Trait Implementations§

source§

impl Debug for ImplItem

source§

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

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

impl PartialEq<ImplItem> for ImplItem

source§

fn eq(&self, other: &ImplItem) -> 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 ImplItem

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<ImplItem> for ImplItem

§

type Error = Error

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

fn try_from(impl_item: ImplItem) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Eq for ImplItem

source§

impl StructuralEq for ImplItem

source§

impl StructuralPartialEq for ImplItem

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.