Enum ink_ir::Item

source ·
pub enum Item {
    Ink(InkItem),
    Rust(Item),
}
Expand description

An item in the root of the ink! module (ir::ItemMod).

This is either an ink! specific item or a normal Rust item.

Variants§

§

Ink(InkItem)

The item is an ink! specific item.

§

Rust(Item)

The item is a normal Rust item.

Implementations§

source§

impl Item

source

pub fn is_ink_item(&self) -> bool

Returns true if self is an ink! specific item.

source

pub fn is_rust_item(&self) -> bool

Returns true if self is an normal Rust item.

source

pub fn map_ink_item(&self) -> Option<&InkItem>

Returns Some if self is an ink! specific item.

Otherwise, returns None.

source

pub fn map_rust_item(&self) -> Option<&Item>

Returns Some if self is an ink! specific item.

Otherwise, returns None.

Trait Implementations§

source§

impl Debug for Item

source§

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

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

impl PartialEq<Item> for Item

source§

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

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

§

type Error = Error

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

fn try_from(item: Item) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Eq for Item

source§

impl StructuralEq for Item

source§

impl StructuralPartialEq for Item

Auto Trait Implementations§

§

impl RefUnwindSafe for Item

§

impl !Send for Item

§

impl !Sync for Item

§

impl Unpin for Item

§

impl UnwindSafe for Item

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.