pub struct Coverage { /* private fields */ }
Implementations§
Source§impl Coverage
impl Coverage
pub fn max(&self) -> &i32
pub fn tiers(&self) -> &BTreeMap<i32, IntSpan>
pub fn new(max: i32) -> Self
pub fn new_len(max: i32, len: i32) -> Self
Sourcepub fn bump(&mut self, begin: i32, end: i32)
pub fn bump(&mut self, begin: i32, end: i32)
let mut cover = Coverage::new(1);
cover.bump(1, 100);
cover.bump(90, 150);
assert_eq!(cover.tiers().get(&1).unwrap().to_string(), "1-150");
let mut cover = Coverage::new_len(1, 500);
cover.bump(1, 100);
cover.bump(90, 150);
assert_eq!(cover.tiers().get(&1).unwrap().to_string(), "1-150");
Sourcepub fn max_tier(&self) -> IntSpan
pub fn max_tier(&self) -> IntSpan
let mut cover = Coverage::new(2);
cover.bump(1, 100);
cover.bump(90, 150);
assert_eq!(cover.max_tier().to_string(), "90-100");
let mut cover = Coverage::new(5);
cover.bump(1, 100);
cover.bump(90, 150);
assert_eq!(cover.max_tier().to_string(), "-");
Sourcepub fn uniq_tiers(&self) -> BTreeMap<i32, IntSpan>
pub fn uniq_tiers(&self) -> BTreeMap<i32, IntSpan>
let mut cover = Coverage::new(2);
cover.bump(1, 100);
cover.bump(90, 150);
assert_eq!(cover.uniq_tiers().get(&2).unwrap().to_string(), "90-100");
assert_eq!(cover.tiers().get(&1).unwrap().to_string(), "1-150");
assert_eq!(cover.uniq_tiers().get(&1).unwrap().to_string(), "1-89,101-150");
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Coverage
impl RefUnwindSafe for Coverage
impl Send for Coverage
impl Sync for Coverage
impl Unpin for Coverage
impl UnwindSafe for Coverage
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more