fast_new_type

Crates.iofast_new_type
lib.rsfast_new_type
version0.1.7
sourcesrc
created_at2019-12-22 06:12:03.238429
updated_at2020-01-20 09:56:44.948609
descriptionA proc_macro attribute to implement common traits for a custom type wrapping other.
homepage
repositoryhttps://github.com/NonNullableName/fast_new_type/
max_upload_size
id191398
size10,793
Santino (IronThread)

documentation

README

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.

Commit count: 0

cargo fmt