pub struct Function {
pub abi_version: AbiVersion,
pub headers: Arc<[AbiHeaderType]>,
pub name: Arc<str>,
pub inputs: Arc<[NamedAbiType]>,
pub outputs: Arc<[NamedAbiType]>,
pub input_id: u32,
pub output_id: u32,
}Expand description
Contract method ABI definition.
Fields§
§abi_version: AbiVersionABI version (same as contract ABI version).
headers: Arc<[AbiHeaderType]>List of headers for external messages. Must be the same as in contract.
NOTE: header order matters.
name: Arc<str>Method name.
inputs: Arc<[NamedAbiType]>Method input argument types.
outputs: Arc<[NamedAbiType]>Method output types.
input_id: u32Function id in incoming messages (with input).
output_id: u32Function id in outgoing messages (with output).
Implementations§
Source§impl Function
impl Function
Sourcepub const INPUT_ID_MASK: u32 = 2_147_483_647u32
pub const INPUT_ID_MASK: u32 = 2_147_483_647u32
Mask with a bit difference of input id and output id.
Sourcepub fn compute_function_id(
abi_version: AbiVersion,
name: &str,
headers: &[AbiHeaderType],
inputs: &[NamedAbiType],
outputs: &[NamedAbiType],
) -> u32
pub fn compute_function_id( abi_version: AbiVersion, name: &str, headers: &[AbiHeaderType], inputs: &[NamedAbiType], outputs: &[NamedAbiType], ) -> u32
Computes function id from the full function signature.
Sourcepub fn encode_internal_msg_body(
version: AbiVersion,
id: u32,
tokens: &[NamedAbiValue],
) -> Result<CellBuilder>
pub fn encode_internal_msg_body( version: AbiVersion, id: u32, tokens: &[NamedAbiValue], ) -> Result<CellBuilder>
Encodes message body without headers.
Sourcepub fn builder<T: Into<String>>(
abi_version: AbiVersion,
name: T,
) -> FunctionBuilder
pub fn builder<T: Into<String>>( abi_version: AbiVersion, name: T, ) -> FunctionBuilder
Returns a method builder with the specified ABI version and name.
Sourcepub fn encode_external<'f, 'a: 'f>(
&'f self,
tokens: &'a [NamedAbiValue],
) -> ExternalInput<'_, '_>
pub fn encode_external<'f, 'a: 'f>( &'f self, tokens: &'a [NamedAbiValue], ) -> ExternalInput<'_, '_>
Encodes an unsigned body with invocation of this method as an external message.
Sourcepub fn decode_external_input(
&self,
slice: CellSlice<'_>,
) -> Result<Vec<NamedAbiValue>>
pub fn decode_external_input( &self, slice: CellSlice<'_>, ) -> Result<Vec<NamedAbiValue>>
Tries to parse input arguments for this method from an external message body.
NOTE: The slice is required to contain nothing other than these arguments.
Sourcepub fn decode_external_input_ext(
&self,
slice: &mut CellSlice<'_>,
allow_partial: bool,
) -> Result<Vec<NamedAbiValue>>
pub fn decode_external_input_ext( &self, slice: &mut CellSlice<'_>, allow_partial: bool, ) -> Result<Vec<NamedAbiValue>>
Tries to parse input arguments for this method from an external message body.
Sourcepub fn encode_internal_input(
&self,
tokens: &[NamedAbiValue],
) -> Result<CellBuilder>
pub fn encode_internal_input( &self, tokens: &[NamedAbiValue], ) -> Result<CellBuilder>
Encodes a message body with invocation of this method as an internal message.
Sourcepub fn encode_internal_message(
&self,
tokens: &[NamedAbiValue],
dst: IntAddr,
value: Tokens,
bounce: bool,
state_init: Option<&StateInit>,
) -> Result<Box<OwnedRelaxedMessage>>
pub fn encode_internal_message( &self, tokens: &[NamedAbiValue], dst: IntAddr, value: Tokens, bounce: bool, state_init: Option<&StateInit>, ) -> Result<Box<OwnedRelaxedMessage>>
Encodes an internal message with invocation of this method.
Sourcepub fn decode_internal_input(
&self,
slice: CellSlice<'_>,
) -> Result<Vec<NamedAbiValue>>
pub fn decode_internal_input( &self, slice: CellSlice<'_>, ) -> Result<Vec<NamedAbiValue>>
Tries to parse input arguments for this method from an internal message body.
NOTE: The slice is required to contain nothing other than these arguments.
Sourcepub fn decode_internal_input_ext(
&self,
slice: &mut CellSlice<'_>,
allow_partial: bool,
) -> Result<Vec<NamedAbiValue>>
pub fn decode_internal_input_ext( &self, slice: &mut CellSlice<'_>, allow_partial: bool, ) -> Result<Vec<NamedAbiValue>>
Tries to parse input arguments for this method from an internal message body.
Sourcepub fn encode_output(&self, tokens: &[NamedAbiValue]) -> Result<CellBuilder>
pub fn encode_output(&self, tokens: &[NamedAbiValue]) -> Result<CellBuilder>
Encodes a message body with result of invocation of this method.
Sourcepub fn decode_output(&self, slice: CellSlice<'_>) -> Result<Vec<NamedAbiValue>>
pub fn decode_output(&self, slice: CellSlice<'_>) -> Result<Vec<NamedAbiValue>>
Tries to parse output arguments of this method from a message body.
NOTE: The slice is required to contain nothing other than these arguments.
Sourcepub fn decode_output_ext(
&self,
slice: &mut CellSlice<'_>,
allow_partial: bool,
) -> Result<Vec<NamedAbiValue>>
pub fn decode_output_ext( &self, slice: &mut CellSlice<'_>, allow_partial: bool, ) -> Result<Vec<NamedAbiValue>>
Tries to parse output arguments of this method from a message body.
Sourcepub fn display_signature(&self) -> impl Display + '_
pub fn display_signature(&self) -> impl Display + '_
Returns an object which can be used to display the normalized signature of this method.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Function
impl RefUnwindSafe for Function
impl Send for Function
impl Sync for Function
impl Unpin for Function
impl UnwindSafe for Function
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)