Skip to content

Commit

Permalink
add size assert
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleg Piletskiy committed Nov 14, 2024
1 parent d3e6494 commit c3db3a3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ pub struct SizeParams {
}

impl SizeParams {
/// Creates a new instance of `SizeParams` struct.
///
/// Panics if not (min <= avg && avg <= max && min <= max).
pub fn new(min: usize, avg: usize, max: usize) -> Self {
assert!(min <= avg && avg <= max && min <= max);

Self { min, avg, max }
}

Expand Down

0 comments on commit c3db3a3

Please sign in to comment.