Struct ink_lang_ir::ItemImpl
source · [−]pub struct ItemImpl { /* private fields */ }
Expand description
An ink! implementation block.
Note
- This can be either an inherent implementation block that implements some constructors, messages or internal functions for the storage struct; OR it can be a trait implementation for the storage struct.
- We try to support all fields that are supported by the underlying
syn
implementation forsyn::ItemImpl
even though they are not really required to represent ink!. This is done for consistency withsyn
.
Implementations
sourceimpl ItemImpl
impl ItemImpl
sourcepub fn attrs(&self) -> &[Attribute]
pub fn attrs(&self) -> &[Attribute]
Returns all non-ink! specific attributes of the implementation block.
sourcepub fn trait_path(&self) -> Option<&Path>
pub fn trait_path(&self) -> Option<&Path>
Returns the trait type path if this is a trait implementation block.
Returns None
if this is an inherent implementation block.
sourcepub fn trait_ident(&self) -> Option<&Ident>
pub fn trait_ident(&self) -> Option<&Ident>
Returns the trait identifier if this is a trait implementation block.
Returns None
if this is an inherent implementation block.
sourcepub fn namespace(&self) -> Option<&Namespace>
pub fn namespace(&self) -> Option<&Namespace>
Returns the namespace of the implementation block if any has been provided.
sourcepub fn iter_messages(&self) -> IterMessages<'_>ⓘNotable traits for IterMessages<'a>impl<'a> Iterator for IterMessages<'a> type Item = CallableWithSelector<'a, Message>;
pub fn iter_messages(&self) -> IterMessages<'_>ⓘNotable traits for IterMessages<'a>impl<'a> Iterator for IterMessages<'a> type Item = CallableWithSelector<'a, Message>;
Returns an iterator yielding the ink! messages of the implementation block.
sourcepub fn iter_constructors(&self) -> IterConstructors<'_>ⓘNotable traits for IterConstructors<'a>impl<'a> Iterator for IterConstructors<'a> type Item = CallableWithSelector<'a, Constructor>;
pub fn iter_constructors(&self) -> IterConstructors<'_>ⓘNotable traits for IterConstructors<'a>impl<'a> Iterator for IterConstructors<'a> type Item = CallableWithSelector<'a, Constructor>;
Returns an iterator yielding the ink! messages of the implementation block.
Trait Implementations
sourceimpl ToTokens for ItemImpl
impl ToTokens for ItemImpl
sourcefn 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.
sourcefn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Convert self
directly into a TokenStream
object. Read more
sourcefn into_token_stream(self) -> TokenStream
fn into_token_stream(self) -> TokenStream
Convert self
directly into a TokenStream
object. Read more
impl Eq for ItemImpl
impl StructuralEq for ItemImpl
impl StructuralPartialEq for ItemImpl
Auto Trait Implementations
impl RefUnwindSafe for ItemImpl
impl !Send for ItemImpl
impl !Sync for ItemImpl
impl Unpin for ItemImpl
impl UnwindSafe for ItemImpl
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Spanned for T where
T: Spanned + ?Sized,
impl<T> Spanned for T where
T: Spanned + ?Sized,
sourcefn 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. Read more