MCPcopy Create free account
hub / github.com/csskit/csskit / with_quotes

Method with_quotes

crates/css_lexer/src/token.rs:873–879  ·  view source on GitHub ↗
(&self, quote_style: QuoteStyle)

Source from the content-addressed store, hash-verified

871 /// [QuoteStyle] must not be [QuoteStyle::None]
872 #[inline]
873 pub fn with_quotes(&self, quote_style: QuoteStyle) -> Token {
874 debug_assert!(quote_style != QuoteStyle::None);
875 if self.kind_bits() != Kind::String as u8 || quote_style == self.quote_style() {
876 return *self;
877 }
878 Token::new_string(quote_style, self.has_close_quote(), self.contains_escape_chars(), self.len())
879 }
880
881 /// If the [Token] is a [Kind::String] this checks if the string ended in a close quote.
882 /// It is possible to have a valid String token that does not end in a close quote, by eliding the quote at the end of

Callers 3

test_with_quotes_noneFunction · 0.45
writeMethod · 0.45
writeMethod · 0.45

Calls 5

kind_bitsMethod · 0.80
quote_styleMethod · 0.80
has_close_quoteMethod · 0.80
contains_escape_charsMethod · 0.80
lenMethod · 0.45

Tested by 1

test_with_quotes_noneFunction · 0.36