pub trait Literal:
ProcMacro<Literal = Self>
+ Display
+ FromStr {
Show 35 methods
// Required methods
fn i8_suffixed(n: i8) -> Self;
fn i16_suffixed(n: i16) -> Self;
fn i32_suffixed(n: i32) -> Self;
fn i64_suffixed(n: i64) -> Self;
fn i128_suffixed(n: i128) -> Self;
fn isize_suffixed(n: isize) -> Self;
fn u8_suffixed(n: u8) -> Self;
fn u16_suffixed(n: u16) -> Self;
fn u32_suffixed(n: u32) -> Self;
fn u64_suffixed(n: u64) -> Self;
fn u128_suffixed(n: u128) -> Self;
fn usize_suffixed(n: usize) -> Self;
fn i8_unsuffixed(n: i8) -> Self;
fn i16_unsuffixed(n: i16) -> Self;
fn i32_unsuffixed(n: i32) -> Self;
fn i64_unsuffixed(n: i64) -> Self;
fn i128_unsuffixed(n: i128) -> Self;
fn isize_unsuffixed(n: isize) -> Self;
fn u8_unsuffixed(n: u8) -> Self;
fn u16_unsuffixed(n: u16) -> Self;
fn u32_unsuffixed(n: u32) -> Self;
fn u64_unsuffixed(n: u64) -> Self;
fn u128_unsuffixed(n: u128) -> Self;
fn usize_unsuffixed(n: usize) -> Self;
fn f32_suffixed(n: f32) -> Self;
fn f64_suffixed(n: f64) -> Self;
fn f32_unsuffixed(n: f32) -> Self;
fn f64_unsuffixed(n: f64) -> Self;
fn string(str: &str) -> Self;
fn character(c: char) -> Self;
fn byte_character(b: u8) -> Self;
fn byte_string(bytes: &[u8]) -> Self;
fn c_string(str: &CStr) -> Self;
fn span(&self) -> Self::Span;
fn set_span(&mut self, span: Self::Span);
}
Expand description
Literal
API trait. See proc_macro::Literal
.
This trait is implemented for Literal
in proc_macro
and proc_macro2
if the
corresponding feature is enabled.
See also LiteralExt
.
Required Methods§
Sourcefn i8_suffixed(n: i8) -> Self
fn i8_suffixed(n: i8) -> Self
Suffixed integer literal.
Sourcefn i16_suffixed(n: i16) -> Self
fn i16_suffixed(n: i16) -> Self
Suffixed integer literal.
Sourcefn i32_suffixed(n: i32) -> Self
fn i32_suffixed(n: i32) -> Self
Suffixed integer literal.
Sourcefn i64_suffixed(n: i64) -> Self
fn i64_suffixed(n: i64) -> Self
Suffixed integer literal.
Sourcefn i128_suffixed(n: i128) -> Self
fn i128_suffixed(n: i128) -> Self
Suffixed integer literal.
Sourcefn isize_suffixed(n: isize) -> Self
fn isize_suffixed(n: isize) -> Self
Suffixed integer literal.
Sourcefn u8_suffixed(n: u8) -> Self
fn u8_suffixed(n: u8) -> Self
Suffixed integer literal.
Sourcefn u16_suffixed(n: u16) -> Self
fn u16_suffixed(n: u16) -> Self
Suffixed integer literal.
Sourcefn u32_suffixed(n: u32) -> Self
fn u32_suffixed(n: u32) -> Self
Suffixed integer literal.
Sourcefn u64_suffixed(n: u64) -> Self
fn u64_suffixed(n: u64) -> Self
Suffixed integer literal.
Sourcefn u128_suffixed(n: u128) -> Self
fn u128_suffixed(n: u128) -> Self
Suffixed integer literal.
Sourcefn usize_suffixed(n: usize) -> Self
fn usize_suffixed(n: usize) -> Self
Suffixed integer literal.
Sourcefn i8_unsuffixed(n: i8) -> Self
fn i8_unsuffixed(n: i8) -> Self
Unsuffixed integer literal.
Sourcefn i16_unsuffixed(n: i16) -> Self
fn i16_unsuffixed(n: i16) -> Self
Unsuffixed integer literal.
Sourcefn i32_unsuffixed(n: i32) -> Self
fn i32_unsuffixed(n: i32) -> Self
Unsuffixed integer literal.
Sourcefn i64_unsuffixed(n: i64) -> Self
fn i64_unsuffixed(n: i64) -> Self
Unsuffixed integer literal.
Sourcefn i128_unsuffixed(n: i128) -> Self
fn i128_unsuffixed(n: i128) -> Self
Unsuffixed integer literal.
Sourcefn isize_unsuffixed(n: isize) -> Self
fn isize_unsuffixed(n: isize) -> Self
Unsuffixed integer literal.
Sourcefn u8_unsuffixed(n: u8) -> Self
fn u8_unsuffixed(n: u8) -> Self
Unsuffixed integer literal.
Sourcefn u16_unsuffixed(n: u16) -> Self
fn u16_unsuffixed(n: u16) -> Self
Unsuffixed integer literal.
Sourcefn u32_unsuffixed(n: u32) -> Self
fn u32_unsuffixed(n: u32) -> Self
Unsuffixed integer literal.
Sourcefn u64_unsuffixed(n: u64) -> Self
fn u64_unsuffixed(n: u64) -> Self
Unsuffixed integer literal.
Sourcefn u128_unsuffixed(n: u128) -> Self
fn u128_unsuffixed(n: u128) -> Self
Unsuffixed integer literal.
Sourcefn usize_unsuffixed(n: usize) -> Self
fn usize_unsuffixed(n: usize) -> Self
Unsuffixed integer literal.
Sourcefn f32_suffixed(n: f32) -> Self
fn f32_suffixed(n: f32) -> Self
Suffixed floating-point literal.
Sourcefn f64_suffixed(n: f64) -> Self
fn f64_suffixed(n: f64) -> Self
Suffixed floating-point literal.
Sourcefn f32_unsuffixed(n: f32) -> Self
fn f32_unsuffixed(n: f32) -> Self
Unsuffixed floating-point literal.
Sourcefn f64_unsuffixed(n: f64) -> Self
fn f64_unsuffixed(n: f64) -> Self
Unsuffixed floating-point literal.
Sourcefn byte_character(b: u8) -> Self
fn byte_character(b: u8) -> Self
Byte character literal.
This method is currently unstable in proc-macro
and is missing from proc-macro2
,
but this crate implements it in a way that works with both on stable.
Sourcefn byte_string(bytes: &[u8]) -> Self
fn byte_string(bytes: &[u8]) -> Self
Byte string literal.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl Literal for Literal
Available on crate feature proc-macro
only.
impl Literal for Literal
proc-macro
only.fn i8_suffixed(n: i8) -> Self
fn i16_suffixed(n: i16) -> Self
fn i32_suffixed(n: i32) -> Self
fn i64_suffixed(n: i64) -> Self
fn i128_suffixed(n: i128) -> Self
fn isize_suffixed(n: isize) -> Self
fn u8_suffixed(n: u8) -> Self
fn u16_suffixed(n: u16) -> Self
fn u32_suffixed(n: u32) -> Self
fn u64_suffixed(n: u64) -> Self
fn u128_suffixed(n: u128) -> Self
fn usize_suffixed(n: usize) -> Self
fn i8_unsuffixed(n: i8) -> Self
fn i16_unsuffixed(n: i16) -> Self
fn i32_unsuffixed(n: i32) -> Self
fn i64_unsuffixed(n: i64) -> Self
fn i128_unsuffixed(n: i128) -> Self
fn isize_unsuffixed(n: isize) -> Self
fn u8_unsuffixed(n: u8) -> Self
fn u16_unsuffixed(n: u16) -> Self
fn u32_unsuffixed(n: u32) -> Self
fn u64_unsuffixed(n: u64) -> Self
fn u128_unsuffixed(n: u128) -> Self
fn usize_unsuffixed(n: usize) -> Self
fn f32_unsuffixed(n: f32) -> Self
fn f32_suffixed(n: f32) -> Self
fn f64_unsuffixed(n: f64) -> Self
fn f64_suffixed(n: f64) -> Self
fn string(str: &str) -> Self
fn character(c: char) -> Self
fn byte_string(bytes: &[u8]) -> Self
fn byte_character(b: u8) -> Self
fn c_string(str: &CStr) -> Self
fn span(&self) -> Self::Span
fn set_span(&mut self, span: Self::Span)
Source§impl Literal for Literal
Available on crate feature proc-macro2
only.
impl Literal for Literal
proc-macro2
only.