MemoryMappable

Trait MemoryMappable 

Source
pub unsafe trait MemoryMappable { }
Expand description

Trait for types that can be stored into a MemoryMappedVmo.

§Safety

  • In general, since VMOs can be received from potentially hostile processes, types that implement this trait must be prepared to handle any possible sequence of bytes safely.
  • They must not contain references/pointers, as they are useless across process boundaries.

These requirements are similar to zerocopy::FromBytes, but we define our own trait because zerocopy’s FromBytes derive macro does not accept some types that we know that, in the way we use them, can be stored safely. Having our own trait makes it possible to mark such types as MemoryMappable.

Implementations on Foreign Types§

Source§

impl MemoryMappable for u8

Source§

impl MemoryMappable for u16

Source§

impl MemoryMappable for u32

Source§

impl MemoryMappable for u64

Source§

impl<T: MemoryMappable> MemoryMappable for [T]

Source§

impl<T: MemoryMappable, const N: usize> MemoryMappable for [T; N]

Implementors§