1#![cfg_attr(
8 not(test),
9 deny(
10 clippy::unwrap_used,
11 clippy::unreachable,
12 clippy::expect_used,
13 clippy::panic,
14 clippy::unimplemented,
15 clippy::todo
16 )
17)]
18
19pub mod avatar;
20pub mod backoff;
21pub mod bool_like;
22pub mod fs;
23pub mod html;
24pub mod http_range;
25pub mod http_validators;
26pub mod id;
27pub mod net;
28pub mod numbers;
29pub mod paths;
30pub mod raii;
31pub mod text;
32pub mod url;
33
34pub type Result<T> = std::result::Result<T, UtilsError>;
36
37#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
39pub enum UtilsError {
40 #[error("{0}")]
42 InvalidValue(String),
43 #[error("{0}")]
45 NumericConversion(String),
46}
47
48impl UtilsError {
49 pub fn invalid_value(message: impl Into<String>) -> Self {
51 Self::InvalidValue(message.into())
52 }
53
54 pub fn numeric_conversion(message: impl Into<String>) -> Self {
56 Self::NumericConversion(message.into())
57 }
58}