Closed pictca closed 4 years ago
In the legendary project clacks use pom = "1.1.0". My current job to merge some legendary code to a new project with current pom version v 3.0 which changed on core API. I'm stuck on define new method on Parser old but it works well source
pom = "1.1.0"
v 3.0
new
fn output<T: 'static>(inner: Parser<u8, T>) -> Parser<u8, Matched<T>> { Parser::new(move |input| { let start = input.position(); let output = inner.parse(input)?; let end = input.position(); Ok(Matched(output, utf8(input.segment(start, end)))) }) } #[derive(Debug, Clone)] pub struct Matched<T>(pub T, pub String); fn utf8(v: Vec<u8>) -> String { String::from_utf8(v).unwrap() }
How can i apply Parser::new with current version?
Parser::new
Try something like:
Parser::new(move |input: &'a [u8], start: usize| { inner.parse(input, start).map(|(_, end)| (&input[start..end], end)) })
thank you
In the legendary project clacks use
pom = "1.1.0"
. My current job to merge some legendary code to a new project with current pom versionv 3.0
which changed on core API. I'm stuck on definenew
method on Parser old but it works well sourceHow can i apply
Parser::new
with current version?