pub struct LitByte { /* private fields */ }
Implementations
sourceimpl 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
sourceimpl ToTokens for LitByte
impl ToTokens for LitByte
sourcefn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
Write self
to the given TokenStream
. Read more
sourcefn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Convert self
directly into a TokenStream
object. Read more
sourcefn into_token_stream(self) -> TokenStream
fn into_token_stream(self) -> TokenStream
Convert self
directly into a TokenStream
object. Read more
impl Copy for LitByte
impl Eq for LitByte
Auto Trait Implementations
impl RefUnwindSafe for LitByte
impl !Send for LitByte
impl !Sync for LitByte
impl Unpin for LitByte
impl UnwindSafe for LitByte
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> FormatSpan for T where
T: Spanned + ?Sized,
impl<T> FormatSpan for T where
T: Spanned + ?Sized,
fn format_span(&self) -> SpanDisplay
sourceimpl<T> Spanned for T where
T: Spanned + ?Sized,
impl<T> Spanned for T where
T: Spanned + ?Sized,
sourcefn 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. Read more