Skip to content

Commit 0e8edef

Browse files
committed
Migrate gix-protocol to winnow
1 parent 72328a3 commit 0e8edef

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

Cargo.lock

Lines changed: 15 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gix-protocol/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ gix-credentials = { version = "^0.18.0", path = "../gix-credentials" }
4949
thiserror = "1.0.32"
5050
serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"]}
5151
bstr = { version = "1.3.0", default-features = false, features = ["std", "unicode"] }
52-
nom = { version = "7", default-features = false, features = ["std"]}
52+
winnow = { version = "0.3.0", features = ["simd"] }
5353
btoi = "0.4.2"
5454

5555
# for async-client

gix-protocol/src/remote_progress.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::convert::TryFrom;
22

33
use bstr::ByteSlice;
4-
use nom::{
4+
use winnow::{
55
bytes::complete::{tag, take_till, take_till1},
66
combinator::{map_res, opt},
77
sequence::{preceded, terminated},
@@ -73,11 +73,11 @@ impl<'a> RemoteProgress<'a> {
7373
}
7474
}
7575

76-
fn parse_number(i: &[u8]) -> nom::IResult<&[u8], usize> {
76+
fn parse_number(i: &[u8]) -> winnow::IResult<&[u8], usize> {
7777
map_res(take_till(|c: u8| !c.is_ascii_digit()), btoi::btoi)(i)
7878
}
7979

80-
fn next_optional_percentage(i: &[u8]) -> nom::IResult<&[u8], Option<u32>> {
80+
fn next_optional_percentage(i: &[u8]) -> winnow::IResult<&[u8], Option<u32>> {
8181
opt(terminated(
8282
preceded(
8383
take_till(|c: u8| c.is_ascii_digit()),
@@ -87,11 +87,11 @@ fn next_optional_percentage(i: &[u8]) -> nom::IResult<&[u8], Option<u32>> {
8787
))(i)
8888
}
8989

90-
fn next_optional_number(i: &[u8]) -> nom::IResult<&[u8], Option<usize>> {
90+
fn next_optional_number(i: &[u8]) -> winnow::IResult<&[u8], Option<usize>> {
9191
opt(preceded(take_till(|c: u8| c.is_ascii_digit()), parse_number))(i)
9292
}
9393

94-
fn parse_progress(line: &[u8]) -> nom::IResult<&[u8], RemoteProgress<'_>> {
94+
fn parse_progress(line: &[u8]) -> winnow::IResult<&[u8], RemoteProgress<'_>> {
9595
let (i, action) = take_till1(|c| c == b':')(line)?;
9696
let (i, percent) = next_optional_percentage(i)?;
9797
let (i, step) = next_optional_number(i)?;

0 commit comments

Comments
 (0)