size_limit/range_limit/mod.rs
1pub mod serde;
2pub mod limits;
3pub mod range_limit;
4
5pub trait RangeBound: Default {
6 fn match_range(input: usize) -> SizeStatus;
7}
8
9pub enum SizeStatus {
10 Ok,
11 TooLarge(usize),
12 TooSmall(usize),
13 FIxSize(usize),
14 Custom(Box<dyn std::error::Error>),
15}
16
17impl SizeStatus {
18 pub fn custom<E: std::error::Error + 'static>(err: E) -> Self {
19 let b = Box::new(err) as Box<dyn std::error::Error>;
20 Self::Custom(b)
21 }
22}