PodOnce

Trait PodOnce 

Source
pub trait PodOnce: Pod { }
Expand description

A marker trait for POD types that can be read or written with one instruction.

We currently rely on this trait to ensure that the memory operation created by ptr::read_volatile and ptr::write_volatile doesn’t tear. However, the Rust documentation makes no such guarantee, and even the wording in the LLVM LangRef is ambiguous.

At this point, we can only hope that this doesn’t break in future versions of the Rust or LLVM compilers. However, this is unlikely to happen in practice, since the Linux kernel also uses “volatile” semantics to implement READ_ONCE/WRITE_ONCE.

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.

Implementors§