Lines Matching full:literal

546     /// A literal character (`'a'`), string (`"hello"`), number (`2.3`), etc.
547 Literal(Literal), enumerator
558 TokenTree::Literal(t) => t.span(), in span()
572 TokenTree::Literal(t) => t.set_span(span), in set_span()
595 impl From<Literal> for TokenTree {
596 fn from(g: Literal) -> Self { in from()
597 TokenTree::Literal(g) in from()
611 TokenTree::Literal(t) => Display::fmt(t, f), in fmt()
630 TokenTree::Literal(t) => Debug::fmt(t, f), in fmt()
1056 /// A literal string (`"hello"`), byte string (`b"hello"`), character (`'a'`),
1063 pub struct Literal { struct
1064 inner: imp::Literal, argument
1070 /// Creates a new suffixed integer literal with the specified value.
1076 /// broken into two tokens (`-` and positive literal).
1081 pub fn $name(n: $kind) -> Literal { argument
1082 Literal::_new(imp::Literal::$name(n))
1089 /// Creates a new unsuffixed integer literal with the specified value.
1094 /// `Literal::i8_unsuffixed(1)` are equivalent to
1095 /// `Literal::u32_unsuffixed(1)`. Literals created from negative numbers
1097 /// be broken into two tokens (`-` and positive literal).
1102 pub fn $name(n: $kind) -> Literal {
1103 Literal::_new(imp::Literal::$name(n))
1108 impl Literal { implementation
1109 fn _new(inner: imp::Literal) -> Self { in _new()
1110 Literal { in _new()
1116 fn _new_fallback(inner: fallback::Literal) -> Self { in _new_fallback()
1117 Literal { in _new_fallback()
1118 inner: imp::Literal::from(inner), in _new_fallback()
1153 /// Creates a new unsuffixed floating-point literal.
1155 /// This constructor is similar to those like `Literal::i8_unsuffixed` where
1160 /// and positive literal).
1166 pub fn f64_unsuffixed(f: f64) -> Literal { in f64_unsuffixed() argument
1168 Literal::_new(imp::Literal::f64_unsuffixed(f)) in f64_unsuffixed()
1171 /// Creates a new suffixed floating-point literal.
1173 /// This constructor will create a literal like `1.0f64` where the value
1178 /// tokens (`-` and positive literal).
1184 pub fn f64_suffixed(f: f64) -> Literal { in f64_suffixed() argument
1186 Literal::_new(imp::Literal::f64_suffixed(f)) in f64_suffixed()
1189 /// Creates a new unsuffixed floating-point literal.
1191 /// This constructor is similar to those like `Literal::i8_unsuffixed` where
1196 /// and positive literal).
1202 pub fn f32_unsuffixed(f: f32) -> Literal { in f32_unsuffixed() argument
1204 Literal::_new(imp::Literal::f32_unsuffixed(f)) in f32_unsuffixed()
1207 /// Creates a new suffixed floating-point literal.
1209 /// This constructor will create a literal like `1.0f32` where the value
1214 /// tokens (`-` and positive literal).
1220 pub fn f32_suffixed(f: f32) -> Literal { in f32_suffixed() argument
1222 Literal::_new(imp::Literal::f32_suffixed(f)) in f32_suffixed()
1225 /// String literal.
1226 pub fn string(string: &str) -> Literal { in string() argument
1227 Literal::_new(imp::Literal::string(string)) in string()
1230 /// Character literal.
1231 pub fn character(ch: char) -> Literal { in character() argument
1232 Literal::_new(imp::Literal::character(ch)) in character()
1235 /// Byte character literal.
1236 pub fn byte_character(byte: u8) -> Literal { in byte_character() argument
1237 Literal::_new(imp::Literal::byte_character(byte)) in byte_character()
1240 /// Byte string literal.
1241 pub fn byte_string(bytes: &[u8]) -> Literal { in byte_string() argument
1242 Literal::_new(imp::Literal::byte_string(bytes)) in byte_string()
1245 /// C string literal.
1246 pub fn c_string(string: &CStr) -> Literal { in c_string() argument
1247 Literal::_new(imp::Literal::c_string(string)) in c_string()
1250 /// Returns the span encompassing this literal.
1255 /// Configures the span associated for this literal.
1264 /// Warning: the underlying [`proc_macro::Literal::subspan`] method is
1272 // token out of a macro_rules $:literal token, which is already known to be
1273 // a valid literal. This avoids reparsing/validating the literal's string
1277 Literal::_new(unsafe { imp::Literal::from_str_unchecked(repr) }) in from_str_unchecked()
1281 impl FromStr for Literal { implementation
1285 match imp::Literal::from_str_checked(repr) { in from_str()
1286 Ok(lit) => Ok(Literal::_new(lit)), in from_str()
1295 impl Debug for Literal { implementation
1301 impl Display for Literal { implementation