Struct ink_ir::Storage

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

An ink! storage struct definition.

Noticed by ink! through the #[ink(storage)] annotation.

Note

An ink! smart contract must have exactly one storage definition. The storage definition must be found in the root of the ink! module.

Example

#[ink(storage)]
pub struct MyStorage {
    my_value: bool,
     counter: u32,
}

Implementations§

source§

impl Storage

source

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

Returns the non-ink! attributes of the ink! storage struct.

source

pub fn ident(&self) -> &Ident

Returns the identifier of the storage struct.

source

pub fn generics(&self) -> &Generics

Returns the generics of the storage struct.

source

pub fn fields(&self) -> Iter<'_, Field>

Returns an iterator yielding all fields of the storage struct.

Trait Implementations§

source§

impl Debug for Storage

source§

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

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

impl From<Storage> for InkItem

source§

fn from(storage: Storage) -> Self

Converts to this type from the input type.
source§

impl PartialEq<Storage> for Storage

source§

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

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<ItemStruct> for Storage

§

type Error = Error

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

fn try_from(item_struct: ItemStruct) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Eq for Storage

source§

impl StructuralEq for Storage

source§

impl StructuralPartialEq for Storage

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.