Struct ink_env::CallFlags

source ·
pub struct CallFlags { /* private fields */ }
Expand description

The flags used to change the behavior of a contract call.

Implementations§

source§

impl CallFlags

source

pub const fn set_forward_input(self, forward_input: bool) -> Self

Forwards the input for the current function to the callee.

Note

A forwarding call will consume the current contracts input. Any attempt to access the input after this call returns (e.g. by trying another forwarding call) will lead to a contract revert. Consider using Self::set_clone_input in order to preserve the input.

source

pub const fn set_clone_input(self, clone_input: bool) -> Self

Identical to Self::set_forward_input but without consuming the input.

This adds some additional weight costs to the call.

Note

This implies Self::set_forward_input and takes precedence when both are set.

source

pub const fn set_tail_call(self, tail_call: bool) -> Self

Do not return from the call but rather return the result of the callee to the callers caller.

Note

This makes the current contract completely transparent to its caller by replacing this contracts potential output with the callee ones. Any code after the contract calls has been invoked can be safely considered unreachable.

source

pub const fn set_allow_reentry(self, allow_reentry: bool) -> Self

Allow the callee to reenter into the current contract.

Without this flag any reentrancy into the current contract that originates from the callee (or any of its callees) is denied. This includes the first callee: You cannot call into yourself with this flag set.

source

pub const fn forward_input(&self) -> bool

Returns true if input forwarding is set.

Note

See Self::set_forward_input for more information.

source

pub const fn clone_input(&self) -> bool

Returns true if input cloning is set.

Note

See Self::set_clone_input for more information.

source

pub const fn tail_call(&self) -> bool

Returns true if the tail call property is set.

Note

See Self::set_tail_call for more information.

source

pub const fn allow_reentry(&self) -> bool

Returns true if call reentry is allowed.

Note

See Self::set_allow_reentry for more information.

Trait Implementations§

source§

impl Clone for CallFlags

source§

fn clone(&self) -> CallFlags

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for CallFlags

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for CallFlags

source§

fn default() -> CallFlags

Returns the “default value” for a type. Read more
source§

impl Copy for CallFlags

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.