pub struct BitSet { /* private fields */ }
Implementations§
Source§impl BitSet
impl BitSet
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn ones(size: usize) -> Self
Sourcepub fn get(&self, i: usize) -> bool
pub fn get(&self, i: usize) -> bool
Examples found in repository?
crates/competitive/src/algorithm/automata_learning.rs (line 384)
367 pub fn construct_dfa(&mut self) -> DeterministicFiniteAutomaton {
368 let sigma = self.automaton.sigma();
369 let mut dfa = DeterministicFiniteAutomaton {
370 states: vec![],
371 initial_state: 0,
372 };
373 let mut i_prefix = 0;
374 while i_prefix < self.prefixes.len() {
375 let mut delta = vec![];
376 for x in 0..sigma {
377 let prefix: Vec<usize> =
378 self.prefixes[i_prefix].iter().cloned().chain([x]).collect();
379 let index = self.add_prefix(prefix);
380 delta.push(index);
381 }
382 dfa.states.push(DfaState {
383 delta,
384 accept: self.table[i_prefix].get(0),
385 });
386 i_prefix += 1;
387 }
388 dfa
389 }
pub fn set(&mut self, i: usize, b: bool)
Sourcepub fn count_ones(&self) -> u64
pub fn count_ones(&self) -> u64
pub fn count_zeros(&self) -> u64
Sourcepub fn push(&mut self, b: bool)
pub fn push(&mut self, b: bool)
Examples found in repository?
crates/competitive/src/algorithm/automata_learning.rs (lines 356-359)
351 fn add_suffix(&mut self, suffix: Vec<usize>) {
352 if self.suffixes.contains(&suffix) {
353 return;
354 }
355 for (prefix, table) in self.prefixes.iter_mut().zip(&mut self.table) {
356 table.push(
357 self.automaton
358 .behavior(prefix.iter().cloned().chain(suffix.iter().cloned())),
359 );
360 }
361 self.suffixes.push(suffix);
362 self.row_map.clear();
363 for (i_prefix, row) in self.table.iter().enumerate() {
364 self.row_map.insert(row.clone(), i_prefix);
365 }
366 }
pub fn shl_bitor_assign(&mut self, rhs: usize)
pub fn shr_bitor_assign(&mut self, rhs: usize)
Trait Implementations§
Source§impl<'a> BitAndAssign<&'a BitSet> for BitSet
impl<'a> BitAndAssign<&'a BitSet> for BitSet
Source§fn bitand_assign(&mut self, rhs: &'a Self)
fn bitand_assign(&mut self, rhs: &'a Self)
Performs the
&=
operation. Read moreSource§impl<'a> BitOrAssign<&'a BitSet> for BitSet
impl<'a> BitOrAssign<&'a BitSet> for BitSet
Source§fn bitor_assign(&mut self, rhs: &'a Self)
fn bitor_assign(&mut self, rhs: &'a Self)
Performs the
|=
operation. Read moreSource§impl<'a> BitXorAssign<&'a BitSet> for BitSet
impl<'a> BitXorAssign<&'a BitSet> for BitSet
Source§fn bitxor_assign(&mut self, rhs: &'a Self)
fn bitxor_assign(&mut self, rhs: &'a Self)
Performs the
^=
operation. Read moreSource§impl Extend<bool> for BitSet
impl Extend<bool> for BitSet
Source§fn extend<T: IntoIterator<Item = bool>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = bool>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl FromIterator<bool> for BitSet
impl FromIterator<bool> for BitSet
Source§impl Ord for BitSet
impl Ord for BitSet
Source§impl PartialOrd for BitSet
impl PartialOrd for BitSet
Source§impl ShlAssign<usize> for BitSet
impl ShlAssign<usize> for BitSet
Source§fn shl_assign(&mut self, rhs: usize)
fn shl_assign(&mut self, rhs: usize)
Performs the
<<=
operation. Read moreSource§impl ShrAssign<usize> for BitSet
impl ShrAssign<usize> for BitSet
Source§fn shr_assign(&mut self, rhs: usize)
fn shr_assign(&mut self, rhs: usize)
Performs the
>>=
operation. Read moreimpl Eq for BitSet
impl StructuralPartialEq for BitSet
Auto Trait Implementations§
impl Freeze for BitSet
impl RefUnwindSafe for BitSet
impl Send for BitSet
impl Sync for BitSet
impl Unpin for BitSet
impl UnwindSafe for BitSet
Blanket Implementations§
Source§impl<T> AsTotalOrd for Twhere
T: PartialOrd,
impl<T> AsTotalOrd for Twhere
T: PartialOrd,
fn as_total_ord(&self) -> TotalOrd<&T>
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