pub struct Levels(/* private fields */);Expand description
A score rubric: either a plain count or the text of each level.
The conversions exist so .score("sev", "How bad?", 5) and
.score("sev", "How bad?", ["low", "high"]) both read naturally at the call site.
Implementations§
Source§impl Levels
impl Levels
Sourcepub fn count(count: u32) -> Self
pub fn count(count: u32) -> Self
A rubric of count generated levels. From<u8> covers a literal at the call site; this
takes a count read from somewhere else, so a value too large for any rubric still reaches
the service and is refused there with the bounds, rather than wrapping on the way.
Sourcepub fn labels<S: AsRef<str>>(labels: impl IntoIterator<Item = S>) -> Self
pub fn labels<S: AsRef<str>>(labels: impl IntoIterator<Item = S>) -> Self
A rubric from level texts, lowest first.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Levels
impl RefUnwindSafe for Levels
impl Send for Levels
impl Sync for Levels
impl Unpin for Levels
impl UnsafeUnpin for Levels
impl UnwindSafe for Levels
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more