pub struct LitByte { /* private fields */ }
Implementations§
source§impl LitByte
impl LitByte
sourcepub fn token(&self) -> Literal
pub fn token(&self) -> Literal
This method is non-trivial, so here is a doc-test for it.
let byte_a: LitByte = parse_quote!(b'a');
let token_a = byte_a.token();
assert_eq!(token_a.to_string(), r"b'a'");
let byte_nul: LitByte = parse_quote!(b'\x00');
let token_nul = byte_nul.token();
assert_eq!(token_nul.to_string(), r"b'\x00'");
let byte_tilde: LitByte = parse_quote!(b'~');
let token_tilde = byte_tilde.token();
assert_eq!(token_tilde.to_string(), r"b'~'");
let byte_space: LitByte = parse_quote!(b' ');
let token_space = byte_space.token();
assert_eq!(token_space.to_string(), r"b' '");
let byte_del: LitByte = parse_quote!(b'\x7f');
let token_del = byte_del.token();
assert_eq!(token_del.to_string(), r"b'\x7f'");
let byte_nonascii_80: LitByte = parse_quote!(b'\x80');
let token_nonascii_80 = byte_nonascii_80.token();
assert_eq!(token_nonascii_80.to_string(), r"b'\x80'");
let byte_nonascii_ff: LitByte = parse_quote!(b'\xff');
let token_nonascii_ff = byte_nonascii_ff.token();
assert_eq!(token_nonascii_ff.to_string(), r"b'\xff'");
Trait Implementations§
source§impl Ord for LitByte
impl Ord for LitByte
source§impl PartialEq for LitByte
impl PartialEq for LitByte
source§impl PartialOrd<u8> for LitByte
impl PartialOrd<u8> for LitByte
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd for LitByte
impl PartialOrd for LitByte
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl ToTokens for LitByte
impl ToTokens for LitByte
source§fn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
impl Copy for LitByte
impl Eq for LitByte
Auto Trait Implementations§
impl Freeze for LitByte
impl RefUnwindSafe for LitByte
impl !Send for LitByte
impl !Sync for LitByte
impl Unpin for LitByte
impl UnwindSafe for LitByte
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
source§impl<T> Spanned for Twhere
T: Spanned + ?Sized,
impl<T> Spanned for Twhere
T: Spanned + ?Sized,
source§fn span(&self) -> Span
fn span(&self) -> Span
Returns a
Span
covering the complete contents of this syntax tree
node, or Span::call_site()
if this node is empty.