Enum ink_lang_ir::ImplItem
source · [−]pub enum ImplItem {
Constructor(Constructor),
Message(Message),
Other(ImplItem),
}
Expand description
An item within an ink! implementation block.
Can be either
- an ink!
ir::Constructor
- an ink!
ir::Message
- or any other non-ink! item.
Note
Based on syn::ImplItem
with special variants for ink! impl
items.
Variants
Constructor(Constructor)
A #[ink(constructor)]
marked inherent function.
Message(Message)
A #[ink(message)]
marked method.
Other(ImplItem)
Any other implementation block item.
Implementations
sourceimpl ImplItem
impl ImplItem
sourcepub fn is_message(&self) -> bool
pub fn is_message(&self) -> bool
Returns true
if the impl
block item is an ink! message.
sourcepub fn filter_map_message(&self) -> Option<&Message>
pub fn filter_map_message(&self) -> Option<&Message>
Returns Some
if self
is an ink! message.
Otherwise, returns None
.
sourcepub fn is_constructor(&self) -> bool
pub fn is_constructor(&self) -> bool
Returns true
if the impl
block item is an ink! message.
sourcepub fn filter_map_constructor(&self) -> Option<&Constructor>
pub fn filter_map_constructor(&self) -> Option<&Constructor>
Returns Some
if self
is an ink! constructor.
Otherwise, returns None
.
sourcepub fn is_other_item(&self) -> bool
pub fn is_other_item(&self) -> bool
Returns true
if the impl
block item is a non ink! specific item.
sourcepub fn filter_map_other_item(&self) -> Option<&ImplItem>
pub fn filter_map_other_item(&self) -> Option<&ImplItem>
Returns Some
if self
is a not an ink! specific item.
Otherwise, returns None
.
Trait Implementations
sourceimpl ToTokens for ImplItem
impl ToTokens for ImplItem
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
sourcefn into_token_stream(self) -> TokenStream
fn into_token_stream(self) -> TokenStream
impl Eq for ImplItem
impl StructuralEq for ImplItem
impl StructuralPartialEq for ImplItem
Auto Trait Implementations
impl RefUnwindSafe for ImplItem
impl !Send for ImplItem
impl !Sync for ImplItem
impl Unpin for ImplItem
impl UnwindSafe for ImplItem
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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 Twhere
T: Spanned + ?Sized,
impl<T> Spanned for Twhere
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