Struct pallet_contracts::chain_extension::ReturnFlags
source · pub struct ReturnFlags { /* private fields */ }
Expand description
Flags used by a contract to customize exit behaviour.
Implementations§
source§impl ReturnFlags
impl ReturnFlags
sourcepub const REVERT: ReturnFlags = Self{ bits: 1,}
pub const REVERT: ReturnFlags = Self{ bits: 1,}
If this bit is set all changes made by the contract execution are rolled back.
sourcepub const fn empty() -> ReturnFlags
pub const fn empty() -> ReturnFlags
Returns an empty set of flags.
sourcepub const fn all() -> ReturnFlags
pub const fn all() -> ReturnFlags
Returns the set containing all flags.
sourcepub 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.
sourcepub 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.
sourcepub 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.
sourcepub 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
.
sourcepub 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
.
sourcepub fn insert(&mut self, other: ReturnFlags)
pub fn insert(&mut self, other: ReturnFlags)
Inserts the specified flags in-place.
sourcepub fn remove(&mut self, other: ReturnFlags)
pub fn remove(&mut self, other: ReturnFlags)
Removes the specified flags in-place.
sourcepub fn toggle(&mut self, other: ReturnFlags)
pub fn toggle(&mut self, other: ReturnFlags)
Toggles the specified flags in-place.
sourcepub 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.
sourcepub 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
.
sourcepub 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
.
sourcepub 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
.
sourcepub 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
.
sourcepub 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§
source§impl Binary for ReturnFlags
impl Binary for ReturnFlags
source§impl BitAnd<ReturnFlags> for ReturnFlags
impl BitAnd<ReturnFlags> for ReturnFlags
source§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.source§impl BitAndAssign<ReturnFlags> for ReturnFlags
impl BitAndAssign<ReturnFlags> for ReturnFlags
source§fn bitand_assign(&mut self, other: ReturnFlags)
fn bitand_assign(&mut self, other: ReturnFlags)
Disables all flags disabled in the set.
source§impl BitOr<ReturnFlags> for ReturnFlags
impl BitOr<ReturnFlags> for ReturnFlags
source§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.source§impl BitOrAssign<ReturnFlags> for ReturnFlags
impl BitOrAssign<ReturnFlags> for ReturnFlags
source§fn bitor_assign(&mut self, other: ReturnFlags)
fn bitor_assign(&mut self, other: ReturnFlags)
Adds the set of flags.
source§impl BitXor<ReturnFlags> for ReturnFlags
impl BitXor<ReturnFlags> for ReturnFlags
source§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.source§impl BitXorAssign<ReturnFlags> for ReturnFlags
impl BitXorAssign<ReturnFlags> for ReturnFlags
source§fn bitxor_assign(&mut self, other: ReturnFlags)
fn bitxor_assign(&mut self, other: ReturnFlags)
Toggles the set of flags.
source§impl Clone for ReturnFlags
impl Clone for ReturnFlags
source§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 moresource§impl Debug for ReturnFlags
impl Debug for ReturnFlags
source§impl Decode for ReturnFlags
impl Decode for ReturnFlags
source§fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy
) -> Result<ReturnFlags, Error>where
__CodecInputEdqy: Input,
fn decode<__CodecInputEdqy>( __codec_input_edqy: &mut __CodecInputEdqy ) -> Result<ReturnFlags, Error>where __CodecInputEdqy: Input,
§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>( input: &mut I, dst: &mut MaybeUninit<Self> ) -> Result<DecodeFinished, Error>where I: Input,
§fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
fn skip<I>(input: &mut I) -> Result<(), Error>where I: Input,
§fn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
source§impl Encode for ReturnFlags
impl Encode for ReturnFlags
source§fn encode_to<__CodecOutputEdqy>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy
)where
__CodecOutputEdqy: Output + ?Sized,
fn encode_to<__CodecOutputEdqy>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy )where __CodecOutputEdqy: Output + ?Sized,
source§fn using_encoded<R, F>(&self, f: F) -> Rwhere
F: FnOnce(&[u8]) -> R,
fn using_encoded<R, F>(&self, f: F) -> Rwhere F: FnOnce(&[u8]) -> R,
§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
source§impl Extend<ReturnFlags> for ReturnFlags
impl Extend<ReturnFlags> for ReturnFlags
source§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
)source§impl FromIterator<ReturnFlags> for ReturnFlags
impl FromIterator<ReturnFlags> for ReturnFlags
source§fn from_iter<T>(iterator: T) -> ReturnFlagswhere
T: IntoIterator<Item = ReturnFlags>,
fn from_iter<T>(iterator: T) -> ReturnFlagswhere T: IntoIterator<Item = ReturnFlags>,
source§impl Hash for ReturnFlags
impl Hash for ReturnFlags
source§impl LowerHex for ReturnFlags
impl LowerHex for ReturnFlags
source§impl Not for ReturnFlags
impl Not for ReturnFlags
source§fn not(self) -> ReturnFlags
fn not(self) -> ReturnFlags
Returns the complement of this set of flags.
§type Output = ReturnFlags
type Output = ReturnFlags
!
operator.source§impl Octal for ReturnFlags
impl Octal for ReturnFlags
source§impl Ord for ReturnFlags
impl Ord for ReturnFlags
source§fn cmp(&self, other: &ReturnFlags) -> Ordering
fn cmp(&self, other: &ReturnFlags) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl PartialEq<ReturnFlags> for ReturnFlags
impl PartialEq<ReturnFlags> for ReturnFlags
source§fn eq(&self, other: &ReturnFlags) -> bool
fn eq(&self, other: &ReturnFlags) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<ReturnFlags> for ReturnFlags
impl PartialOrd<ReturnFlags> for ReturnFlags
source§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 moresource§impl Sub<ReturnFlags> for ReturnFlags
impl Sub<ReturnFlags> for ReturnFlags
source§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.source§impl SubAssign<ReturnFlags> for ReturnFlags
impl SubAssign<ReturnFlags> for ReturnFlags
source§fn sub_assign(&mut self, other: ReturnFlags)
fn sub_assign(&mut self, other: ReturnFlags)
Disables all flags enabled in the set.
source§impl TypeInfo for ReturnFlags
impl TypeInfo for ReturnFlags
source§impl UpperHex for ReturnFlags
impl UpperHex for ReturnFlags
impl Copy for ReturnFlags
impl EncodeLike<ReturnFlags> for ReturnFlags
impl Eq for ReturnFlags
impl StructuralEq for ReturnFlags
impl StructuralPartialEq for ReturnFlags
Auto Trait Implementations§
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> CheckedConversion for T
impl<T> CheckedConversion for T
§impl<T> DecodeAll for Twhere
T: Decode,
impl<T> DecodeAll for Twhere T: Decode,
§fn decode_all(input: &mut &[u8]) -> Result<T, Error>
fn decode_all(input: &mut &[u8]) -> Result<T, Error>
Self
and consume all of the given input data. Read more§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere T: Decode,
source§impl<T> DefensiveMax<T> for Twhere
T: PartialOrd<T>,
impl<T> DefensiveMax<T> for Twhere T: PartialOrd<T>,
source§fn defensive_max(self, other: T) -> T
fn defensive_max(self, other: T) -> T
source§fn defensive_strict_max(self, other: T) -> T
fn defensive_strict_max(self, other: T) -> T
source§impl<T> DefensiveMin<T> for Twhere
T: PartialOrd<T>,
impl<T> DefensiveMin<T> for Twhere T: PartialOrd<T>,
source§fn defensive_min(self, other: T) -> T
fn defensive_min(self, other: T) -> T
source§fn defensive_strict_min(self, other: T) -> T
fn defensive_strict_min(self, other: T) -> T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
source§impl<T> Hashable for Twhere
T: Codec,
impl<T> Hashable for Twhere T: Codec,
fn blake2_128(&self) -> [u8; 16]
fn blake2_256(&self) -> [u8; 32]
fn blake2_128_concat(&self) -> Vec<u8, Global> ⓘ
fn twox_128(&self) -> [u8; 16]
fn twox_256(&self) -> [u8; 32]
fn twox_64_concat(&self) -> Vec<u8, Global> ⓘ
fn identity(&self) -> Vec<u8, Global> ⓘ
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T, Outer> IsWrappedBy<Outer> for Twhere
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for Twhere Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,
§impl<T> KeyedVec for Twhere
T: Codec,
impl<T> KeyedVec for Twhere T: Codec,
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere Self: UniqueSaturatedFrom<T>,
source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere Self: UniqueSaturatedInto<T>,
T
. Read more§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.source§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere T: UncheckedFrom<S>,
source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.source§impl<T, S> UniqueSaturatedInto<T> for Swhere
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for Swhere T: Bounded, S: TryInto<T>,
source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.