nom::take_until_either!
[−]
[src]
macro_rules! take_until_either( ($i:expr, $inp:expr) => ( { #[inline(always)] fn as_bytes<T: $crate::AsBytes>(b: &T) -> &[u8] { b.as_bytes() } let expected = $inp; let bytes = as_bytes(&expected); let mut index = 0; let mut parsed = false; for idx in 0..$i.len() { if idx + 1 > $i.len() { index = idx; break; } for &t in bytes.iter() { if $i[idx] == t { parsed = true; index = idx; break; } } if parsed { break; } } if index + 1 > $i.len() { $crate::IResult::Incomplete($crate::Needed::Size(index + 1)) } else { if parsed { $crate::IResult::Done(&$i[index..], &$i[0..index]) } else { $crate::IResult::Error($crate::Err::Position($crate::ErrorCode::TakeUntilEither as u32,$i)) } } } ); );
take_until_either!(tag) => &[T] -> IResult<&[T], &[T]>