Skip to main content

oni_comb_parser/text/
take_while.rs

1pub use crate::primitive::take::Take;
2pub use crate::primitive::take_while0::TakeWhile0;
3pub use crate::primitive::take_while1::TakeWhile1;
4pub use crate::primitive::take_while_n_m::TakeWhileNM;
5
6use crate::str_input::StrInput;
7
8pub fn take<'a>(n: usize) -> Take<StrInput<'a>> {
9  crate::primitive::take::take(n)
10}
11
12pub fn take_while0<'a, F: FnMut(char) -> bool>(f: F) -> TakeWhile0<F, StrInput<'a>> {
13  crate::primitive::take_while0::take_while0(f)
14}
15
16pub fn take_while1<'a, F: FnMut(char) -> bool>(f: F) -> TakeWhile1<F, StrInput<'a>> {
17  crate::primitive::take_while1::take_while1(f)
18}
19
20pub fn take_while_n_m<'a, F: FnMut(char) -> bool>(min: usize, max: usize, f: F) -> TakeWhileNM<F, StrInput<'a>> {
21  crate::primitive::take_while_n_m::take_while_n_m(min, max, f)
22}