Struct soroban_env_guest::Static
source · [−]pub struct Static(_);
Expand description
Wrapper for a RawVal that is tagged with Tag::Static, interpreting the RawVal’s body as a 32-bit value from a reserved set of “static” values corresponding to the enumerated cases of ScStatic.
Implementations
Trait Implementations
sourceimpl RawValConvertible for Static
impl RawValConvertible for Static
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) -> Static
unsafe fn unchecked_from_val(v: RawVal) -> Static
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 more
sourcefn 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 more
sourceimpl<E> TryFromVal<E, RawVal> for Staticwhere
E: Env,
impl<E> TryFromVal<E, RawVal> for Staticwhere
E: Env,
type Error = ConversionError
fn try_from_val(
_env: &E,
val: RawVal
) -> Result<Static, <Static as TryFromVal<E, RawVal>>::Error>
sourceimpl<E> TryFromVal<E, Static> for ()where
E: Env,
impl<E> TryFromVal<E, Static> for ()where
E: Env,
type Error = ConversionError
fn try_from_val(
_env: &E,
val: Static
) -> Result<(), <() as TryFromVal<E, Static>>::Error>
sourceimpl<E> TryFromVal<E, Static> for boolwhere
E: Env,
impl<E> TryFromVal<E, Static> for boolwhere
E: Env,
type Error = ConversionError
fn try_from_val(
_env: &E,
val: Static
) -> Result<bool, <bool as TryFromVal<E, Static>>::Error>
sourceimpl<E> TryIntoVal<E, RawVal> for Staticwhere
E: Env,
impl<E> TryIntoVal<E, RawVal> for Staticwhere
E: Env,
type Error = ConversionError
fn try_into_val(
self,
_env: &E
) -> Result<RawVal, <Static as TryIntoVal<E, RawVal>>::Error>
fn try_into_env_val(self, env: &E) -> Result<EnvVal<E, V>, Self::Error>
sourceimpl<E> TryIntoVal<E, Static> for RawValwhere
E: Env,
impl<E> TryIntoVal<E, Static> for RawValwhere
E: Env,
type Error = ConversionError
fn try_into_val(
self,
env: &E
) -> Result<Static, <RawVal as TryIntoVal<E, Static>>::Error>
fn try_into_env_val(self, env: &E) -> Result<EnvVal<E, V>, Self::Error>
impl Copy for Static
impl Val for Static
Auto Trait Implementations
impl RefUnwindSafe for Static
impl Send for Static
impl Sync for Static
impl Unpin for Static
impl UnwindSafe for Static
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