Trait Literal

Source
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§

Source

fn i8_suffixed(n: i8) -> Self

Suffixed integer literal.

Source

fn i16_suffixed(n: i16) -> Self

Suffixed integer literal.

Source

fn i32_suffixed(n: i32) -> Self

Suffixed integer literal.

Source

fn i64_suffixed(n: i64) -> Self

Suffixed integer literal.

Source

fn i128_suffixed(n: i128) -> Self

Suffixed integer literal.

Source

fn isize_suffixed(n: isize) -> Self

Suffixed integer literal.

Source

fn u8_suffixed(n: u8) -> Self

Suffixed integer literal.

Source

fn u16_suffixed(n: u16) -> Self

Suffixed integer literal.

Source

fn u32_suffixed(n: u32) -> Self

Suffixed integer literal.

Source

fn u64_suffixed(n: u64) -> Self

Suffixed integer literal.

Source

fn u128_suffixed(n: u128) -> Self

Suffixed integer literal.

Source

fn usize_suffixed(n: usize) -> Self

Suffixed integer literal.

Source

fn i8_unsuffixed(n: i8) -> Self

Unsuffixed integer literal.

Source

fn i16_unsuffixed(n: i16) -> Self

Unsuffixed integer literal.

Source

fn i32_unsuffixed(n: i32) -> Self

Unsuffixed integer literal.

Source

fn i64_unsuffixed(n: i64) -> Self

Unsuffixed integer literal.

Source

fn i128_unsuffixed(n: i128) -> Self

Unsuffixed integer literal.

Source

fn isize_unsuffixed(n: isize) -> Self

Unsuffixed integer literal.

Source

fn u8_unsuffixed(n: u8) -> Self

Unsuffixed integer literal.

Source

fn u16_unsuffixed(n: u16) -> Self

Unsuffixed integer literal.

Source

fn u32_unsuffixed(n: u32) -> Self

Unsuffixed integer literal.

Source

fn u64_unsuffixed(n: u64) -> Self

Unsuffixed integer literal.

Source

fn u128_unsuffixed(n: u128) -> Self

Unsuffixed integer literal.

Source

fn usize_unsuffixed(n: usize) -> Self

Unsuffixed integer literal.

Source

fn f32_suffixed(n: f32) -> Self

Suffixed floating-point literal.

Source

fn f64_suffixed(n: f64) -> Self

Suffixed floating-point literal.

Source

fn f32_unsuffixed(n: f32) -> Self

Unsuffixed floating-point literal.

Source

fn f64_unsuffixed(n: f64) -> Self

Unsuffixed floating-point literal.

Source

fn string(str: &str) -> Self

String literal.

Source

fn character(c: char) -> Self

Character literal.

Source

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.

Source

fn byte_string(bytes: &[u8]) -> Self

Byte string literal.

Source

fn c_string(str: &CStr) -> Self

C string 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.

Source

fn span(&self) -> Self::Span

The span of this literal.

Source

fn set_span(&mut self, span: Self::Span)

Set the span of this 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.
Source§

fn i8_suffixed(n: i8) -> Self

Source§

fn i16_suffixed(n: i16) -> Self

Source§

fn i32_suffixed(n: i32) -> Self

Source§

fn i64_suffixed(n: i64) -> Self

Source§

fn i128_suffixed(n: i128) -> Self

Source§

fn isize_suffixed(n: isize) -> Self

Source§

fn u8_suffixed(n: u8) -> Self

Source§

fn u16_suffixed(n: u16) -> Self

Source§

fn u32_suffixed(n: u32) -> Self

Source§

fn u64_suffixed(n: u64) -> Self

Source§

fn u128_suffixed(n: u128) -> Self

Source§

fn usize_suffixed(n: usize) -> Self

Source§

fn i8_unsuffixed(n: i8) -> Self

Source§

fn i16_unsuffixed(n: i16) -> Self

Source§

fn i32_unsuffixed(n: i32) -> Self

Source§

fn i64_unsuffixed(n: i64) -> Self

Source§

fn i128_unsuffixed(n: i128) -> Self

Source§

fn isize_unsuffixed(n: isize) -> Self

Source§

fn u8_unsuffixed(n: u8) -> Self

Source§

fn u16_unsuffixed(n: u16) -> Self

Source§

fn u32_unsuffixed(n: u32) -> Self

Source§

fn u64_unsuffixed(n: u64) -> Self

Source§

fn u128_unsuffixed(n: u128) -> Self

Source§

fn usize_unsuffixed(n: usize) -> Self

Source§

fn f32_unsuffixed(n: f32) -> Self

Source§

fn f32_suffixed(n: f32) -> Self

Source§

fn f64_unsuffixed(n: f64) -> Self

Source§

fn f64_suffixed(n: f64) -> Self

Source§

fn string(str: &str) -> Self

Source§

fn character(c: char) -> Self

Source§

fn byte_string(bytes: &[u8]) -> Self

Source§

fn byte_character(b: u8) -> Self

Source§

fn c_string(str: &CStr) -> Self

Source§

fn span(&self) -> Self::Span

Source§

fn set_span(&mut self, span: Self::Span)

Source§

impl Literal for Literal

Available on crate feature proc-macro2 only.
Source§

fn i8_suffixed(n: i8) -> Self

Source§

fn i16_suffixed(n: i16) -> Self

Source§

fn i32_suffixed(n: i32) -> Self

Source§

fn i64_suffixed(n: i64) -> Self

Source§

fn i128_suffixed(n: i128) -> Self

Source§

fn isize_suffixed(n: isize) -> Self

Source§

fn u8_suffixed(n: u8) -> Self

Source§

fn u16_suffixed(n: u16) -> Self

Source§

fn u32_suffixed(n: u32) -> Self

Source§

fn u64_suffixed(n: u64) -> Self

Source§

fn u128_suffixed(n: u128) -> Self

Source§

fn usize_suffixed(n: usize) -> Self

Source§

fn i8_unsuffixed(n: i8) -> Self

Source§

fn i16_unsuffixed(n: i16) -> Self

Source§

fn i32_unsuffixed(n: i32) -> Self

Source§

fn i64_unsuffixed(n: i64) -> Self

Source§

fn i128_unsuffixed(n: i128) -> Self

Source§

fn isize_unsuffixed(n: isize) -> Self

Source§

fn u8_unsuffixed(n: u8) -> Self

Source§

fn u16_unsuffixed(n: u16) -> Self

Source§

fn u32_unsuffixed(n: u32) -> Self

Source§

fn u64_unsuffixed(n: u64) -> Self

Source§

fn u128_unsuffixed(n: u128) -> Self

Source§

fn usize_unsuffixed(n: usize) -> Self

Source§

fn f32_unsuffixed(n: f32) -> Self

Source§

fn f32_suffixed(n: f32) -> Self

Source§

fn f64_unsuffixed(n: f64) -> Self

Source§

fn f64_suffixed(n: f64) -> Self

Source§

fn string(str: &str) -> Self

Source§

fn character(c: char) -> Self

Source§

fn byte_string(bytes: &[u8]) -> Self

Source§

fn byte_character(b: u8) -> Self

Source§

fn c_string(str: &CStr) -> Self

Source§

fn span(&self) -> Self::Span

Source§

fn set_span(&mut self, span: Self::Span)

Implementors§