pub struct AssociatedWhitespaceRules { /* private fields */ }Expand description
A bitmask 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
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() -> Self
pub const fn all_bits() -> Self
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 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() -> Self
👎Deprecated: Please use the ::all_bits() constructor
pub const fn all() -> Self
Please use the ::all_bits() constructor
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 is_all(&self) -> bool
👎Deprecated: Please use the .is_all_bits() method
pub const fn is_all(&self) -> bool
Please use the .is_all_bits() method
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 full() -> Self
👎Deprecated: Please use the ::all_flags() constructor
pub const fn full() -> Self
Please use the ::all_flags() constructor
Returns 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
Please use the .is_all_flags() method
Returns true if the bitmask contains all flags.
This will fail if any unused bit is set,
consider using .truncate() first.
Sourcepub const fn truncate(&self) -> Self
pub const fn truncate(&self) -> Self
Returns a bitmask that only has bits corresponding to flags
Sourcepub const fn intersects(&self, other: Self) -> bool
pub const fn intersects(&self, other: Self) -> 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.
Trait Implementations§
Source§impl Binary for AssociatedWhitespaceRules
impl Binary for AssociatedWhitespaceRules
Source§impl BitAnd for AssociatedWhitespaceRules
impl BitAnd for AssociatedWhitespaceRules
Source§impl BitAndAssign for AssociatedWhitespaceRules
impl BitAndAssign for AssociatedWhitespaceRules
Source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
&= operation. Read moreSource§impl BitOr for AssociatedWhitespaceRules
impl BitOr for AssociatedWhitespaceRules
Source§impl BitOrAssign for AssociatedWhitespaceRules
impl BitOrAssign for AssociatedWhitespaceRules
Source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
|= operation. Read moreSource§impl BitXor for AssociatedWhitespaceRules
impl BitXor for AssociatedWhitespaceRules
Source§impl BitXorAssign for AssociatedWhitespaceRules
impl BitXorAssign for AssociatedWhitespaceRules
Source§fn bitxor_assign(&mut self, rhs: Self)
fn bitxor_assign(&mut self, rhs: Self)
^= 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 more