1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//! Byte-layout marker traits — eunomia's native `Zeroable`/`Pod` vocabulary.
//!
//! These are the datatype-law statement of "which representations are safe to
//! reinterpret as bytes", owned here rather than borrowed from `bytemuck`. They
//! are `unsafe` marker traits (the compiler cannot verify the layout facts they
//! assert); every impl carries a `// SAFETY:` justification, and the scalar
//! wrappers' `const _` size/alignment assertions ([`crate::types`]) pin the
//! layout the impls rely on. The `bytemuck` feature bridges these to
//! `bytemuck::{Pod, Zeroable}` for GPU/FFI boundaries that fix that contract.
use crate;
/// A type whose all-zero bit pattern is a valid, inhabited value.
///
/// # Safety
/// The all-zeroes bit pattern must be a valid value of `Self`. This excludes
/// types with a validity niche at zero (e.g. `NonZeroU32`, `&T`).
pub unsafe
/// Plain-old-data: any bit pattern of `size_of::<Self>()` bytes is a valid
/// `Self`, and the type carries no padding or invalid representations, so it can
/// be freely reinterpreted to and from bytes.
///
/// # Safety
/// - `Self` is inhabited and `Copy`.
/// - Every bit pattern of `size_of::<Self>()` bytes is a valid `Self`.
/// - `Self` contains no padding bytes, no interior mutability, and no pointers
/// or references.
pub unsafe
// Primitive scalars. `bool`/`char` are intentionally excluded — they have
// invalid bit patterns and are therefore not `Pod`.
impl_pod!;
// eunomia scalar wrappers (`#[repr(transparent)]`, layout pinned in `types`).
impl_pod!;
// SAFETY: `Complex<T>` is `#[repr(C)]` with two `T` fields, so its all-zero
// pattern is valid, and it is padding-free plain-old-data, exactly when `T` is.
unsafe
unsafe