File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.
44
55
66## [ Unreleased]
7+ - Add ` Literal::raw_input `
78
89## [ 0.5.0] - 2025-07-25
910** Note** : this is supposed to be essentially a 1.0 release candidate.
Original file line number Diff line number Diff line change @@ -268,6 +268,24 @@ impl<B: Buffer> Literal<B> {
268268 Literal :: CString ( l) => l. suffix ( ) ,
269269 }
270270 }
271+
272+ /// Returns the raw input that was passed to `parse`.
273+ ///
274+ /// This can be used to compare literals with different `Buffer` types.
275+ /// Note: this does not necessarily point to the same string buffer, in
276+ /// particular, bool literals just return a `&'static str`.
277+ pub fn raw_input ( & self ) -> & str {
278+ match self {
279+ Literal :: Bool ( l) => l. as_str ( ) ,
280+ Literal :: Integer ( l) => l. raw_input ( ) ,
281+ Literal :: Float ( l) => l. raw_input ( ) ,
282+ Literal :: Char ( l) => l. raw_input ( ) ,
283+ Literal :: String ( l) => l. raw_input ( ) ,
284+ Literal :: Byte ( l) => l. raw_input ( ) ,
285+ Literal :: ByteString ( l) => l. raw_input ( ) ,
286+ Literal :: CString ( l) => l. raw_input ( ) ,
287+ }
288+ }
271289}
272290
273291impl Literal < & str > {
You can’t perform that action at this time.
0 commit comments