2 releases
0.1.7 | Jan 20, 2020 |
---|---|
0.1.6 |
|
0.1.1 |
|
#24 in #attribute
45 downloads per month
Used in 3 crates
(via high_mem_utils)
10KB
167 lines
fast_new_type
This crate serves the purporse of implement Deref
,DerefMut
,AsRef
,AsMut
and From
in new
types,either for the first value of a struct,the "value" or "slot" field or the specified in the attribute.
With default-features = false
you can opt-out of the From
impl which in some cases is not desirable.
This crate is no_std.
Usage
use fast_new_type::new_type;
#[new_type]
struct FirstField(u32, u16);
#[new_type]
struct ValueField {
value: u16,
other_meta: u16,
}
#[new_type]
struct SlotField {
slot: u16,
other_meta: u16,
}
#[new_type(other)]
struct SpecField {
other: u16,
other_meta: u16,
}
License
This code is licensed under the Unlicense.
Dependencies
~85KB