improve boundary management

This commit is contained in:
Quentin 2023-07-24 10:27:32 +02:00
parent 6c74860f82
commit 28873ce073
Signed by: quentin
GPG key ID: E9602264D639FF68

View file

@ -1,4 +1,4 @@
use nom::{bytes::complete::tag, combinator::opt, sequence::tuple, IResult};
use nom::{branch::alt, bytes::complete::tag, combinator::{eof, opt}, sequence::tuple, IResult};
use crate::text::whitespace::obs_crlf;
@ -15,7 +15,7 @@ pub fn boundary<'a>(boundary: &[u8]) -> impl Fn(&'a [u8]) -> IResult<&'a [u8], D
tag(b"--"),
tag(boundary),
opt(tag(b"--")),
opt(obs_crlf),
alt((obs_crlf, eof)),
))(input)?;
match last {
Some(_) => Ok((rest, Delimiter::Last)),