SymbolBitSet

Struct SymbolBitSet 

Source
pub struct SymbolBitSet { /* private fields */ }
Expand description

A set of symbols in the form of a bit vector.

Implementations§

Source§

impl SymbolBitSet

Source

pub fn new() -> SymbolBitSet

Constructs an empty SymbolBitSet.

Source

pub fn from_elem(grammar: &Cfg, elem: bool) -> SymbolBitSet

Constructs a SymbolBitSet.

Source

pub fn reset(&mut self, symbol_source: &SymbolSource)

Resets the set to false repeated as many times as there are symbols in the given source.

In other words, none of the symbols are included, but we have space to mark them as included.

Source

pub fn set_all(&mut self, symbol_source: &SymbolSource)

Resets the set to true repeated as many times as there are symbols in the given source.

In other words, all of the symbols are included in the set.

Source

pub fn used(&mut self, grammar: &Cfg)

Makes this set include only symbols which appear anywhere in the grammar.

Source

pub fn unused(&mut self, grammar: &Cfg)

Makes this set include only symbols which do not appear anywhere in the grammar.

Source

pub fn negate(&mut self)

Included symbols will be excluded, and symbols that do not appear in the set will be included instead.

Source

pub fn terminal(&mut self, grammar: &Cfg)

Gathers information about whether symbols are terminal or nonterminal. Constructs a set of terminal symbols.

Constructs a data structure in O(n) time.

Source

pub fn nulling(&mut self, grammar: &Cfg)

Gathers information about whether symbols are nulling. Includes the set of nulling symbols.

Constructs a data structure in O(n) time.

Source

pub fn productive(&mut self, grammar: &Cfg)

Gathers information about whether symbols are terminal or nonterminal. Includes the set of nonterminal symbols.

Constructs a data structure in O(n) time.

Source

pub fn subtract_productive(&mut self, grammar: &Cfg)

Excludes all nonterminals from the given grammar from the set.

Source

pub fn set(&mut self, index: Symbol, elem: bool)

Sets the membership for the given symbol.

Source

pub fn bit_vec(&self) -> &BitVec

Allows access to the underlying BitVec.

Source

pub fn into_bit_vec(self) -> BitVec

Converts into a bit vector.

Source

pub fn iter(&self) -> impl Iterator<Item = Symbol> + use<'_>

Iterates over symbols in the set.

Source

pub fn union(&mut self, other: &SymbolBitSet)

Includes all symbols that are included in the other set.

Source

pub fn space(&self) -> usize

Returns the number of symbols we have space for.

Source

pub fn all(&self) -> bool

Determines whether this set contains all symbols we have space for.

Source

pub fn is_empty(&self) -> bool

Not to be confused with fn is_empty.

Source

pub fn reserve(&mut self, len: usize)

Reserves space for additional symbols.

Trait Implementations§

Source§

impl Clone for SymbolBitSet

Source§

fn clone(&self) -> SymbolBitSet

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SymbolBitSet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for SymbolBitSet

Source§

fn default() -> SymbolBitSet

Returns the “default value” for a type. Read more
Source§

impl Deserialize for SymbolBitSet

Source§

fn begin(__out: &mut Option<SymbolBitSet>) -> &mut dyn Visitor

The only correct implementation of this method is: Read more
Source§

impl Index<Symbol> for SymbolBitSet

Source§

type Output = bool

The returned type after indexing.
Source§

fn index(&self, index: Symbol) -> &<SymbolBitSet as Index<Symbol>>::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl Serialize for SymbolBitSet

Source§

fn begin(&self) -> Fragment<'_>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.