pub enum ZapParam {
String(String),
ReadOnlyU8Buffer(Arc<Vec<u8>>),
ReadOnlyF32Buffer(Arc<Vec<f32>>),
MutableU8Buffer(Vec<u8>),
MutableF32Buffer(Vec<f32>),
}Variants§
String(String)
An arbitrary string supplied by the user (e.g. JSON encoded). TODO(Paras): I wish I could just put references here, since we end up cloning the string anyways when calling zerde. But then we have to declare many lifetimes - maybe worth it.
ReadOnlyU8Buffer(Arc<Vec<u8>>)
Buffers to pass read-only memory from JS to Rust
ReadOnlyF32Buffer(Arc<Vec<f32>>)
MutableU8Buffer(Vec<u8>)
Buffers to transfer ownership of memory from JS to Rust
MutableF32Buffer(Vec<f32>)
Implementations§
Source§impl ZapParam
impl ZapParam
Sourcepub fn as_u8_slice(&self) -> &[u8] ⓘ
pub fn as_u8_slice(&self) -> &[u8] ⓘ
Borrow contents of ZapParam::MutableU8Buffer or ZapParam::ReadOnlyU8Buffer as &[u8].
Sourcepub fn as_f32_slice(&self) -> &[f32]
pub fn as_f32_slice(&self) -> &[f32]
Borrow contents of ZapParam::MutableF32Buffer or ZapParam::ReadOnlyF32Buffer as &[f32].
Sourcepub fn as_arc_vec_u8(&self) -> Arc<Vec<u8>>
pub fn as_arc_vec_u8(&self) -> Arc<Vec<u8>>
Get contents of ZapParam::ReadOnlyU8Buffer, without having to consume it.
Sourcepub fn as_arc_vec_f32(&self) -> Arc<Vec<f32>>
pub fn as_arc_vec_f32(&self) -> Arc<Vec<f32>>
Get contents of ZapParam::ReadOnlyU8Buffer, without having to consume it.
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Get contents of ZapParam::String, consuming it.
Sourcepub fn into_vec_u8(self) -> Vec<u8> ⓘ
pub fn into_vec_u8(self) -> Vec<u8> ⓘ
Get contents of ZapParam::MutableU8Buffer, consuming it.
Sourcepub fn into_vec_f32(self) -> Vec<f32>
pub fn into_vec_f32(self) -> Vec<f32>
Get contents of ZapParam::MutableF32Buffer, consuming it.