Struct ink_env::ReturnFlags
pub struct ReturnFlags { /* private fields */ }
Expand description
Flags used by a contract to customize exit behaviour.
Implementations§
§impl ReturnFlags
impl ReturnFlags
pub const REVERT: ReturnFlags = _
pub const REVERT: ReturnFlags = _
If this bit is set all changes made by the contract execution are rolled back.
pub const fn empty() -> ReturnFlags
pub const fn empty() -> ReturnFlags
Returns an empty set of flags.
pub const fn all() -> ReturnFlags
pub const fn all() -> ReturnFlags
Returns the set containing all flags.
pub const fn from_bits(bits: u32) -> Option<ReturnFlags>
pub const fn from_bits(bits: u32) -> Option<ReturnFlags>
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) -> ReturnFlags
pub const fn from_bits_truncate(bits: u32) -> ReturnFlags
Convert from underlying bit representation, dropping any bits that do not correspond to flags.
pub const unsafe fn from_bits_unchecked(bits: u32) -> ReturnFlags
pub const unsafe fn from_bits_unchecked(bits: u32) -> ReturnFlags
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: ReturnFlags) -> bool
pub const fn intersects(&self, other: ReturnFlags) -> bool
Returns true
if there are flags common to both self
and other
.
pub const fn contains(&self, other: ReturnFlags) -> bool
pub const fn contains(&self, other: ReturnFlags) -> bool
Returns true
if all of the flags in other
are contained within self
.
pub fn insert(&mut self, other: ReturnFlags)
pub fn insert(&mut self, other: ReturnFlags)
Inserts the specified flags in-place.
pub fn remove(&mut self, other: ReturnFlags)
pub fn remove(&mut self, other: ReturnFlags)
Removes the specified flags in-place.
pub fn toggle(&mut self, other: ReturnFlags)
pub fn toggle(&mut self, other: ReturnFlags)
Toggles the specified flags in-place.
pub fn set(&mut self, other: ReturnFlags, value: bool)
pub fn set(&mut self, other: ReturnFlags, value: bool)
Inserts or removes the specified flags depending on the passed value.
pub const fn intersection(self, other: ReturnFlags) -> ReturnFlags
pub const fn intersection(self, other: ReturnFlags) -> ReturnFlags
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: ReturnFlags) -> ReturnFlags
pub const fn union(self, other: ReturnFlags) -> ReturnFlags
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: ReturnFlags) -> ReturnFlags
pub const fn difference(self, other: ReturnFlags) -> ReturnFlags
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: ReturnFlags) -> ReturnFlags
pub const fn symmetric_difference(self, other: ReturnFlags) -> ReturnFlags
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) -> ReturnFlags
pub const fn complement(self) -> ReturnFlags
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 Binary for ReturnFlags
impl Binary for ReturnFlags
§impl BitAnd for ReturnFlags
impl BitAnd for ReturnFlags
§fn bitand(self, other: ReturnFlags) -> ReturnFlags
fn bitand(self, other: ReturnFlags) -> ReturnFlags
Returns the intersection between the two sets of flags.
§type Output = ReturnFlags
type Output = ReturnFlags
&
operator.§impl BitAndAssign for ReturnFlags
impl BitAndAssign for ReturnFlags
§fn bitand_assign(&mut self, other: ReturnFlags)
fn bitand_assign(&mut self, other: ReturnFlags)
Disables all flags disabled in the set.
§impl BitOr for ReturnFlags
impl BitOr for ReturnFlags
§fn bitor(self, other: ReturnFlags) -> ReturnFlags
fn bitor(self, other: ReturnFlags) -> ReturnFlags
Returns the union of the two sets of flags.
§type Output = ReturnFlags
type Output = ReturnFlags
|
operator.§impl BitOrAssign for ReturnFlags
impl BitOrAssign for ReturnFlags
§fn bitor_assign(&mut self, other: ReturnFlags)
fn bitor_assign(&mut self, other: ReturnFlags)
Adds the set of flags.
§impl BitXor for ReturnFlags
impl BitXor for ReturnFlags
§fn bitxor(self, other: ReturnFlags) -> ReturnFlags
fn bitxor(self, other: ReturnFlags) -> ReturnFlags
Returns the left flags, but with all the right flags toggled.
§type Output = ReturnFlags
type Output = ReturnFlags
^
operator.§impl BitXorAssign for ReturnFlags
impl BitXorAssign for ReturnFlags
§fn bitxor_assign(&mut self, other: ReturnFlags)
fn bitxor_assign(&mut self, other: ReturnFlags)
Toggles the set of flags.
§impl Clone for ReturnFlags
impl Clone for ReturnFlags
§fn clone(&self) -> ReturnFlags
fn clone(&self) -> ReturnFlags
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for ReturnFlags
impl Debug for ReturnFlags
§impl Extend<ReturnFlags> for ReturnFlags
impl Extend<ReturnFlags> for ReturnFlags
§fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = ReturnFlags>,
fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = ReturnFlags>,
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<ReturnFlags> for ReturnFlags
impl FromIterator<ReturnFlags> for ReturnFlags
§fn from_iter<T>(iterator: T) -> ReturnFlagswhere
T: IntoIterator<Item = ReturnFlags>,
fn from_iter<T>(iterator: T) -> ReturnFlagswhere
T: IntoIterator<Item = ReturnFlags>,
§impl Hash for ReturnFlags
impl Hash for ReturnFlags
§impl LowerHex for ReturnFlags
impl LowerHex for ReturnFlags
§impl Not for ReturnFlags
impl Not for ReturnFlags
§fn not(self) -> ReturnFlags
fn not(self) -> ReturnFlags
Returns the complement of this set of flags.
§type Output = ReturnFlags
type Output = ReturnFlags
!
operator.§impl Octal for ReturnFlags
impl Octal for ReturnFlags
§impl Ord for ReturnFlags
impl Ord for ReturnFlags
§impl PartialEq for ReturnFlags
impl PartialEq for ReturnFlags
§fn eq(&self, other: &ReturnFlags) -> bool
fn eq(&self, other: &ReturnFlags) -> bool
self
and other
values to be equal, and is used
by ==
.§impl PartialOrd for ReturnFlags
impl PartialOrd for ReturnFlags
§fn partial_cmp(&self, other: &ReturnFlags) -> Option<Ordering>
fn partial_cmp(&self, other: &ReturnFlags) -> 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 Sub for ReturnFlags
impl Sub for ReturnFlags
§fn sub(self, other: ReturnFlags) -> ReturnFlags
fn sub(self, other: ReturnFlags) -> ReturnFlags
Returns the set difference of the two sets of flags.
§type Output = ReturnFlags
type Output = ReturnFlags
-
operator.§impl SubAssign for ReturnFlags
impl SubAssign for ReturnFlags
§fn sub_assign(&mut self, other: ReturnFlags)
fn sub_assign(&mut self, other: ReturnFlags)
Disables all flags enabled in the set.
§impl UpperHex for ReturnFlags
impl UpperHex for ReturnFlags
impl Copy for ReturnFlags
impl Eq for ReturnFlags
impl StructuralPartialEq for ReturnFlags
Auto Trait Implementations§
impl Freeze for ReturnFlags
impl RefUnwindSafe for ReturnFlags
impl Send for ReturnFlags
impl Sync for ReturnFlags
impl Unpin for ReturnFlags
impl UnwindSafe for ReturnFlags
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
.