summaryrefslogtreecommitdiffstats
path: root/vendor/winnow/examples/http
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /vendor/winnow/examples/http
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/winnow/examples/http')
-rw-r--r--vendor/winnow/examples/http/parser.rs22
-rw-r--r--vendor/winnow/examples/http/parser_streaming.rs22
2 files changed, 22 insertions, 22 deletions
diff --git a/vendor/winnow/examples/http/parser.rs b/vendor/winnow/examples/http/parser.rs
index 83402fe26..f03b77eb7 100644
--- a/vendor/winnow/examples/http/parser.rs
+++ b/vendor/winnow/examples/http/parser.rs
@@ -1,4 +1,4 @@
-use winnow::{bytes::take_while1, character::line_ending, multi::many1, IResult, Parser};
+use winnow::{ascii::line_ending, combinator::repeat, token::take_while, IResult, Parser};
pub type Stream<'i> = &'i [u8];
@@ -44,17 +44,17 @@ pub fn parse(data: &[u8]) -> Option<Vec<(Request<'_>, Vec<Header<'_>>)>> {
fn request(input: Stream<'_>) -> IResult<Stream<'_>, (Request<'_>, Vec<Header<'_>>)> {
let (input, req) = request_line(input)?;
- let (input, h) = many1(message_header).parse_next(input)?;
+ let (input, h) = repeat(1.., message_header).parse_next(input)?;
let (input, _) = line_ending(input)?;
Ok((input, (req, h)))
}
fn request_line(input: Stream<'_>) -> IResult<Stream<'_>, Request<'_>> {
- let (input, method) = take_while1(is_token).parse_next(input)?;
- let (input, _) = take_while1(is_space).parse_next(input)?;
- let (input, uri) = take_while1(is_not_space).parse_next(input)?;
- let (input, _) = take_while1(is_space).parse_next(input)?;
+ let (input, method) = take_while(1.., is_token).parse_next(input)?;
+ let (input, _) = take_while(1.., is_space).parse_next(input)?;
+ let (input, uri) = take_while(1.., is_not_space).parse_next(input)?;
+ let (input, _) = take_while(1.., is_space).parse_next(input)?;
let (input, version) = http_version(input)?;
let (input, _) = line_ending(input)?;
@@ -70,23 +70,23 @@ fn request_line(input: Stream<'_>) -> IResult<Stream<'_>, Request<'_>> {
fn http_version(input: Stream<'_>) -> IResult<Stream<'_>, &[u8]> {
let (input, _) = "HTTP/".parse_next(input)?;
- let (input, version) = take_while1(is_version).parse_next(input)?;
+ let (input, version) = take_while(1.., is_version).parse_next(input)?;
Ok((input, version))
}
fn message_header_value(input: Stream<'_>) -> IResult<Stream<'_>, &[u8]> {
- let (input, _) = take_while1(is_horizontal_space).parse_next(input)?;
- let (input, data) = take_while1(not_line_ending).parse_next(input)?;
+ let (input, _) = take_while(1.., is_horizontal_space).parse_next(input)?;
+ let (input, data) = take_while(1.., not_line_ending).parse_next(input)?;
let (input, _) = line_ending(input)?;
Ok((input, data))
}
fn message_header(input: Stream<'_>) -> IResult<Stream<'_>, Header<'_>> {
- let (input, name) = take_while1(is_token).parse_next(input)?;
+ let (input, name) = take_while(1.., is_token).parse_next(input)?;
let (input, _) = ':'.parse_next(input)?;
- let (input, value) = many1(message_header_value).parse_next(input)?;
+ let (input, value) = repeat(1.., message_header_value).parse_next(input)?;
Ok((input, Header { name, value }))
}
diff --git a/vendor/winnow/examples/http/parser_streaming.rs b/vendor/winnow/examples/http/parser_streaming.rs
index f7774b7bc..d3b2c4aaa 100644
--- a/vendor/winnow/examples/http/parser_streaming.rs
+++ b/vendor/winnow/examples/http/parser_streaming.rs
@@ -1,5 +1,5 @@
use winnow::{
- bytes::take_while1, character::line_ending, multi::many1, stream::Partial, IResult, Parser,
+ ascii::line_ending, combinator::repeat, stream::Partial, token::take_while, IResult, Parser,
};
pub type Stream<'i> = Partial<&'i [u8]>;
@@ -46,17 +46,17 @@ pub fn parse(data: &[u8]) -> Option<Vec<(Request<'_>, Vec<Header<'_>>)>> {
fn request(input: Stream<'_>) -> IResult<Stream<'_>, (Request<'_>, Vec<Header<'_>>)> {
let (input, req) = request_line(input)?;
- let (input, h) = many1(message_header).parse_next(input)?;
+ let (input, h) = repeat(1.., message_header).parse_next(input)?;
let (input, _) = line_ending(input)?;
Ok((input, (req, h)))
}
fn request_line(input: Stream<'_>) -> IResult<Stream<'_>, Request<'_>> {
- let (input, method) = take_while1(is_token).parse_next(input)?;
- let (input, _) = take_while1(is_space).parse_next(input)?;
- let (input, uri) = take_while1(is_not_space).parse_next(input)?;
- let (input, _) = take_while1(is_space).parse_next(input)?;
+ let (input, method) = take_while(1.., is_token).parse_next(input)?;
+ let (input, _) = take_while(1.., is_space).parse_next(input)?;
+ let (input, uri) = take_while(1.., is_not_space).parse_next(input)?;
+ let (input, _) = take_while(1.., is_space).parse_next(input)?;
let (input, version) = http_version(input)?;
let (input, _) = line_ending(input)?;
@@ -72,23 +72,23 @@ fn request_line(input: Stream<'_>) -> IResult<Stream<'_>, Request<'_>> {
fn http_version(input: Stream<'_>) -> IResult<Stream<'_>, &[u8]> {
let (input, _) = "HTTP/".parse_next(input)?;
- let (input, version) = take_while1(is_version).parse_next(input)?;
+ let (input, version) = take_while(1.., is_version).parse_next(input)?;
Ok((input, version))
}
fn message_header_value(input: Stream<'_>) -> IResult<Stream<'_>, &[u8]> {
- let (input, _) = take_while1(is_horizontal_space).parse_next(input)?;
- let (input, data) = take_while1(not_line_ending).parse_next(input)?;
+ let (input, _) = take_while(1.., is_horizontal_space).parse_next(input)?;
+ let (input, data) = take_while(1.., not_line_ending).parse_next(input)?;
let (input, _) = line_ending(input)?;
Ok((input, data))
}
fn message_header(input: Stream<'_>) -> IResult<Stream<'_>, Header<'_>> {
- let (input, name) = take_while1(is_token).parse_next(input)?;
+ let (input, name) = take_while(1.., is_token).parse_next(input)?;
let (input, _) = ':'.parse_next(input)?;
- let (input, value) = many1(message_header_value).parse_next(input)?;
+ let (input, value) = repeat(1.., message_header_value).parse_next(input)?;
Ok((input, Header { name, value }))
}