pub struct DecodedMessage { /* private fields */ }Expand description
Handle to a decoded Tensogram message.
Owns the decoded payload data in WASM linear memory. Use the
object_data_* methods to get zero-copy TypedArray views.
Important: The returned TypedArray views are invalidated if WASM
memory grows. Read or copy the data before further WASM calls.
Call .free() when done to release WASM memory.
Implementations§
Source§impl DecodedMessage
impl DecodedMessage
Sourcepub fn metadata(&self) -> Result<JsValue, JsValue>
pub fn metadata(&self) -> Result<JsValue, JsValue>
Global metadata as a plain JS object. The wire-format
version is synthesised from the preamble (v3: always 3)
for TypeScript ergonomics — see metadata_to_js in
convert.rs.
Sourcepub fn object_count(&self) -> usize
pub fn object_count(&self) -> usize
Number of data objects in the message.
Sourcepub fn object_descriptor(&self, index: usize) -> Result<JsValue, JsValue>
pub fn object_descriptor(&self, index: usize) -> Result<JsValue, JsValue>
Object descriptor (shape, dtype, encoding, etc.) as a JS object.
Sourcepub fn object_data_f32(&self, index: usize) -> Result<Float32Array, JsValue>
pub fn object_data_f32(&self, index: usize) -> Result<Float32Array, JsValue>
Zero-copy Float32Array view into the decoded payload.
Warning: This view points directly into WASM linear memory. It becomes invalid if WASM memory grows. Read the data or pass it to WebGL before any further WASM calls.
Sourcepub fn object_data_f64(&self, index: usize) -> Result<Float64Array, JsValue>
pub fn object_data_f64(&self, index: usize) -> Result<Float64Array, JsValue>
Zero-copy Float64Array view.
Sourcepub fn object_data_i32(&self, index: usize) -> Result<Int32Array, JsValue>
pub fn object_data_i32(&self, index: usize) -> Result<Int32Array, JsValue>
Zero-copy Int32Array view.
Sourcepub fn object_data_u8(&self, index: usize) -> Result<Uint8Array, JsValue>
pub fn object_data_u8(&self, index: usize) -> Result<Uint8Array, JsValue>
Zero-copy Uint8Array view.
Sourcepub fn object_data_copy_f32(
&self,
index: usize,
) -> Result<Float32Array, JsValue>
pub fn object_data_copy_f32( &self, index: usize, ) -> Result<Float32Array, JsValue>
Safe-copy Float32Array (JS-heap owned, survives WASM memory growth).
Trait Implementations§
Source§impl From<DecodedMessage> for JsValue
impl From<DecodedMessage> for JsValue
Source§fn from(value: DecodedMessage) -> Self
fn from(value: DecodedMessage) -> Self
Source§impl FromWasmAbi for DecodedMessage
impl FromWasmAbi for DecodedMessage
Source§impl IntoWasmAbi for DecodedMessage
impl IntoWasmAbi for DecodedMessage
Source§impl LongRefFromWasmAbi for DecodedMessage
impl LongRefFromWasmAbi for DecodedMessage
Source§impl OptionFromWasmAbi for DecodedMessage
impl OptionFromWasmAbi for DecodedMessage
Source§impl OptionIntoWasmAbi for DecodedMessage
impl OptionIntoWasmAbi for DecodedMessage
Source§impl RefFromWasmAbi for DecodedMessage
impl RefFromWasmAbi for DecodedMessage
Source§type Anchor = RcRef<DecodedMessage>
type Anchor = RcRef<DecodedMessage>
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl RefMutFromWasmAbi for DecodedMessage
impl RefMutFromWasmAbi for DecodedMessage
Source§impl TryFromJsValue for DecodedMessage
impl TryFromJsValue for DecodedMessage
Source§impl VectorFromWasmAbi for DecodedMessage
impl VectorFromWasmAbi for DecodedMessage
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[DecodedMessage]>
Source§impl VectorIntoWasmAbi for DecodedMessage
impl VectorIntoWasmAbi for DecodedMessage
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[DecodedMessage]>) -> Self::Abi
Source§impl WasmDescribeVector for DecodedMessage
impl WasmDescribeVector for DecodedMessage
impl SupportsConstructor for DecodedMessage
impl SupportsInstanceProperty for DecodedMessage
impl SupportsStaticProperty for DecodedMessage
Auto Trait Implementations§
impl Freeze for DecodedMessage
impl RefUnwindSafe for DecodedMessage
impl Send for DecodedMessage
impl Sync for DecodedMessage
impl Unpin for DecodedMessage
impl UnsafeUnpin for DecodedMessage
impl UnwindSafe for DecodedMessage
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> 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> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.