bspeice
Likely easier to read into memory, but using something like BufReader would make that easier. Most of the nom
functions are abstracted over various Input*
traits, so maybe have a concrete Read
er that implements those?
parse_radius_attribute
is called with an empty array, an example below:i: [20, 1f, 4d, 49, 57, 56, 42, 41, 42, 2d, 53, 57, 30, 31, 2d, 4d, 49, 54, 43, 48, 45, 4c, 4c, 2d, 39, 31, 35, 41, 2d, 57, 49]
i: []
i: [20, 1f, 4d, 49, 57, 56, 42, 41, 42, 2d, 53, 57, 30, 31, 2d, 4d, 49, 54, 43, 48, 45, 4c, 4c, 2d, 39, 31, 35, 41, 2d, 57, 49]
&[& [u8]]
, how could I make it working with nom?
take_until
45 | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>(l: List) -> impl Fn(I) -> IResult<I, O, E> {
| ------------ required by this bound in `nom::branch::alt`
|
= note: expected enum `std::result::Result<(&str, &str), nom::internal::Err<(&str, nom::error::ErrorKind)>>`
found enum `std::result::Result<(&str, screen::settings::administration::parse_search::Criteria<'_>), nom::internal::Err<(&str, nom::error::ErrorKind)>>`
tuple
that returns a single slice
recognize
looks like it'll help
fn ident(s: &[u8]) -> IResult<&[u8], &[u8]> {
recognize(preceded(
|i| if let Some(&l) = s.get(0) {
if letter(l) {
Ok((&s[1..], ()))
} else {
Err(Err::Error(ParseError::from_error_kind(s, ErrorKind::OneOf)))
}
} else {
Err(Err::Incomplete(Needed::Size(1)))
},
take_while(|b| matches!(b, b'A'..=b'Z' | b'a'..=b'z' | b'_' | b'0'..=b'9'))
))(s)
}