pub struct AssociatedWhitespaceRules { /* private fields */ }Expand description
A [bitmask][bitmask_enum] representing rules around the whitespace surrounding a Kind::Delim token.
A Token with Kind::Delim or one of the other single character tokens (such as Kind::LeftCurly will store this data internal to the token. Using Token::associated_whitespace() will return this bitmask, depending on what rules are set for this token. By default the Lexer will produce tokens with AssociatedWhitespaceRules::None, but new tokens can be created which can be accompanied with a different set of rules.
use css_lexer::*;
let mut lexer = Lexer::new(&EmptyAtomSet::ATOMS, ".");
{
	// This token will be a Delim of `.`
	let token = lexer.advance();
	assert_eq!(token, Kind::Delim);
	assert_eq!(token, AssociatedWhitespaceRules::None);
}Implementations§
Source§impl AssociatedWhitespaceRules
 
impl AssociatedWhitespaceRules
pub const None: AssociatedWhitespaceRules
Sourcepub const EnforceBefore: AssociatedWhitespaceRules
 
pub const EnforceBefore: AssociatedWhitespaceRules
If the token before this one is not whitespace, then whitespace must be placed before this token.
Sourcepub const EnforceAfter: AssociatedWhitespaceRules
 
pub const EnforceAfter: AssociatedWhitespaceRules
The token must produce a whitespace token to separate it and the next token (if the next token is not already whitespace).
Sourcepub const BanAfter: AssociatedWhitespaceRules
 
pub const BanAfter: AssociatedWhitespaceRules
The token after this one must not be whitespace, doing so would result in breaking a higher level association with
the adjacent token (for example a pseudo class such as :hover).
Sourcepub const fn all_bits() -> AssociatedWhitespaceRules
 
pub const fn all_bits() -> AssociatedWhitespaceRules
Returns a bitmask that contains all values.
This will include bits that do not have any flags.
Use ::all_flags() if you only want to use flags.
Sourcepub const fn all_flags() -> AssociatedWhitespaceRules
 
pub const fn all_flags() -> AssociatedWhitespaceRules
Returns a bitmask that contains all flags.
Sourcepub const fn is_all_bits(&self) -> bool
 
pub const fn is_all_bits(&self) -> bool
Returns true if the bitmask contains all values.
This will check for bits == !0,
use .is_all_flags() if you only want to check for all flags
Sourcepub const fn is_all_flags(&self) -> bool
 
pub const fn is_all_flags(&self) -> bool
Returns true if the bitmask contains all flags.
This will fail if any unused bit is set,
consider using .truncate() first.
Sourcepub const fn all() -> AssociatedWhitespaceRules
 👎Deprecated: Please use the ::all_bits() constructor
pub const fn all() -> AssociatedWhitespaceRules
::all_bits() constructorReturns a bitmask that contains all values.
This will include bits that do not have any flags.
Use ::all_flags() if you only want to use flags.
Sourcepub const fn is_all(&self) -> bool
 👎Deprecated: Please use the .is_all_bits() method
pub const fn is_all(&self) -> bool
.is_all_bits() methodReturns true if the bitmask contains all values.
This will check for bits == !0,
use .is_all_flags() if you only want to check for all flags
Sourcepub const fn full() -> AssociatedWhitespaceRules
 👎Deprecated: Please use the ::all_flags() constructor
pub const fn full() -> AssociatedWhitespaceRules
::all_flags() constructorReturns a bitmask that contains all flags.
Sourcepub const fn is_full(&self) -> bool
 👎Deprecated: Please use the .is_all_flags() method
pub const fn is_full(&self) -> bool
.is_all_flags() methodReturns true if the bitmask contains all flags.
This will fail if any unused bit is set,
consider using .truncate() first.
Sourcepub const fn none() -> AssociatedWhitespaceRules
 
pub const fn none() -> AssociatedWhitespaceRules
Returns a bitmask that does not contain any values.
Sourcepub const fn truncate(&self) -> AssociatedWhitespaceRules
 
pub const fn truncate(&self) -> AssociatedWhitespaceRules
Returns a bitmask that only has bits corresponding to flags
Sourcepub const fn intersects(&self, other: AssociatedWhitespaceRules) -> bool
 
pub const fn intersects(&self, other: AssociatedWhitespaceRules) -> bool
Returns true if self intersects with any value in other,
or if other does not contain any values.
This is equivalent to (self & other) != 0 || other == 0.
Sourcepub const fn contains(&self, other: AssociatedWhitespaceRules) -> bool
 
pub const fn contains(&self, other: AssociatedWhitespaceRules) -> bool
Returns true if self contains all values of other.
This is equivalent to  (self & other) == other.
Sourcepub const fn not(self) -> AssociatedWhitespaceRules
 
pub const fn not(self) -> AssociatedWhitespaceRules
Returns the bitwise NOT of the bitmask.
Sourcepub const fn and(
    self,
    other: AssociatedWhitespaceRules,
) -> AssociatedWhitespaceRules
 
pub const fn and( self, other: AssociatedWhitespaceRules, ) -> AssociatedWhitespaceRules
Returns the bitwise AND of the bitmask.
Sourcepub const fn or(
    self,
    other: AssociatedWhitespaceRules,
) -> AssociatedWhitespaceRules
 
pub const fn or( self, other: AssociatedWhitespaceRules, ) -> AssociatedWhitespaceRules
Returns the bitwise OR of the bitmask.
Sourcepub const fn xor(
    self,
    other: AssociatedWhitespaceRules,
) -> AssociatedWhitespaceRules
 
pub const fn xor( self, other: AssociatedWhitespaceRules, ) -> AssociatedWhitespaceRules
Returns the bitwise XOR of the bitmask.
Trait Implementations§
Source§impl Binary for AssociatedWhitespaceRules
 
impl Binary for AssociatedWhitespaceRules
Source§impl BitAnd for AssociatedWhitespaceRules
 
impl BitAnd for AssociatedWhitespaceRules
Source§type Output = AssociatedWhitespaceRules
 
type Output = AssociatedWhitespaceRules
& operator.Source§fn bitand(
    self,
    rhs: AssociatedWhitespaceRules,
) -> <AssociatedWhitespaceRules as BitAnd>::Output
 
fn bitand( self, rhs: AssociatedWhitespaceRules, ) -> <AssociatedWhitespaceRules as BitAnd>::Output
& operation. Read moreSource§impl BitAndAssign for AssociatedWhitespaceRules
 
impl BitAndAssign for AssociatedWhitespaceRules
Source§fn bitand_assign(&mut self, rhs: AssociatedWhitespaceRules)
 
fn bitand_assign(&mut self, rhs: AssociatedWhitespaceRules)
&= operation. Read moreSource§impl BitOr for AssociatedWhitespaceRules
 
impl BitOr for AssociatedWhitespaceRules
Source§type Output = AssociatedWhitespaceRules
 
type Output = AssociatedWhitespaceRules
| operator.Source§fn bitor(
    self,
    rhs: AssociatedWhitespaceRules,
) -> <AssociatedWhitespaceRules as BitOr>::Output
 
fn bitor( self, rhs: AssociatedWhitespaceRules, ) -> <AssociatedWhitespaceRules as BitOr>::Output
| operation. Read moreSource§impl BitOrAssign for AssociatedWhitespaceRules
 
impl BitOrAssign for AssociatedWhitespaceRules
Source§fn bitor_assign(&mut self, rhs: AssociatedWhitespaceRules)
 
fn bitor_assign(&mut self, rhs: AssociatedWhitespaceRules)
|= operation. Read moreSource§impl BitXor for AssociatedWhitespaceRules
 
impl BitXor for AssociatedWhitespaceRules
Source§type Output = AssociatedWhitespaceRules
 
type Output = AssociatedWhitespaceRules
^ operator.Source§fn bitxor(
    self,
    rhs: AssociatedWhitespaceRules,
) -> <AssociatedWhitespaceRules as BitXor>::Output
 
fn bitxor( self, rhs: AssociatedWhitespaceRules, ) -> <AssociatedWhitespaceRules as BitXor>::Output
^ operation. Read moreSource§impl BitXorAssign for AssociatedWhitespaceRules
 
impl BitXorAssign for AssociatedWhitespaceRules
Source§fn bitxor_assign(&mut self, rhs: AssociatedWhitespaceRules)
 
fn bitxor_assign(&mut self, rhs: AssociatedWhitespaceRules)
^= operation. Read moreSource§impl Clone for AssociatedWhitespaceRules
 
impl Clone for AssociatedWhitespaceRules
Source§fn clone(&self) -> AssociatedWhitespaceRules
 
fn clone(&self) -> AssociatedWhitespaceRules
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AssociatedWhitespaceRules
 
impl Debug for AssociatedWhitespaceRules
Source§impl From<u8> for AssociatedWhitespaceRules
 
impl From<u8> for AssociatedWhitespaceRules
Source§fn from(val: u8) -> AssociatedWhitespaceRules
 
fn from(val: u8) -> AssociatedWhitespaceRules
Source§impl Hash for AssociatedWhitespaceRules
 
impl Hash for AssociatedWhitespaceRules
Source§impl LowerHex for AssociatedWhitespaceRules
 
impl LowerHex for AssociatedWhitespaceRules
Source§impl Not for AssociatedWhitespaceRules
 
impl Not for AssociatedWhitespaceRules
Source§impl Octal for AssociatedWhitespaceRules
 
impl Octal for AssociatedWhitespaceRules
Source§impl Ord for AssociatedWhitespaceRules
 
impl Ord for AssociatedWhitespaceRules
Source§fn cmp(&self, other: &AssociatedWhitespaceRules) -> Ordering
 
fn cmp(&self, other: &AssociatedWhitespaceRules) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
    Self: Sized,
 
fn max(self, other: Self) -> Selfwhere
    Self: Sized,
Source§impl PartialEq<AssociatedWhitespaceRules> for Cursor
 
impl PartialEq<AssociatedWhitespaceRules> for Cursor
Source§impl PartialEq<AssociatedWhitespaceRules> for Token
 
impl PartialEq<AssociatedWhitespaceRules> for Token
Source§impl PartialEq<u8> for AssociatedWhitespaceRules
 
impl PartialEq<u8> for AssociatedWhitespaceRules
Source§impl PartialOrd for AssociatedWhitespaceRules
 
impl PartialOrd for AssociatedWhitespaceRules
Source§impl UpperHex for AssociatedWhitespaceRules
 
impl UpperHex for AssociatedWhitespaceRules
impl Copy for AssociatedWhitespaceRules
impl Eq for AssociatedWhitespaceRules
impl StructuralPartialEq for AssociatedWhitespaceRules
Auto Trait Implementations§
impl Freeze for AssociatedWhitespaceRules
impl RefUnwindSafe for AssociatedWhitespaceRules
impl Send for AssociatedWhitespaceRules
impl Sync for AssociatedWhitespaceRules
impl Unpin for AssociatedWhitespaceRules
impl UnwindSafe for AssociatedWhitespaceRules
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
§impl<D> OwoColorize for D
 
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
    C: Color,
 
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
    C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
    C: Color,
 
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
    C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
 
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
 
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
 
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
 
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
 
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
 
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
 
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
 
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
 
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
 
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
 
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
 
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
 
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
 
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
 
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
 
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
 
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
 
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
 
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
 
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
 
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
 
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
 
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
    Color: DynColor,
 
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
    Color: DynColor,
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
    Color: DynColor,
 
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
    Color: DynColor,
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more