Skip to main content

MmapElement

Trait MmapElement 

Source
pub trait MmapElement:
    Copy
    + Pod
    + Zeroable
    + 'static {
    // Required methods
    fn dtype_id() -> u8;
    fn element_size() -> usize;
}
Expand description

Types that can be stored in a memory-mapped file.

Implementors must be:

  • Copy — trivially duplicable, no heap ownership
  • bytemuck::Pod — safe for byte-level reinterpretation
  • bytemuck::Zeroable — a zero-initialized value is valid
  • 'static — no borrowed references

Required Methods§

Source

fn dtype_id() -> u8

Unique byte tag written to the file header identifying this type.

Source

fn element_size() -> usize

Size of a single element in 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.

Implementations on Foreign Types§

Source§

impl MmapElement for f32

Source§

impl MmapElement for f64

Source§

impl MmapElement for i32

Source§

impl MmapElement for i64

Implementors§