pub trait ArrayElement: Copy + 'static {
// Required methods
fn dtype_id() -> u8;
fn element_size() -> usize;
fn from_le_bytes_slice(bytes: &[u8], n: usize) -> Vec<Self>;
fn to_le_bytes_vec(slice: &[Self]) -> Vec<u8> ⓘ;
}Expand description
Element type supported by the .scirs2 array payload.
Each concrete type carries a stable 1-byte dtype_id embedded in the file,
enabling typed deserialization and cross-language interoperability.
§Dtype IDs
| ID | Type |
|---|---|
| 1 | f32 |
| 2 | f64 |
| 3 | i32 |
| 4 | i64 |
| 5 | u32 |
| 6 | u64 |
Required Methods§
Sourcefn element_size() -> usize
fn element_size() -> usize
Size in bytes of one element.
Sourcefn from_le_bytes_slice(bytes: &[u8], n: usize) -> Vec<Self>
fn from_le_bytes_slice(bytes: &[u8], n: usize) -> Vec<Self>
Deserialize n elements from a little-endian byte slice.
Sourcefn to_le_bytes_vec(slice: &[Self]) -> Vec<u8> ⓘ
fn to_le_bytes_vec(slice: &[Self]) -> Vec<u8> ⓘ
Serialize a slice of elements to little-endian bytes.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.