#[non_exhaustive]pub enum WasmArg {
I32(i32),
I64(i64),
F32(f32),
F64(f64),
}Expand description
A typed Wasm value supplied to TensorWasmExecutor::call_export_with_args.
Mirrors the four core wasm value types (i32, i64, f32, f64). Held
Copy so callers can clone an argument list cheaply when retrying. Marked
#[non_exhaustive] so additional value types (e.g. v128, reference
types) can be added in a future minor release without breaking the
match-arm count on downstream code.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
I32(i32)
A 32-bit signed integer argument.
I64(i64)
A 64-bit signed integer argument.
F32(f32)
A 32-bit IEEE-754 float argument.
F64(f64)
A 64-bit IEEE-754 float argument.
Implementations§
Source§impl WasmArg
impl WasmArg
Sourcepub fn from_json(v: &Value) -> Result<Self, &'static str>
pub fn from_json(v: &Value) -> Result<Self, &'static str>
Convert a serde_json::Value into the closest-fitting WasmArg
variant.
Integer literals that fit in i32 become WasmArg::I32; larger
integers become WasmArg::I64; non-integer numerics become
WasmArg::F64. Any non-numeric value is rejected with an error
string suitable for forwarding into a user-facing CLI / HTTP error.
f32 cannot be selected from JSON unambiguously — callers needing a
32-bit float should construct WasmArg::F32 directly.
Trait Implementations§
impl Copy for WasmArg
impl StructuralPartialEq for WasmArg
Auto Trait Implementations§
impl Freeze for WasmArg
impl RefUnwindSafe for WasmArg
impl Send for WasmArg
impl Sync for WasmArg
impl Unpin for WasmArg
impl UnsafeUnpin for WasmArg
impl UnwindSafe for WasmArg
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more