fixup! add parse_many_into2 which supports capturing two different data types

This commit is contained in:
Edward Rudd 2022-10-18 21:25:40 -04:00
parent 9f7aedc8b0
commit 6146e0c399

View file

@ -45,14 +45,22 @@ where
{ {
let mut other = Vec::new(); let mut other = Vec::new();
parse_many_into2::<_, (), _, _, _>(input, into, &mut other, unsolicited, |response| match map( parse_many_into2::<_, (), _, _, _>(
response, input,
)? { into,
MapOrNot::Map(t) => Ok(MapOrNot2::Map1(t)), &mut other,
MapOrNot::MapVec(t) => Ok(MapOrNot2::MapVec1(t)), unsolicited,
MapOrNot::Not(t) => Ok(MapOrNot2::Not(t)), |response| match map(response)? {
MapOrNot::Ignore => Ok(MapOrNot2::Ignore), MapOrNot::Map(t) => Ok(MapOrNot2::Map1(t)),
}) MapOrNot::MapVec(t) => Ok(MapOrNot2::MapVec1(t)),
MapOrNot::Not(t) => Ok(MapOrNot2::Not(t)),
MapOrNot::Ignore => Ok(MapOrNot2::Ignore),
},
)?;
assert_eq!(other.len(), 0);
Ok(())
} }
/// Parse and return an expected single `T` Response with `F`. /// Parse and return an expected single `T` Response with `F`.