Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.
/ typic Public archive

Type-safe transmutations between layout-compatible types.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

jswrenn/typic

Repository files navigation

ANNOUNCEMENT: The primary purpose of Typic was to prototype zero-compromise designs for a safe transmute language feature. Read the resulting RFC draft here!


Typic

Typic helps you transmute fearlessly. It worries about the subtleties of soundness and safety so you don't have to!

Documentation Crates.io

Just import it and replace your #[repr(...)] attributes with #[typic::repr(...)]:

// Import it!
use typic::{self, TransmuteInto};

// Update your attributes!
#[typic::repr(C)]
pub struct Foo(pub u8, pub u16);

// Transmute fearlessly!
let _ : Foo = u32::default().transmute_into(); // Alchemy achieved!
let _ : u32 = Foo::default().transmute_into(); // Compiler Error!

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

Type-safe transmutations between layout-compatible types.

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages