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

Easily generate strong types for identifiers

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

devxbots/idtype

Repository files navigation

🪪 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.

About

Easily generate strong types for identifiers

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages