Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

Latest commit

 

History

History
50 lines (33 loc) · 1.29 KB

README.md

File metadata and controls

50 lines (33 loc) · 1.29 KB

🪪 idtype

Maintenance

idtype provides convenient macros to use the newtype pattern to generate types for identifiers.

Usage

The crate provides three macros to generate identifier types:

  • id! can be used for numerical ids
  • name! can be used for unique usernames or string-based ids
  • secret! can be used for sensitive strings like passwords

The generated types implement a few common traits so that they can be easily converted from and to their inner types.

use idtype::id;

id!(
    /// A numeric id
    Id
);

fn main() {
    let id: Id = 42.into();
}

Check out the crate's documentation for more information.

License

Licensed under either 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 dual licensed as above, without any additional terms or conditions.