Enum ink_ir::InkItem

source ·
pub enum InkItem {
    Storage(Storage),
    Event(Event),
    ImplBlock(ItemImpl),
}
Expand description

An ink! specific item.

Variants§

§

Storage(Storage)

The ink! storage struct definition.

§

Event(Event)

An ink! event definition.

§

ImplBlock(ItemImpl)

An ink! implementation block.

Implementations§

source§

impl InkItem

source

pub fn is_ink_item(item: &Item) -> Result<bool, Error>

Returns true if the given syn::Item is eventually an ink! item.

Errors

If invalid or malformed ink! attributes are encountered for the given item.

source§

impl InkItem

source

pub fn filter_map_storage_item(&self) -> Option<&Storage>

Returns Some if self is the ink! storage struct definition.

Otherwise, returns None.

source

pub fn is_storage_item(&self) -> bool

Returns true if the ink! specific item is the storage struct definition.

source

pub fn filter_map_event_item(&self) -> Option<&Event>

Returns Some if self is an ink! event struct definition.

Otherwise, returns None.

source

pub fn is_event_item(&self) -> bool

Returns true if the ink! specific item is an event struct definition.

source

pub fn filter_map_impl_block(&self) -> Option<&ItemImpl>

Returns Some if self is an ink! implementation block.

Otherwise, returns None.

source

pub fn is_impl_block(&self) -> bool

Returns true if the ink! specific item is an implementation block.

Trait Implementations§

source§

impl Debug for InkItem

source§

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

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

impl From<Event> for InkItem

source§

fn from(event: Event) -> Self

Converts to this type from the input type.
source§

impl From<ItemImpl> for InkItem

source§

fn from(impl_block: ItemImpl) -> Self

Converts to this type from the input type.
source§

impl From<Storage> for InkItem

source§

fn from(storage: Storage) -> Self

Converts to this type from the input type.
source§

impl PartialEq<InkItem> for InkItem

source§

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

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 Eq for InkItem

source§

impl StructuralEq for InkItem

source§

impl StructuralPartialEq for InkItem

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.