From 28873ce07340363ca1c82d09bb826283547e97c8 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Mon, 24 Jul 2023 10:27:32 +0200 Subject: [PATCH] improve boundary management --- src/text/boundary.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/text/boundary.rs b/src/text/boundary.rs index 2d0adc9..9d0e490 100644 --- a/src/text/boundary.rs +++ b/src/text/boundary.rs @@ -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)),