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§
Source§impl Constructor
impl Constructor
Sourcepub fn attrs(&self) -> &[Attribute]
pub fn attrs(&self) -> &[Attribute]
Returns a slice of all non-ink! attributes of the ink! constructor.
Sourcepub fn get_cfg_attrs(&self, span: Span) -> Vec<TokenStream>
pub fn get_cfg_attrs(&self, span: Span) -> Vec<TokenStream>
Returns a list of cfg
attributes if any.
Sourcepub fn get_cfg_syn_attrs(&self) -> Vec<Attribute>
pub fn get_cfg_syn_attrs(&self) -> Vec<Attribute>
Returns a list of cfg
attributes as syn::Attribute
if any.
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 has_wildcard_complement_selector(&self) -> bool
fn has_wildcard_complement_selector(&self) -> bool
Returns
true
if the ink! callable is flagged as a wildcard complement 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 is_default(&self) -> bool
fn is_default(&self) -> bool
Returns
true
if the ink! callable is flagged as default. 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 for Constructor
impl PartialEq for Constructor
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<ImplItemFn> for Constructor
impl TryFrom<ImplItemFn> for Constructor
impl Eq for Constructor
impl StructuralPartialEq for Constructor
Auto Trait Implementations§
impl Freeze for Constructor
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§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.