ezk_internal/lib.rs
1//! Internal EZK util functions shared between crates.
2
3mod ws;
4
5pub type IResult<I, O> = nom::IResult<I, O, nom::error::VerboseError<I>>;
6use nom::error::VerboseError;
7pub use nom::Finish;
8pub use ws::ws;
9
10pub fn verbose_error_to_owned(i: VerboseError<&str>) -> VerboseError<String> {
11 VerboseError {
12 errors: i
13 .errors
14 .into_iter()
15 .map(|(i, kind)| (i.into(), kind))
16 .collect(),
17 }
18}
19
20pub fn identity<E>() -> impl Fn(&str) -> nom::IResult<&str, &str, E> {
21 move |i| Ok(("", i))
22}