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§
Trait Implementations§
source§impl Callable for Constructor
impl Callable for Constructor
source§fn kind(&self) -> CallableKind
fn kind(&self) -> CallableKind
Returns the kind of the ink! callable.
source§fn user_provided_selector(&self) -> Option<&Selector>
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
fn has_wildcard_selector(&self) -> bool
Returns
true
if the ink! callable is flagged as a wildcard selector.source§fn is_payable(&self) -> bool
fn is_payable(&self) -> bool
Returns
true
if the ink! callable is flagged as payable. Read moresource§fn visibility(&self) -> Visibility
fn visibility(&self) -> Visibility
Returns the visibility of the ink! callable.
source§fn inputs(&self) -> InputsIter<'_> ⓘ
fn inputs(&self) -> InputsIter<'_> ⓘ
Returns an iterator yielding all input parameters of the ink! callable.
source§fn inputs_span(&self) -> Span
fn inputs_span(&self) -> Span
Returns the span of the inputs of the ink! callable.
source§fn statements(&self) -> &[Stmt]
fn statements(&self) -> &[Stmt]
Returns a slice over shared references to the statements of the callable.
source§impl Debug for Constructor
impl Debug for Constructor
source§impl<'a> From<&'a Constructor> for InputsIter<'a>
impl<'a> From<&'a Constructor> for InputsIter<'a>
source§fn from(constructor: &'a Constructor) -> Self
fn from(constructor: &'a Constructor) -> Self
Converts to this type from the input type.
source§impl PartialEq<Constructor> for Constructor
impl PartialEq<Constructor> for Constructor
source§fn eq(&self, other: &Constructor) -> bool
fn eq(&self, other: &Constructor) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl ToTokens for Constructor
impl ToTokens for Constructor
source§fn to_tokens(&self, tokens: &mut TokenStream)
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
fn to_token_stream(&self) -> TokenStream
source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
source§impl TryFrom<ImplItemMethod> for Constructor
impl TryFrom<ImplItemMethod> for Constructor
impl Eq for Constructor
impl StructuralEq for Constructor
impl StructuralPartialEq for Constructor
Auto Trait Implementations§
impl RefUnwindSafe for Constructor
impl !Send for Constructor
impl !Sync for Constructor
impl Unpin for Constructor
impl UnwindSafe for Constructor
Blanket Implementations§
source§impl<T> Spanned for Twhere
T: Spanned + ?Sized,
impl<T> Spanned for Twhere
T: Spanned + ?Sized,
source§fn span(&self) -> Span
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.