Trait zebra_test::prelude::prop::bits::BitSetLike

pub trait BitSetLike: Clone + Debug {
    // Required methods
    fn new_bitset(max: usize) -> Self;
    fn len(&self) -> usize;
    fn test(&self, ix: usize) -> bool;
    fn set(&mut self, ix: usize);
    fn clear(&mut self, ix: usize);

    // Provided method
    fn count(&self) -> usize { ... }
}
Expand description

Trait for types which can be handled with BitSetStrategy.

Required Methods§

fn new_bitset(max: usize) -> Self

Create a new value of Self with space for up to max bits, all initialised to zero.

fn len(&self) -> usize

Return an upper bound on the greatest bit set plus one.

fn test(&self, ix: usize) -> bool

Test whether the given bit is set.

fn set(&mut self, ix: usize)

Set the given bit.

fn clear(&mut self, ix: usize)

Clear the given bit.

Provided Methods§

fn count(&self) -> usize

Return the number of bits set.

This has a default for backwards compatibility, which simply does a linear scan through the bits. Implementations are strongly encouraged to override this.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

§

impl BitSetLike for i8

§

fn new_bitset(_: usize) -> i8

§

fn len(&self) -> usize

§

fn test(&self, ix: usize) -> bool

§

fn set(&mut self, ix: usize)

§

fn clear(&mut self, ix: usize)

§

fn count(&self) -> usize

§

impl BitSetLike for i16

§

fn new_bitset(_: usize) -> i16

§

fn len(&self) -> usize

§

fn test(&self, ix: usize) -> bool

§

fn set(&mut self, ix: usize)

§

fn clear(&mut self, ix: usize)

§

fn count(&self) -> usize

§

impl BitSetLike for i32

§

fn new_bitset(_: usize) -> i32

§

fn len(&self) -> usize

§

fn test(&self, ix: usize) -> bool

§

fn set(&mut self, ix: usize)

§

fn clear(&mut self, ix: usize)

§

fn count(&self) -> usize

§

impl BitSetLike for i64

§

fn new_bitset(_: usize) -> i64

§

fn len(&self) -> usize

§

fn test(&self, ix: usize) -> bool

§

fn set(&mut self, ix: usize)

§

fn clear(&mut self, ix: usize)

§

fn count(&self) -> usize

§

impl BitSetLike for isize

§

fn new_bitset(_: usize) -> isize

§

fn len(&self) -> usize

§

fn test(&self, ix: usize) -> bool

§

fn set(&mut self, ix: usize)

§

fn clear(&mut self, ix: usize)

§

fn count(&self) -> usize

§

impl BitSetLike for u8

§

fn new_bitset(_: usize) -> u8

§

fn len(&self) -> usize

§

fn test(&self, ix: usize) -> bool

§

fn set(&mut self, ix: usize)

§

fn clear(&mut self, ix: usize)

§

fn count(&self) -> usize

§

impl BitSetLike for u16

§

fn new_bitset(_: usize) -> u16

§

fn len(&self) -> usize

§

fn test(&self, ix: usize) -> bool

§

fn set(&mut self, ix: usize)

§

fn clear(&mut self, ix: usize)

§

fn count(&self) -> usize

§

impl BitSetLike for u32

§

fn new_bitset(_: usize) -> u32

§

fn len(&self) -> usize

§

fn test(&self, ix: usize) -> bool

§

fn set(&mut self, ix: usize)

§

fn clear(&mut self, ix: usize)

§

fn count(&self) -> usize

§

impl BitSetLike for u64

§

fn new_bitset(_: usize) -> u64

§

fn len(&self) -> usize

§

fn test(&self, ix: usize) -> bool

§

fn set(&mut self, ix: usize)

§

fn clear(&mut self, ix: usize)

§

fn count(&self) -> usize

§

impl BitSetLike for usize

§

fn new_bitset(_: usize) -> usize

§

fn len(&self) -> usize

§

fn test(&self, ix: usize) -> bool

§

fn set(&mut self, ix: usize)

§

fn clear(&mut self, ix: usize)

§

fn count(&self) -> usize

§

impl BitSetLike for Vec<bool>

§

fn new_bitset(max: usize) -> Vec<bool>

§

fn len(&self) -> usize

§

fn test(&self, bit: usize) -> bool

§

fn set(&mut self, bit: usize)

§

fn clear(&mut self, bit: usize)

§

fn count(&self) -> usize

§

impl BitSetLike for BitSet

§

fn new_bitset(max: usize) -> BitSet

§

fn len(&self) -> usize

§

fn test(&self, bit: usize) -> bool

§

fn set(&mut self, bit: usize)

§

fn clear(&mut self, bit: usize)

§

fn count(&self) -> usize

Implementors§