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