pub trait NearImpl {
fn get_trait_name(&self) -> Option<String>;
fn get_impl_name(&self) -> Option<String>;
fn exported_methods(&self) -> Vec<&ImplItemMethod>;
fn bindgen_methods(&self) -> Option<Vec<&ImplItemMethod>>;
fn join_attrs(&self, item_trait: Option<&NearItemTrait>) -> Vec<Attribute>;
}
Expand description
Defines standard attributes found in the NEAR SDK.
This trait
is intended to extend syn::ItemImpl
to support
NEAR definitions.
This trait should not be applied to the contract struct
,
since the struct
is not part of the public interface of the NEAR contract.
An overview of the near_bindgen
attribute macro can be found in
https://www.near-sdk.io/contract-structure/near-bindgen.
Required Methods
fn get_trait_name(&self) -> Option<String>
fn get_trait_name(&self) -> Option<String>
Returns the trait name this impl
implements, if any.
fn get_impl_name(&self) -> Option<String>
fn get_impl_name(&self) -> Option<String>
Returns the struct this impl
implements.
Only Type::Path
are supported.
fn exported_methods(&self) -> Vec<&ImplItemMethod>
fn exported_methods(&self) -> Vec<&ImplItemMethod>
Returns whether the given self
implementation has any exported method.
For more info on public method in the NEAR SDK, see https://www.near-sdk.io/contract-interface/public-methods.
fn bindgen_methods(&self) -> Option<Vec<&ImplItemMethod>>
fn bindgen_methods(&self) -> Option<Vec<&ImplItemMethod>>
Returns the exported methods if self
is_bindgen
.
In this case, the inner Vec
should contain elements.
Otherwise, it returns None
.
fn join_attrs(&self, item_trait: Option<&NearItemTrait>) -> Vec<Attribute>
fn join_attrs(&self, item_trait: Option<&NearItemTrait>) -> Vec<Attribute>
Join the attributes of this impl with its corresponding trait definition. Useful to gather documentation attributes.