Struct soroban_env_guest::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
sourceimpl 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
sourceimpl Ord for BitSet
impl Ord for BitSet
1.21.0 · sourcefn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialOrd<BitSet> for BitSet
impl PartialOrd<BitSet> for BitSet
sourcefn partial_cmp(&self, other: &BitSet) -> Option<Ordering>
fn partial_cmp(&self, other: &BitSet) -> Option<Ordering>
1.0.0 · sourcefn 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 moresourceimpl RawValConvertible for BitSet
impl RawValConvertible for BitSet
sourcefn 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
.sourceunsafe fn unchecked_from_val(v: RawVal) -> BitSet
unsafe fn unchecked_from_val(v: RawVal) -> BitSet
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”). Read moresourcefn 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
. Read moresourceimpl<E> TryFromVal<E, RawVal> for BitSetwhere
E: Env,
impl<E> TryFromVal<E, RawVal> for BitSetwhere
E: Env,
type Error = ConversionError
fn try_from_val(
_env: &E,
val: RawVal
) -> Result<BitSet, <BitSet as TryFromVal<E, RawVal>>::Error>
sourceimpl<E> TryIntoVal<E, BitSet> for RawValwhere
E: Env,
impl<E> TryIntoVal<E, BitSet> for RawValwhere
E: Env,
type Error = ConversionError
fn try_into_val(
self,
env: &E
) -> Result<BitSet, <RawVal as TryIntoVal<E, BitSet>>::Error>
fn try_into_env_val(self, env: &E) -> Result<EnvVal<E, V>, Self::Error>
sourceimpl<E> TryIntoVal<E, RawVal> for BitSetwhere
E: Env,
impl<E> TryIntoVal<E, RawVal> for BitSetwhere
E: Env,
type Error = ConversionError
fn try_into_val(
self,
_env: &E
) -> Result<RawVal, <BitSet as TryIntoVal<E, RawVal>>::Error>
fn try_into_env_val(self, env: &E) -> Result<EnvVal<E, V>, 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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more