pub struct KeywordSet(/* private fields */);Expand description
A const bitset giving every Keyword discriminant its own bit.
Backed by [u64; KEYWORD_WORDS] rather than a single u64, so reservation
stays a one-bit-test per-position lookup while scaling past 64
keywords with no representation change. Membership and union
are O(1) and const, so the per-position sets fold at compile time.
Implementations§
Source§impl KeywordSet
impl KeywordSet
Sourcepub const fn from_keywords(keywords: &[Keyword]) -> Self
pub const fn from_keywords(keywords: &[Keyword]) -> Self
Build a set from keywords.
Sourcepub const fn union(self, other: Self) -> Self
pub const fn union(self, other: Self) -> Self
The union of two sets — the per-position reject sets are built by unioning
the generated kwlist.h category bitsets (e.g. a ColId rejects
type_func_name ∪ reserved), so this must be const.
Sourcepub const fn difference(self, other: Self) -> Self
pub const fn difference(self, other: Self) -> Self
The set difference self \ other — every keyword in self that is not in
other. Carves a small allowlist out of a broad reserved set (MySQL admits its
reserved window-function names — ROW_NUMBER, RANK, … — as call heads via a
dedicated grammar, so its function-name reject set is the reserved set minus those),
so it must be const to fold at compile time alongside union.
Trait Implementations§
Source§impl Clone for KeywordSet
impl Clone for KeywordSet
Source§fn clone(&self) -> KeywordSet
fn clone(&self) -> KeywordSet
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more