Struct soroban_env_common::BitSet
source · pub struct BitSet(_);
Expand description
Wrapper for a RawVal that is tagged with Tag::BitSet, interpreting the RawVal’s body as a small bitset (60-bits or fewer).
Implementations§
source§impl BitSet
impl BitSet
sourcepub const fn try_from_u64(u: u64) -> Result<BitSet, BitSetError>
pub const fn try_from_u64(u: u64) -> Result<BitSet, BitSetError>
Attempt to construct a BitSet from a u64, succeeding only if the most significant 4 bits of the u64 are clear. In other words, this function accepts only “small” bitsets of 60 or fewer bits.
pub const fn to_u64(&self) -> u64
Trait Implementations§
source§impl Ord for BitSet
impl Ord for BitSet
source§impl PartialEq<BitSet> for BitSet
impl PartialEq<BitSet> for BitSet
source§impl PartialOrd<BitSet> for BitSet
impl PartialOrd<BitSet> for BitSet
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl RawValConvertible for BitSet
impl RawValConvertible for BitSet
source§fn is_val_type(v: RawVal) -> bool
fn is_val_type(v: RawVal) -> bool
Returns
true
if v
is in a union state compatible with Self
.source§unsafe fn unchecked_from_val(v: RawVal) -> Self
unsafe fn unchecked_from_val(v: RawVal) -> Self
Converts the bits making up a
RawVal
into Self
without checking
that the RawVal
is tagged correctly, assuming that such a check has
been performed elsewhere. It is the caller’s responsibility to arrange
that such checks have occurred before calling unchecked_from_val
,
which is why it is marked as unsafe
(it does not represent a risk of
memory-unsafety, merely “serious logic errors”).source§fn try_convert(v: RawVal) -> Option<Self>
fn try_convert(v: RawVal) -> Option<Self>
Attempt a conversion from
RawVal
to Self
, returning None
if the
provided RawVal
is not tagged correctly. By default this calls
Self::is_val_type
and Self::unchecked_from_val
, but it can be
customized on a type-by-type basis to avoid redundant tag tests and
produce more efficient code, as it is done for Static
values like
bool
.source§impl<E: Env> TryFromVal<E, RawVal> for BitSet
impl<E: Env> TryFromVal<E, RawVal> for BitSet
type Error = ConversionError
fn try_from_val(_env: &E, val: RawVal) -> Result<Self, Self::Error>
source§impl<E: Env> TryIntoVal<E, BitSet> for RawVal
impl<E: Env> TryIntoVal<E, BitSet> for RawVal
type Error = ConversionError
fn try_into_val(self, env: &E) -> Result<BitSet, Self::Error>
source§impl<E: Env> TryIntoVal<E, RawVal> for BitSet
impl<E: Env> TryIntoVal<E, RawVal> for BitSet
type Error = ConversionError
fn try_into_val(self, _env: &E) -> Result<RawVal, Self::Error>
impl Copy for BitSet
impl Eq for BitSet
impl Val for BitSet
Auto Trait Implementations§
impl RefUnwindSafe for BitSet
impl Send for BitSet
impl Sync for BitSet
impl Unpin for BitSet
impl UnwindSafe for BitSet
Blanket Implementations§
§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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.