add math utils; integrate checked expression macros

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-07-07 03:36:50 +00:00
parent 611f09829e
commit 5e72d36800
7 changed files with 68 additions and 0 deletions

View file

@ -35,6 +35,12 @@ pub enum Error {
FromUtf8Error(#[from] std::string::FromUtf8Error),
#[error("{0}")]
TryFromSliceError(#[from] std::array::TryFromSliceError),
#[error("{0}")]
TryFromIntError(#[from] std::num::TryFromIntError),
#[error("{0}")]
ParseIntError(#[from] std::num::ParseIntError),
#[error("{0}")]
ParseFloatError(#[from] std::num::ParseFloatError),
// third-party
#[error("Regex error: {0}")]
@ -63,6 +69,8 @@ pub enum Error {
InconsistentRoomState(&'static str, ruma::OwnedRoomId),
// conduwuit
#[error("Arithmetic operation failed: {0}")]
Arithmetic(&'static str),
#[error("There was a problem with your configuration: {0}")]
BadConfig(String),
#[error("{0}")]