Struct ink_ir::Message

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

An ink! message definition.

Example

Inherent implementation message:

impl MyStorage {
    #[ink(message)]
    pub fn my_message(&self, input: i32) -> bool {
        /* message implementation goes here */
    }
}

Trait implementation message:

impl MyTrait for MyStorage {
    #[ink(message)]
    fn my_message(&mut self, input: bool) -> i32 {
        /* message implementation goes here */
    }
}

Implementations§

source§

impl Message

source

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

Returns a slice of all non-ink! attributes of the ink! message.

source

pub fn receiver(&self) -> Receiver

Returns the self receiver of the ink! message.

source

pub fn output(&self) -> Option<&Type>

Returns the return type of the ink! message if any.

source

pub fn wrapped_output(&self) -> Type

Returns the return type of the message, but wrapped within a Result.

This is used to to allow callers to handle certain types of errors which are not exposed by messages.

source

pub fn local_id(&self) -> u32

Returns a local ID unique to the ink! message with respect to its implementation block.

Note

It is a compile error if two ink! trait messages share the same local ID. Although the above scenario is very unlikely since the local ID is computed solely by the identifier of the ink! message.

source

pub fn try_ident(&self) -> Ident

Returns the identifier of the message with an additional try_ prefix attached.

Trait Implementations§

source§

impl Callable for Message

source§

fn kind(&self) -> CallableKind

Returns the kind of the ink! callable.
source§

fn ident(&self) -> &Ident

Returns the identifier of the ink! callable.
source§

fn user_provided_selector(&self) -> Option<&Selector>

Returns the selector of the ink! callable if any has been manually set.
source§

fn has_wildcard_selector(&self) -> bool

Returns true if the ink! callable is flagged as a wildcard selector.
source§

fn is_payable(&self) -> bool

Returns true if the ink! callable is flagged as payable. Read more
source§

fn visibility(&self) -> Visibility

Returns the visibility of the ink! callable.
source§

fn inputs(&self) -> InputsIter<'_>

Returns an iterator yielding all input parameters of the ink! callable.
source§

fn inputs_span(&self) -> Span

Returns the span of the inputs of the ink! callable.
source§

fn statements(&self) -> &[Stmt]

Returns a slice over shared references to the statements of the callable.
source§

impl Debug for Message

source§

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

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

impl<'a> From<&'a Message> for InputsIter<'a>

source§

fn from(message: &'a Message) -> Self

Converts to this type from the input type.
source§

impl PartialEq<Message> for Message

source§

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

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<ImplItemMethod> for Message

§

type Error = Error

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

fn try_from(method_item: ImplItemMethod) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Eq for Message

source§

impl StructuralEq for Message

source§

impl StructuralPartialEq for Message

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.