#repr #transmute #cast #as #no-alloc

no-std as_repr

Rust trait for constant #[repr(T)] conversions

5 stable releases

Uses new Rust 2024

1.3.0 Jan 3, 2026
1.2.0 Nov 2, 2025
1.1.0 Nov 2, 2025
1.0.1 Oct 27, 2025

#1054 in Rust patterns

Download history 594/week @ 2025-10-21 417/week @ 2025-10-28 144/week @ 2025-11-04 327/week @ 2025-11-25 1/week @ 2025-12-02 358/week @ 2025-12-16 1/week @ 2025-12-23 1034/week @ 2025-12-30 239/week @ 2026-01-06 67/week @ 2026-01-13 672/week @ 2026-01-20 159/week @ 2026-01-27 1117/week @ 2026-02-03

2,028 downloads per month
Used in ranch

Apache-2.0 OR BSL-1.0 OR MIT

12KB
102 lines

As Repr

tests GitHub commit activity GitHub contributors
Crates.io Crates.io Crates.io (recent)
Crates.io Docs.rs

Rust trait for constant #[repr(T)] conversions

Check out the documentation for examples.

Features

  • Const trait workaround for stable Rust exposing a safe transmute to the repr type with a trait

MSRV

The current MSRV is Rust 1.85.

Any future MSRV updates will follow the Ardaku MSRV guidelines.

License

Copyright © 2025-2026 The As Repr Contributors.

Licensed under any of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as described above, without any additional terms or conditions.

Help

If you want help using or contributing to this library, feel free to send me an email at aldaronlau@gmail.com.

No runtime deps