pub struct LockFlags {
bits: u32,
}
Fields§
§bits: u32
Implementations§
source§impl LockFlags
impl LockFlags
sourcepub const UNMODIFIED_BASE: LockFlags = _
pub const UNMODIFIED_BASE: LockFlags = _
Checks that the substate locked is unmodified from the beginning of the transaction. This is used mainly for locking fees in vaults which requires this in order to be able to support rollbacks
sourcepub const FORCE_WRITE: LockFlags = _
pub const FORCE_WRITE: LockFlags = _
Forces a write of a substate even on a transaction failure Currently used for vault fees.
sourcepub const fn from_bits(bits: u32) -> Option<LockFlags>
pub const fn from_bits(bits: u32) -> Option<LockFlags>
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) -> LockFlags
pub const fn from_bits_truncate(bits: u32) -> LockFlags
Convert from underlying bit representation, dropping any bits that do not correspond to flags.
sourcepub const unsafe fn from_bits_unchecked(bits: u32) -> LockFlags
pub const unsafe fn from_bits_unchecked(bits: u32) -> LockFlags
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: LockFlags) -> bool
pub const fn intersects(&self, other: LockFlags) -> bool
Returns true
if there are flags common to both self
and other
.
sourcepub const fn contains(&self, other: LockFlags) -> bool
pub const fn contains(&self, other: LockFlags) -> bool
Returns true
if all of the flags in other
are contained within self
.
sourcepub fn set(&mut self, other: LockFlags, value: bool)
pub fn set(&mut self, other: LockFlags, value: bool)
Inserts or removes the specified flags depending on the passed value.
sourcepub const fn intersection(self, other: LockFlags) -> LockFlags
pub const fn intersection(self, other: LockFlags) -> LockFlags
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: LockFlags) -> LockFlags
pub const fn union(self, other: LockFlags) -> LockFlags
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: LockFlags) -> LockFlags
pub const fn difference(self, other: LockFlags) -> LockFlags
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: LockFlags) -> LockFlags
pub const fn symmetric_difference(self, other: LockFlags) -> LockFlags
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) -> LockFlags
pub const fn complement(self) -> LockFlags
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 BitAndAssign for LockFlags
impl BitAndAssign for LockFlags
source§fn bitand_assign(&mut self, other: LockFlags)
fn bitand_assign(&mut self, other: LockFlags)
Disables all flags disabled in the set.
source§impl BitOrAssign for LockFlags
impl BitOrAssign for LockFlags
source§fn bitor_assign(&mut self, other: LockFlags)
fn bitor_assign(&mut self, other: LockFlags)
Adds the set of flags.
source§impl BitXorAssign for LockFlags
impl BitXorAssign for LockFlags
source§fn bitxor_assign(&mut self, other: LockFlags)
fn bitxor_assign(&mut self, other: LockFlags)
Toggles the set of flags.
source§impl<X> Categorize<X> for LockFlagswhere
X: CustomValueKind,
impl<X> Categorize<X> for LockFlagswhere
X: CustomValueKind,
fn value_kind() -> ValueKind<X>
source§impl<D, X> Decode<X, D> for LockFlagswhere
D: Decoder<X>,
X: CustomValueKind,
impl<D, X> Decode<X, D> for LockFlagswhere
D: Decoder<X>,
X: CustomValueKind,
source§fn decode_body_with_value_kind(
decoder: &mut D,
value_kind: ValueKind<X>
) -> Result<LockFlags, DecodeError>
fn decode_body_with_value_kind( decoder: &mut D, value_kind: ValueKind<X> ) -> Result<LockFlags, DecodeError>
source§impl<C> Describe<C> for LockFlagswhere
C: CustomTypeKind<RustTypeId>,
impl<C> Describe<C> for LockFlagswhere
C: CustomTypeKind<RustTypeId>,
source§const TYPE_ID: RustTypeId = _
const TYPE_ID: RustTypeId = _
TYPE_ID
should give a unique identifier for its SBOR schema type.
An SBOR schema type capture details about the SBOR payload, how it should be interpreted, validated and displayed. Read moresource§fn type_data() -> TypeData<C, RustTypeId>
fn type_data() -> TypeData<C, RustTypeId>
source§fn add_all_dependencies(aggregator: &mut TypeAggregator<C>)
fn add_all_dependencies(aggregator: &mut TypeAggregator<C>)
get_local_type_data
, we need to ensure that the type and all of its own references
get added to the aggregator. Read moresource§impl<E, X> Encode<X, E> for LockFlagswhere
E: Encoder<X>,
X: CustomValueKind,
impl<E, X> Encode<X, E> for LockFlagswhere
E: Encoder<X>,
X: CustomValueKind,
source§fn encode_value_kind(&self, encoder: &mut E) -> Result<(), EncodeError>
fn encode_value_kind(&self, encoder: &mut E) -> Result<(), EncodeError>
source§fn encode_body(&self, encoder: &mut E) -> Result<(), EncodeError>
fn encode_body(&self, encoder: &mut E) -> Result<(), EncodeError>
source§impl Extend<LockFlags> for LockFlags
impl Extend<LockFlags> for LockFlags
source§fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = LockFlags>,
fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = LockFlags>,
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<LockFlags> for LockFlags
impl FromIterator<LockFlags> for LockFlags
source§impl Ord for LockFlags
impl Ord for LockFlags
source§impl PartialEq for LockFlags
impl PartialEq for LockFlags
source§impl PartialOrd for LockFlags
impl PartialOrd for LockFlags
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<X> SborTuple<X> for LockFlagswhere
X: CustomValueKind,
impl<X> SborTuple<X> for LockFlagswhere
X: CustomValueKind,
fn get_length(&self) -> usize
source§impl SubAssign for LockFlags
impl SubAssign for LockFlags
source§fn sub_assign(&mut self, other: LockFlags)
fn sub_assign(&mut self, other: LockFlags)
Disables all flags enabled in the set.
impl Copy for LockFlags
impl Eq for LockFlags
impl StructuralPartialEq for LockFlags
Auto Trait Implementations§
impl RefUnwindSafe for LockFlags
impl Send for LockFlags
impl Sync for LockFlags
impl Unpin for LockFlags
impl UnwindSafe for LockFlags
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
self
to type T
. The semantics of numeric casting with the as
operator are followed, so <T as As>::as_::<U>
can be used in the same way as T as U
for numeric conversions. Read moresource§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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.