Enum soroban_wasmi::Value
source · pub enum Value {
I32(i32),
I64(i64),
F32(F32),
F64(F64),
FuncRef(FuncRef),
ExternRef(ExternRef),
}
Expand description
Runtime representation of a value.
Wasm code manipulate values of the four basic value types: integers and floating-point (IEEE 754-2008) data of 32 or 64 bit width each, respectively.
There is no distinction between signed and unsigned integer types. Instead, integers are interpreted by respective operations as either unsigned or signed in two’s complement representation.
Variants§
I32(i32)
Value of 32-bit signed or unsigned integer.
I64(i64)
Value of 64-bit signed or unsigned integer.
F32(F32)
Value of 32-bit IEEE 754-2008 floating point number.
F64(F64)
Value of 64-bit IEEE 754-2008 floating point number.
FuncRef(FuncRef)
ExternRef(ExternRef)
A nullable external object reference, a.k.a. ExternRef
.
Implementations§
source§impl Value
impl Value
sourcepub fn i32(&self) -> Option<i32>
pub fn i32(&self) -> Option<i32>
Returns the underlying i32
if the type matches otherwise returns None
.
sourcepub fn i64(&self) -> Option<i64>
pub fn i64(&self) -> Option<i64>
Returns the underlying i64
if the type matches otherwise returns None
.
sourcepub fn f32(&self) -> Option<F32>
pub fn f32(&self) -> Option<F32>
Returns the underlying f32
if the type matches otherwise returns None
.
sourcepub fn f64(&self) -> Option<F64>
pub fn f64(&self) -> Option<F64>
Returns the underlying f64
if the type matches otherwise returns None
.
Trait Implementations§
source§impl From<Value> for UntypedValue
impl From<Value> for UntypedValue
Auto Trait Implementations§
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
Blanket Implementations§
source§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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
&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)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.