[][src]Struct near_sdk_core::AttrSigInfo

pub struct AttrSigInfo {
    pub ident: Ident,
    pub non_bindgen_attrs: Vec<Attribute>,
    pub args: Vec<ArgInfo>,
    pub is_init: bool,
    pub is_payable: bool,
    pub input_serializer: SerializerType,
    pub is_view: bool,
    pub result_serializer: SerializerType,
    pub receiver: Option<Receiver>,
    pub returns: ReturnType,
    pub original_sig: Signature,
}

Information extracted from method attributes and signature.

Fields

ident: Ident

The name of the method.

non_bindgen_attrs: Vec<Attribute>

Attributes not related to bindgen.

args: Vec<ArgInfo>

All arguments of the method.

is_init: bool

Whether method can be used as initializer.

is_payable: bool

Whether method accepting $NEAR.

input_serializer: SerializerType

The serializer that we use for env::input().

is_view: bool

Whether the method doesn't mutate state

result_serializer: SerializerType

The serializer that we use for the return type.

receiver: Option<Receiver>

The receiver, like mut self, self, &mut self, &self, or None.

returns: ReturnType

What this function returns.

original_sig: Signature

The original method signature.

Methods

impl AttrSigInfo[src]

pub fn input_struct(&self) -> TokenStream2[src]

Create struct representing input arguments. Each argument is getting converted to a field in a struct. Specifically argument: ATTRIBUTES ref mut binding @ SUBPATTERN : TYPE is getting converted to: binding: SUBTYPE, where TYPE is one of the following: & SUBTYPE, &mut SUBTYPE, SUBTYPE, and SUBTYPE is one of the following: [T; n], path like std::collections::HashMap<SUBTYPE, SUBTYPE>, or tuple (SUBTYPE0, SUBTYPE1, ...).

Example

This example is not tested
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:

This example is not tested
Input {
    arg0,
    mut arg1,
    arg2
}

pub fn constructor_expr(&self) -> TokenStream2[src]

Create expression that constructs the struct.

Example:

This example is not tested
Input {
    arg0,
    arg1,
    arg2,
}

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:

This example is not tested
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:

This example is not tested
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]

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

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.