mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-03 17:52:12 +01:00
Panic for limit=0
This commit is contained in:
parent
612f47d242
commit
b29d60657f
1 changed files with 3 additions and 2 deletions
|
@ -52,10 +52,11 @@ where
|
||||||
///
|
///
|
||||||
/// ## Panics
|
/// ## Panics
|
||||||
///
|
///
|
||||||
/// If `limit` is greater than 100.
|
/// If `limit` is 0 or greater than 100.
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
pub fn limit(self, limit: u8) -> Self {
|
pub fn limit(self, limit: u8) -> Self {
|
||||||
assert!(limit <= 100, "Maximum limit is 100");
|
assert_ne!(limit, 0, "limit can't be 0");
|
||||||
|
assert!(limit <= 100, "maximum limit is 100, can't set limit to `{limit}`");
|
||||||
|
|
||||||
Self { limit: Some(limit), ..self }
|
Self { limit: Some(limit), ..self }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue