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ยง
- expect_
into - Converts a value with
TryFromand panics if conversion fails. - ruma_
from_ u64 - Converts a
u64to a Matrix unsigned integer. - ruma_
from_ usize - Converts a
usizeto a Matrix unsigned integer. - try_
into - Converts a value with
TryFromand maps failure to an arithmetic error. - usize_
from_ f64 - Converts a representable nonnegative
f64tousizeby truncating toward zero. - usize_
from_ ruma - Converts a Matrix unsigned integer to
usize. - usize_
from_ u64_ truncated - Converts a
u64tousizewith deliberate truncation when necessary.