Struct ink_ir::Constructor

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

An ink! constructor definition.

Example

Inherent implementation constructor:

impl MyStorage {
    #[ink(constructor)]
    pub fn new(init_value: i32) -> Self {
        /* contract initialization goes here */
    }
}

Trait implementation constructor:

impl MyTrait for MyStorage {
    #[ink(constructor)]
    fn new(init_value: i32) -> Self {
        /* contract initialization goes here */
    }
}

Implementations§

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

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

Trait Implementations§

Returns the kind of the ink! callable.
Returns the identifier of the ink! callable.
Returns the selector of the ink! callable if any has been manually set.
Returns true if the ink! callable is flagged as a wildcard selector.
Returns true if the ink! callable is flagged as payable. Read more
Returns the visibility of the ink! callable.
Returns an iterator yielding all input parameters of the ink! callable.
Returns the span of the inputs of the ink! callable.
Returns a slice over shared references to the statements of the callable.
Formats the value using the given formatter. Read more
Converts to this type from the input type.
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

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

Convert self directly into a TokenStream object. Read more
Convert self directly into a TokenStream object. Read more
The type returned in the event of a conversion error.
Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
Returns a Span covering the complete contents of this syntax tree node, or Span::call_site() if this node is empty.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.