[−][src]Struct near_sdk_core::AttrSigInfo
Information extracted from method attributes and signature.
Fields
ident: IdentThe name of the method.
non_bindgen_attrs: Vec<Attribute>Attributes not related to bindgen.
args: Vec<ArgInfo>All arguments of the method.
is_init: boolWhether method can be used as initializer.
is_payable: boolWhether method accepting $NEAR.
input_serializer: SerializerTypeThe serializer that we use for env::input().
is_view: boolWhether the method doesn't mutate state
result_serializer: SerializerTypeThe serializer that we use for the return type.
receiver: Option<Receiver>The receiver, like mut self, self, &mut self, &self, or None.
returns: ReturnTypeWhat this function returns.
original_sig: SignatureThe original method signature.
Implementations
impl AttrSigInfo[src]
pub fn input_struct(&self, input_struct_type: InputStructType) -> TokenStream2[src]
Create struct representing input arguments.
- input_struct_type represents whether the input structure will be used for serialization
(e.g. for a promise input) or deserialization (e.g. for a method input).
Each argument is getting converted to a field in a struct. Specifically argument:
ATTRIBUTES ref mut binding @ SUBPATTERN : TYPEis getting converted to:binding: SUBTYPE,whereTYPEis one of the following:& SUBTYPE,&mut SUBTYPE,SUBTYPE, andSUBTYPEis one of the following:[T; n], path likestd::collections::HashMap<SUBTYPE, SUBTYPE>, or tuple(SUBTYPE0, SUBTYPE1, ...).
Example
struct Input { arg0: Vec<String>, arg1: [u64; 10], arg2: (u64, Vec<String>), }
pub fn decomposition_pattern(&self) -> TokenStream2[src]
Create pattern that decomposes input struct using correct mutability modifiers.
Example:
Input { arg0, mut arg1, arg2 }
pub fn constructor_expr(&self) -> TokenStream2[src]
pub fn arg_list(&self) -> TokenStream2[src]
Create a sequence of arguments that can be used to call the method or the function of the smart contract.
Example:
a, &b, &mut c,
pub fn pat_type_list(&self) -> TokenStream2[src]
Create a sequence of patterns and types to be used in the method signature.
Example:
a: u64, b: &mut T, ref mut c: Vec<String>,
pub fn callback_deserialization(&self) -> TokenStream2[src]
Create code that deserializes arguments that were decorated with #[callback]
pub fn callback_vec_deserialization(&self) -> TokenStream2[src]
Create code that deserializes arguments that were decorated with #[callback_vec].
impl AttrSigInfo[src]
pub fn new(
original_attrs: &mut Vec<Attribute>,
original_sig: &mut Signature
) -> Result<Self>[src]
original_attrs: &mut Vec<Attribute>,
original_sig: &mut Signature
) -> Result<Self>
Process the method and extract information important for near-sdk.
pub fn input_args(&self) -> impl Iterator<Item = &ArgInfo>[src]
Only get args that correspond to env::input().
Auto Trait Implementations
impl RefUnwindSafe for AttrSigInfo[src]
impl !Send for AttrSigInfo[src]
impl !Sync for AttrSigInfo[src]
impl Unpin for AttrSigInfo[src]
impl UnwindSafe for AttrSigInfo[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,