pub struct CallFlags { /* private fields */ }
Expand description
Flags used to change the behaviour of seal_call
and seal_delegate_call
.
Implementations§
§impl CallFlags
impl CallFlags
pub const FORWARD_INPUT: CallFlags = _
pub const FORWARD_INPUT: CallFlags = _
Forward the input of current function to the callee.
Supplied input pointers are ignored when set.
§Note
A forwarding call will consume the current contracts input. Any attempt to
access the input after this call returns will lead to [Error::InputForwarded
].
It does not matter if this is due to calling seal_input
or trying another
forwarding call. Consider using Self::CLONE_INPUT
in order to preserve
the input.
pub const CLONE_INPUT: CallFlags = _
pub const CLONE_INPUT: CallFlags = _
Identical to Self::FORWARD_INPUT
but without consuming the input.
This adds some additional weight costs to the call.
§Note
This implies Self::FORWARD_INPUT
and takes precedence when both are set.
pub const TAIL_CALL: CallFlags = _
pub const TAIL_CALL: CallFlags = _
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 by the callee ones. Any code after seal_call
can be safely considered unreachable.
pub const ALLOW_REENTRY: CallFlags = _
pub const ALLOW_REENTRY: CallFlags = _
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.
§Note
For seal_delegate_call
should be always unset, otherwise
[Error::InvalidCallFlags
] is returned.
pub const fn from_bits(bits: u32) -> Option<CallFlags>
pub const fn from_bits(bits: u32) -> Option<CallFlags>
Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.
pub const fn from_bits_truncate(bits: u32) -> CallFlags
pub const fn from_bits_truncate(bits: u32) -> CallFlags
Convert from underlying bit representation, dropping any bits that do not correspond to flags.
pub const unsafe fn from_bits_unchecked(bits: u32) -> CallFlags
pub const unsafe fn from_bits_unchecked(bits: u32) -> CallFlags
Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
§Safety
The caller of the bitflags!
macro can chose to allow or
disallow extra bits for their bitflags type.
The caller of from_bits_unchecked()
has to ensure that
all bits correspond to a defined flag or that extra bits
are valid for this bitflags type.
pub const fn intersects(&self, other: CallFlags) -> bool
pub const fn intersects(&self, other: CallFlags) -> bool
Returns true
if there are flags common to both self
and other
.
pub const fn contains(&self, other: CallFlags) -> bool
pub const fn contains(&self, other: CallFlags) -> bool
Returns true
if all of the flags in other
are contained within self
.
pub fn set(&mut self, other: CallFlags, value: bool)
pub fn set(&mut self, other: CallFlags, value: bool)
Inserts or removes the specified flags depending on the passed value.
pub const fn intersection(self, other: CallFlags) -> CallFlags
pub const fn intersection(self, other: CallFlags) -> CallFlags
Returns the intersection between the flags in self
and
other
.
Specifically, the returned set contains only the flags which are
present in both self
and other
.
This is equivalent to using the &
operator (e.g.
ops::BitAnd
), as in flags & other
.
pub const fn union(self, other: CallFlags) -> CallFlags
pub const fn union(self, other: CallFlags) -> CallFlags
Returns the union of between the flags in self
and other
.
Specifically, the returned set contains all flags which are
present in either self
or other
, including any which are
present in both (see Self::symmetric_difference
if that
is undesirable).
This is equivalent to using the |
operator (e.g.
ops::BitOr
), as in flags | other
.
pub const fn difference(self, other: CallFlags) -> CallFlags
pub const fn difference(self, other: CallFlags) -> CallFlags
Returns the difference between the flags in self
and other
.
Specifically, the returned set contains all flags present in
self
, except for the ones present in other
.
It is also conceptually equivalent to the “bit-clear” operation:
flags & !other
(and this syntax is also supported).
This is equivalent to using the -
operator (e.g.
ops::Sub
), as in flags - other
.
pub const fn symmetric_difference(self, other: CallFlags) -> CallFlags
pub const fn symmetric_difference(self, other: CallFlags) -> CallFlags
Returns the symmetric difference between the flags
in self
and other
.
Specifically, the returned set contains the flags present which
are present in self
or other
, but that are not present in
both. Equivalently, it contains the flags present in exactly
one of the sets self
and other
.
This is equivalent to using the ^
operator (e.g.
ops::BitXor
), as in flags ^ other
.
pub const fn complement(self) -> CallFlags
pub const fn complement(self) -> CallFlags
Returns the complement of this set of flags.
Specifically, the returned set contains all the flags which are
not set in self
, but which are allowed for this type.
Alternatively, it can be thought of as the set difference
between Self::all()
and self
(e.g. Self::all() - self
)
This is equivalent to using the !
operator (e.g.
ops::Not
), as in !flags
.
Trait Implementations§
§impl BitAndAssign for CallFlags
impl BitAndAssign for CallFlags
§fn bitand_assign(&mut self, other: CallFlags)
fn bitand_assign(&mut self, other: CallFlags)
Disables all flags disabled in the set.
§impl BitOrAssign for CallFlags
impl BitOrAssign for CallFlags
§fn bitor_assign(&mut self, other: CallFlags)
fn bitor_assign(&mut self, other: CallFlags)
Adds the set of flags.
§impl BitXorAssign for CallFlags
impl BitXorAssign for CallFlags
§fn bitxor_assign(&mut self, other: CallFlags)
fn bitxor_assign(&mut self, other: CallFlags)
Toggles the set of flags.
§impl Extend<CallFlags> for CallFlags
impl Extend<CallFlags> for CallFlags
§fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = CallFlags>,
fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = CallFlags>,
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)§impl FromIterator<CallFlags> for CallFlags
impl FromIterator<CallFlags> for CallFlags
§impl Ord for CallFlags
impl Ord for CallFlags
§impl PartialOrd for CallFlags
impl PartialOrd for CallFlags
§fn partial_cmp(&self, other: &CallFlags) -> Option<Ordering>
fn partial_cmp(&self, other: &CallFlags) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more§impl SubAssign for CallFlags
impl SubAssign for CallFlags
§fn sub_assign(&mut self, other: CallFlags)
fn sub_assign(&mut self, other: CallFlags)
Disables all flags enabled in the set.
impl Copy for CallFlags
impl Eq for CallFlags
impl StructuralPartialEq for CallFlags
Auto Trait Implementations§
impl Freeze for CallFlags
impl RefUnwindSafe for CallFlags
impl Send for CallFlags
impl Sync for CallFlags
impl Unpin for CallFlags
impl UnwindSafe for CallFlags
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: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T
. Read more§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.