organic/src/main.rs

22 lines
468 B
Rust
Raw Normal View History

2023-08-22 17:20:01 -04:00
use nom::bytes::complete::tag;
2023-08-22 17:11:45 -04:00
fn main() {
2023-08-22 17:20:01 -04:00
let input = "this is my test input".to_owned();
2023-08-22 17:24:26 -04:00
let wrapped_input = WrappedInput::new(input.as_str());
2023-08-22 17:20:01 -04:00
2023-08-22 17:24:26 -04:00
let output = tag::<_, _, (_, nom::error::ErrorKind)>("this")(wrapped_input).unwrap();
2023-08-22 17:20:01 -04:00
println!("{:#?}", output);
}
2023-08-22 17:24:26 -04:00
#[derive(Debug)]
2023-08-22 17:20:01 -04:00
struct WrappedInput<'s> {
contents: &'s str,
2023-08-22 17:11:45 -04:00
}
2023-08-22 17:24:26 -04:00
impl<'s> WrappedInput<'s> {
pub fn new(input: &'s str) -> Self {
WrappedInput { contents: input }
}
}