Support for deriving traits found in uncon.
Usage
This crate is available on crates.io and can be used by adding the
following to your project's Cargo.toml:
[]
= "1.1.0"
= "1.1.0"
and this to your crate root:
extern crate uncon_derive;
extern crate uncon;
#
Examples
The FromUnchecked trait can be derived for:
- Structs with a single field
- C-like enums with
#[repr]attribute
# extern crate core;
# extern crate static_assertions;
# extern crate uncon_derive;
# extern crate uncon;
# use *;
#
#
// `usize` and `isize` also supported:
#
Options
-
Derive
FromUncheckedfor other types:- Done via
#[uncon(other(...))]. - Derives
FromUncheckedwith each type listed via anascast to the inner or representative type.
- Done via
-
Derive
From:- Done via
#[uncon(from_impl)]. - Only for C-like enums such that no variant is assigned a discriminant.
- Done via