Skip to content

AldaronLau/as_repr

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
  • Optionally-enabled const trait workarounds for generic integer and float operations and comparisons on the inherent representation
    • inherent: Providing AsReprInherent built on AsRepr but chooses a specific representation to interpret as for const operations
    • cmp: Providing const fns generic for comparable types
    • float: Providing const fns generic for floating point types
    • int: Providing const fns generic for integer types
    • num: Providing const fns generic for numeric types (floats and ints)
    • ops: Providing const fns generic for mathematical types (numeric types and Durations)

MSRV

The current MSRV is Rust 1.91.

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.

About

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

Resources

License

Apache-2.0 and 2 other licenses found

Licenses found

Apache-2.0
LICENSE_APACHE
BSL-1.0
LICENSE_BOOST
MIT
LICENSE_MIT

Code of conduct

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages