proptest::bits

Trait BitSetLike

source
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§

source

fn new_bitset(max: usize) -> Self

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

source

fn len(&self) -> usize

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

source

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

Test whether the given bit is set.

source

fn set(&mut self, ix: usize)

Set the given bit.

source

fn clear(&mut self, ix: usize)

Clear the given bit.

Provided Methods§

source

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§

source§

impl BitSetLike for i8

source§

fn new_bitset(_: usize) -> Self

source§

fn len(&self) -> usize

source§

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

source§

fn set(&mut self, ix: usize)

source§

fn clear(&mut self, ix: usize)

source§

fn count(&self) -> usize

source§

impl BitSetLike for i16

source§

fn new_bitset(_: usize) -> Self

source§

fn len(&self) -> usize

source§

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

source§

fn set(&mut self, ix: usize)

source§

fn clear(&mut self, ix: usize)

source§

fn count(&self) -> usize

source§

impl BitSetLike for i32

source§

fn new_bitset(_: usize) -> Self

source§

fn len(&self) -> usize

source§

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

source§

fn set(&mut self, ix: usize)

source§

fn clear(&mut self, ix: usize)

source§

fn count(&self) -> usize

source§

impl BitSetLike for i64

source§

fn new_bitset(_: usize) -> Self

source§

fn len(&self) -> usize

source§

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

source§

fn set(&mut self, ix: usize)

source§

fn clear(&mut self, ix: usize)

source§

fn count(&self) -> usize

source§

impl BitSetLike for isize

source§

fn new_bitset(_: usize) -> Self

source§

fn len(&self) -> usize

source§

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

source§

fn set(&mut self, ix: usize)

source§

fn clear(&mut self, ix: usize)

source§

fn count(&self) -> usize

source§

impl BitSetLike for u8

source§

fn new_bitset(_: usize) -> Self

source§

fn len(&self) -> usize

source§

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

source§

fn set(&mut self, ix: usize)

source§

fn clear(&mut self, ix: usize)

source§

fn count(&self) -> usize

source§

impl BitSetLike for u16

source§

fn new_bitset(_: usize) -> Self

source§

fn len(&self) -> usize

source§

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

source§

fn set(&mut self, ix: usize)

source§

fn clear(&mut self, ix: usize)

source§

fn count(&self) -> usize

source§

impl BitSetLike for u32

source§

fn new_bitset(_: usize) -> Self

source§

fn len(&self) -> usize

source§

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

source§

fn set(&mut self, ix: usize)

source§

fn clear(&mut self, ix: usize)

source§

fn count(&self) -> usize

source§

impl BitSetLike for u64

source§

fn new_bitset(_: usize) -> Self

source§

fn len(&self) -> usize

source§

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

source§

fn set(&mut self, ix: usize)

source§

fn clear(&mut self, ix: usize)

source§

fn count(&self) -> usize

source§

impl BitSetLike for usize

source§

fn new_bitset(_: usize) -> Self

source§

fn len(&self) -> usize

source§

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

source§

fn set(&mut self, ix: usize)

source§

fn clear(&mut self, ix: usize)

source§

fn count(&self) -> usize

source§

impl BitSetLike for BitSet

source§

fn new_bitset(max: usize) -> Self

source§

fn len(&self) -> usize

source§

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

source§

fn set(&mut self, bit: usize)

source§

fn clear(&mut self, bit: usize)

source§

fn count(&self) -> usize

source§

impl BitSetLike for Vec<bool>

source§

fn new_bitset(max: usize) -> Self

source§

fn len(&self) -> usize

source§

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

source§

fn set(&mut self, bit: usize)

source§

fn clear(&mut self, bit: usize)

source§

fn count(&self) -> usize

Implementors§