Struct frame_support::traits::tokens::WithdrawReasons
source · pub struct WithdrawReasons { /* private fields */ }
Expand description
Reasons for moving funds out of an account.
Implementations§
source§impl WithdrawReasons
impl WithdrawReasons
sourcepub const TRANSACTION_PAYMENT: Self = _
pub const TRANSACTION_PAYMENT: Self = _
In order to pay for (system) transaction costs.
sourcepub const fn from_bits(bits: u8) -> Option<Self>
pub const fn from_bits(bits: u8) -> Option<Self>
Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.
sourcepub const fn from_bits_truncate(bits: u8) -> Self
pub const fn from_bits_truncate(bits: u8) -> Self
Convert from underlying bit representation, dropping any bits that do not correspond to flags.
sourcepub const unsafe fn from_bits_unchecked(bits: u8) -> Self
pub const unsafe fn from_bits_unchecked(bits: u8) -> Self
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: Self) -> bool
pub const fn intersects(&self, other: Self) -> bool
Returns true
if there are flags common to both self
and other
.
sourcepub const fn contains(&self, other: Self) -> bool
pub const fn contains(&self, other: Self) -> bool
Returns true
if all of the flags in other
are contained within self
.
sourcepub fn set(&mut self, other: Self, value: bool)
pub fn set(&mut self, other: Self, value: bool)
Inserts or removes the specified flags depending on the passed value.
sourcepub const fn intersection(self, other: Self) -> Self
pub const fn intersection(self, other: Self) -> Self
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: Self) -> Self
pub const fn union(self, other: Self) -> Self
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: Self) -> Self
pub const fn difference(self, other: Self) -> Self
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: Self) -> Self
pub const fn symmetric_difference(self, other: Self) -> Self
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) -> Self
pub const fn complement(self) -> Self
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
.
source§impl WithdrawReasons
impl WithdrawReasons
sourcepub fn except(one: WithdrawReasons) -> WithdrawReasons
pub fn except(one: WithdrawReasons) -> WithdrawReasons
Choose all variants except for one
.
assert_eq!(
WithdrawReasons::FEE | WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE | WithdrawReasons::TIP,
WithdrawReasons::except(WithdrawReasons::TRANSACTION_PAYMENT),
);
Trait Implementations§
source§impl Binary for WithdrawReasons
impl Binary for WithdrawReasons
source§impl BitAnd<WithdrawReasons> for WithdrawReasons
impl BitAnd<WithdrawReasons> for WithdrawReasons
source§impl BitAndAssign<WithdrawReasons> for WithdrawReasons
impl BitAndAssign<WithdrawReasons> for WithdrawReasons
source§fn bitand_assign(&mut self, other: Self)
fn bitand_assign(&mut self, other: Self)
Disables all flags disabled in the set.
source§impl BitOr<WithdrawReasons> for WithdrawReasons
impl BitOr<WithdrawReasons> for WithdrawReasons
source§fn bitor(self, other: WithdrawReasons) -> Self
fn bitor(self, other: WithdrawReasons) -> Self
Returns the union of the two sets of flags.
§type Output = WithdrawReasons
type Output = WithdrawReasons
|
operator.source§impl BitOrAssign<WithdrawReasons> for WithdrawReasons
impl BitOrAssign<WithdrawReasons> for WithdrawReasons
source§fn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
Adds the set of flags.
source§impl BitXor<WithdrawReasons> for WithdrawReasons
impl BitXor<WithdrawReasons> for WithdrawReasons
source§impl BitXorAssign<WithdrawReasons> for WithdrawReasons
impl BitXorAssign<WithdrawReasons> for WithdrawReasons
source§fn bitxor_assign(&mut self, other: Self)
fn bitxor_assign(&mut self, other: Self)
Toggles the set of flags.
source§impl Clone for WithdrawReasons
impl Clone for WithdrawReasons
source§fn clone(&self) -> WithdrawReasons
fn clone(&self) -> WithdrawReasons
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for WithdrawReasons
impl Debug for WithdrawReasons
source§impl Decode for WithdrawReasons
impl Decode for WithdrawReasons
source§fn decode<__CodecInputEdqy: Input>(
__codec_input_edqy: &mut __CodecInputEdqy
) -> Result<Self, Error>
fn decode<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy ) -> Result<Self, Error>
§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 WithdrawReasons
impl Encode for WithdrawReasons
source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy )
source§fn using_encoded<R, F: FnOnce(&[u8]) -> R>(&self, f: F) -> R
fn using_encoded<R, F: FnOnce(&[u8]) -> R>(&self, f: F) -> R
§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
source§impl Extend<WithdrawReasons> for WithdrawReasons
impl Extend<WithdrawReasons> for WithdrawReasons
source§fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)
fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)
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<WithdrawReasons> for WithdrawReasons
impl FromIterator<WithdrawReasons> for WithdrawReasons
source§fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self
fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self
source§impl Hash for WithdrawReasons
impl Hash for WithdrawReasons
source§impl LowerHex for WithdrawReasons
impl LowerHex for WithdrawReasons
source§impl MaxEncodedLen for WithdrawReasons
impl MaxEncodedLen for WithdrawReasons
source§fn max_encoded_len() -> usize
fn max_encoded_len() -> usize
source§impl Not for WithdrawReasons
impl Not for WithdrawReasons
source§impl Octal for WithdrawReasons
impl Octal for WithdrawReasons
source§impl Ord for WithdrawReasons
impl Ord for WithdrawReasons
source§fn cmp(&self, other: &WithdrawReasons) -> Ordering
fn cmp(&self, other: &WithdrawReasons) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl PartialEq<WithdrawReasons> for WithdrawReasons
impl PartialEq<WithdrawReasons> for WithdrawReasons
source§fn eq(&self, other: &WithdrawReasons) -> bool
fn eq(&self, other: &WithdrawReasons) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<WithdrawReasons> for WithdrawReasons
impl PartialOrd<WithdrawReasons> for WithdrawReasons
source§fn partial_cmp(&self, other: &WithdrawReasons) -> Option<Ordering>
fn partial_cmp(&self, other: &WithdrawReasons) -> 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<WithdrawReasons> for WithdrawReasons
impl Sub<WithdrawReasons> for WithdrawReasons
source§impl SubAssign<WithdrawReasons> for WithdrawReasons
impl SubAssign<WithdrawReasons> for WithdrawReasons
source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Disables all flags enabled in the set.
source§impl UpperHex for WithdrawReasons
impl UpperHex for WithdrawReasons
impl Copy for WithdrawReasons
impl EncodeLike<WithdrawReasons> for WithdrawReasons
impl Eq for WithdrawReasons
impl StructuralEq for WithdrawReasons
impl StructuralPartialEq for WithdrawReasons
Auto Trait Implementations§
impl RefUnwindSafe for WithdrawReasons
impl Send for WithdrawReasons
impl Sync for WithdrawReasons
impl Unpin for WithdrawReasons
impl UnwindSafe for WithdrawReasons
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<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> 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> 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 moresource§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
.