diff options
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -78,7 +78,7 @@ //! a different thread. // Proc-macro2 types in rustdoc of other crates get linked to here. -#![doc(html_root_url = "https://docs.rs/proc-macro2/1.0.26")] +#![doc(html_root_url = "https://docs.rs/proc-macro2/1.0.27")] #![cfg_attr(any(proc_macro_span, super_unstable), feature(proc_macro_span))] #![cfg_attr(super_unstable, feature(proc_macro_raw_ident, proc_macro_def_site))] #![cfg_attr(doc_cfg, feature(doc_cfg))] @@ -1203,6 +1203,17 @@ impl Literal { } } +impl FromStr for Literal { + type Err = LexError; + + fn from_str(repr: &str) -> Result<Self, LexError> { + repr.parse().map(Literal::_new).map_err(|inner| LexError { + inner, + _marker: Marker, + }) + } +} + impl Debug for Literal { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { Debug::fmt(&self.inner, f) |