diff --git a/src/main.rs b/src/main.rs index 63db4e1..b6359e2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,12 +2,20 @@ use nom::bytes::complete::tag; fn main() { let input = "this is my test input".to_owned(); + let wrapped_input = WrappedInput::new(input.as_str()); - let output = tag::<_, _, (_, nom::error::ErrorKind)>("this")(input.as_str()).unwrap(); + let output = tag::<_, _, (_, nom::error::ErrorKind)>("this")(wrapped_input).unwrap(); println!("{:#?}", output); } +#[derive(Debug)] struct WrappedInput<'s> { contents: &'s str, } + +impl<'s> WrappedInput<'s> { + pub fn new(input: &'s str) -> Self { + WrappedInput { contents: input } + } +}