Marker traits for primitive types
This crate provides marker traits for primitive types:
Example
Cargo.toml
## ...
[]
= { = "0.1.0" }
## ...
[]
## https://doc.rust-lang.org/beta/unstable-book/language-features/marker-trait-attr.html
= ["just_prim/marker_trait_attr"]
src/main.rs
// Uncomment if you want to conditionally use the feature. Remove otherwise.
// #![cfg_attr(feature = "marker_trait_attr", feature(marker_trait_attr))]
use Prim;
Building, running, and testing
cargo build <other options> --features marker_trait_attrif you want the feature andcargo build <other options>otherwise;cargo run<other options> --features marker_trait_attrif you want the feature andcargo build <other options>otherwise;cargo test <other options> --features marker_trait_attrif you want the feature andcargo test <other options>otherwise.
Features
With marker_trait_attr Nightly feature, each of the provided traits also has #[marker] attribute which allows more optimal implementation of traits via two or more "overlapping" generic impl blocks. Without #[marker] attribute, the "overlapping" impl blocks would be conflicting.
Similar crates by the author:
epui- Equisized (primitive) unsigned ints for primitive ints: u8 for u8, u16 for i16, etcepsi- Equisized (primitive) signed ints for primitive intsprimitive_promotion- Primitive promotions for primitive numeric types: u16 for u8, i32 for i16, f64 for f32, etcis_signed_trait- Trait forIS_SIGNEDassociated constantmax_len_base_10_as_usize- Trait offering constant maximum lengths of primitive integers as usizemin_max_traits- Traits forMINandMAXassociated constants- as well as others that can be found on crates.io