generic_const_mappings.rs |
|
2426 |
main.rs |
` files change.
let out_dir = env::var("OUT_DIR").unwrap();
let dest = Path::new(&out_dir).join("consts.rs");
#[cfg(not(feature = "force_unix_path_separator"))]
println!("cargo:rustc-env=TYPENUM_BUILD_CONSTS={}", dest.display());
let mut f = File::create(&dest).unwrap();
no_std();
// Header stuff here!
write!(
f,
"
/**
Type aliases for many constants.
This file is generated by typenum's build script.
For unsigned integers, the format is `U` followed by the number. We define aliases for
- Numbers 0 through {highest}
- Powers of 2 below `u64::MAX`
- Powers of 10 below `u64::MAX`
These alias definitions look like this:
```rust
use typenum::{{B0, B1, UInt, UTerm}};
# #[allow(dead_code)]
type U6 = UInt<UInt<UInt<UTerm, B1>, B1>, B0>;
```
For positive signed integers, the format is `P` followed by the number and for negative
signed integers it is `N` followed by the number. For the signed integer zero, we use
`Z0`. We define aliases for
- Numbers -{highest} through {highest}
- Powers of 2 between `i64::MIN` and `i64::MAX`
- Powers of 10 between `i64::MIN` and `i64::MAX`
These alias definitions look like this:
```rust
use typenum::{{B0, B1, UInt, UTerm, PInt, NInt}};
# #[allow(dead_code)]
type P6 = PInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>>;
# #[allow(dead_code)]
type N6 = NInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>>;
```
# Example
```rust
# #[allow(unused_imports)]
use typenum::{{U0, U1, U2, U3, U4, U5, U6}};
# #[allow(unused_imports)]
use typenum::{{N3, N2, N1, Z0, P1, P2, P3}};
# #[allow(unused_imports)]
use typenum::{{U774, N17, N10000, P1024, P4096}};
```
We also define the aliases `False` and `True` for `B0` and `B1`, respectively.
|
5020 |
op.rs |
|
15463 |
tests.rs |
|
8957 |