rustmax::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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl BitSetLike for i8

Source§

fn new_bitset(_: usize) -> i8

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) -> i16

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) -> i32

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) -> i64

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) -> isize

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) -> u8

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) -> u16

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) -> u32

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) -> u64

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) -> usize

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) -> BitSet

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§