Expand description
Arithmetic checking and numeric conversion helpers.
Exported macros separate recoverable, expected, and prevalidated arithmetic. Conversion helpers centralize errors, panics, and deliberate truncation.
Modulesยง
- expect_
into ๐ - expected ๐
- tried ๐
Macrosยง
- checked_
ops - Transforms arithmetic expressions into checked operations.
Constantsยง
- USIZE_
MAX_ ๐EXCLUSIVE
Traitsยง
- Expect
Into - Converts values with
TryFromand panics on failure. - Expected
- Adds checked arithmetic methods that panic on failure.
- Tried
- Adds checked arithmetic methods that return a
Result.
Functionsยง
- effective_
cap - Combines per-call and configuration concurrency caps.
- expect_
into - Converts a value with
TryFromand panics if conversion fails. - fetch_
add_ usize - Adds a
usizecount to an atomicu64counter, saturating the count atu64::MAX. - ruma_
from_ u64 - Converts a
u64to a Matrix unsigned integer. - ruma_
from_ usize - Converts a
usizeto a Matrix unsigned integer. - ruma_
from_ usize_ saturating - Converts a
usizeto a Matrix unsigned integer, saturating at the largest value [UInt] supports. - try_
into - Converts a value with
TryFromand maps failure to an arithmetic error. - u64_
from_ u128_ saturating - Converts a
u128tou64, saturating atu64::MAX. - u64_
from_ usize_ saturating - Converts a
usizetou64, saturating atu64::MAX. - usize_
from_ f64 - Converts a representable nonnegative
f64tousizeby truncating toward zero. - usize_
from_ ruma - Converts a Matrix unsigned integer to
usize. - usize_
from_ ruma_ bounded - Converts a Matrix unsigned integer to a bounded
usize. - usize_
from_ u64_ truncated - Converts a
u64tousizewith deliberate truncation when necessary.