NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io · #2676 most downloaded on crates.io
Choose types at compile-time via boolean constants.
Last release 3 years ago
no release in 18 months
Ships fairly regularly
a new release about every 2 months
Nearly every release is documented
notes for 4 of 4 stable releases
Nothing withdrawn
no release was ever pulled
3 years old
4 releases · first in 2023
One column per quarter.
Adds num module containing conditional aliases to numeric types.
Adds num module containing conditional aliases to numeric types.
use std::fs::File;
use condtype::num::Usize64;
fn handle_throughput(bytes: Usize64) {
// ...
}
// usize
let s: &str = // ...
handle_throughput(s.len() as Usize64);
// u64
let f: File = // ...
handle_throughput(f.metadata()?.len() as Usize64);num module containing conditional aliases to numeric types.Adds if let pattern matching to the condval! macro.
Adds if let pattern matching to the condval! macro.
const STR: Option<&str> = // ...
let val = condval!(if let Some(str) = STR {
str.to_uppercase()
} else {
42
});Introduces the condval! macro to instantiate a conditionally-typed value.
Introduces the condval! macro to instantiate a conditionally-typed value.
Attempting to return different types from if/else is not normally possible since both branches must produce the same type:
let val = if true { "hello" } else { 42 };This macro enables returning different types by making the type be conditional on a const bool:
use condtype::condval;
let val: &str = condval!(if true { "hello" } else { 42 });
let val: i32 = condval!(if false { "hello" } else { 42 });condval!] macro to construct [conditionally-typed][CondType] values.Introduces the CondType type alias.
CondType type alias that is determined by a boolean condition,
just like std::conditional_t in C++.Your coding agent can read these notes before it upgrades. Set up the MCP server →