pub enum QuoteStyle {
None,
Single,
Double,
}Expand description
An enum representing the “Style” the Kind::String token represents.
A Token with Kind::String will store this data internal to the token. Using Token::quote_style() will return this enum, depending on what character is used to represent the Kind::String token.
use css_lexer::*;
let mut lexer = Lexer::new(&EmptyAtomSet::ATOMS, "/* Normal Comment */ /** Double Star Comment */");
{
// This token will be collapsed Whitespace.
let token = lexer.advance();
assert_eq!(token, Kind::Comment);
assert_eq!(token, CommentStyle::Block);
}
assert_eq!(lexer.advance(), Kind::Whitespace);
{
// This token will be collapsed Whitespace.
let token = lexer.advance();
assert_eq!(token, Kind::Comment);
assert_eq!(token, CommentStyle::BlockStar);
}Variants§
None
Tokens such as Kind::Url may also refer to QuoteStyle, but a URL is not required to contain quote characters, as the parenthesese are sufficient to disambiguate the token. In these case the QuoteStyle::None variant exists to encode this information. Kind::String tokens must always have a quote style that is not QuoteStyle::None.
Single
The single quote character or APOSTROPHE (') was used.
Double
The double quote character or QUOTATION MARK (") was used.
Trait Implementations§
Source§impl Clone for QuoteStyle
impl Clone for QuoteStyle
Source§fn clone(&self) -> QuoteStyle
fn clone(&self) -> QuoteStyle
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for QuoteStyle
impl Debug for QuoteStyle
Source§impl Default for QuoteStyle
impl Default for QuoteStyle
Source§fn default() -> QuoteStyle
fn default() -> QuoteStyle
Returns the “default value” for a type. Read more
Source§impl Display for QuoteStyle
impl Display for QuoteStyle
Source§impl From<Cursor> for QuoteStyle
impl From<Cursor> for QuoteStyle
Source§fn from(cursor: Cursor) -> QuoteStyle
fn from(cursor: Cursor) -> QuoteStyle
Converts to this type from the input type.
Source§impl From<Token> for QuoteStyle
impl From<Token> for QuoteStyle
Source§fn from(token: Token) -> QuoteStyle
fn from(token: Token) -> QuoteStyle
Converts to this type from the input type.
Source§impl Hash for QuoteStyle
impl Hash for QuoteStyle
Source§impl Ord for QuoteStyle
impl Ord for QuoteStyle
Source§fn cmp(&self, other: &QuoteStyle) -> Ordering
fn cmp(&self, other: &QuoteStyle) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq<QuoteStyle> for &Cursor
impl PartialEq<QuoteStyle> for &Cursor
Source§impl PartialEq<QuoteStyle> for Cursor
impl PartialEq<QuoteStyle> for Cursor
Source§impl PartialEq<QuoteStyle> for Token
impl PartialEq<QuoteStyle> for Token
Source§impl PartialEq<char> for QuoteStyle
impl PartialEq<char> for QuoteStyle
Source§impl PartialEq for QuoteStyle
impl PartialEq for QuoteStyle
Source§impl PartialOrd for QuoteStyle
impl PartialOrd for QuoteStyle
impl Copy for QuoteStyle
impl Eq for QuoteStyle
impl StructuralPartialEq for QuoteStyle
Auto Trait Implementations§
impl Freeze for QuoteStyle
impl RefUnwindSafe for QuoteStyle
impl Send for QuoteStyle
impl Sync for QuoteStyle
impl Unpin for QuoteStyle
impl UnwindSafe for QuoteStyle
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
Mutably borrows from an owned value. Read more