Skip to content

Commit 14c9093

Browse files
committed
refactor
1 parent 08b891b commit 14c9093

File tree

4 files changed

+18
-16
lines changed

4 files changed

+18
-16
lines changed

git-packetline/src/read/async_io.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
use crate::{decode, read::WithSidebands, PacketLine, StreamingPeekableIter, MAX_LINE_LEN, U16_HEX_BYTES};
1+
use crate::{
2+
decode,
3+
read::{ExhaustiveOutcome, WithSidebands},
4+
PacketLine, StreamingPeekableIter, MAX_LINE_LEN, U16_HEX_BYTES,
5+
};
26
use bstr::ByteSlice;
37
use futures_io::AsyncRead;
48
use futures_lite::AsyncReadExt;
59
use std::io;
610

7-
type ExhaustiveOutcome<'a> = (
8-
bool, // is_done
9-
Option<PacketLine<'static>>, // stopped_at
10-
Option<io::Result<Result<PacketLine<'a>, decode::Error>>>, // actual method result
11-
);
12-
1311
/// Non-IO methods
1412
impl<T> StreamingPeekableIter<T>
1513
where

git-packetline/src/read/blocking_io.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
use crate::{decode, read::WithSidebands, PacketLine, StreamingPeekableIter, MAX_LINE_LEN, U16_HEX_BYTES};
1+
use crate::{
2+
decode,
3+
read::{ExhaustiveOutcome, WithSidebands},
4+
PacketLine, StreamingPeekableIter, MAX_LINE_LEN, U16_HEX_BYTES,
5+
};
26
use bstr::ByteSlice;
37
use std::io;
48

5-
type ExhaustiveOutcome<'a> = (
6-
bool, // is_done
7-
Option<PacketLine<'static>>, // stopped_at
8-
Option<io::Result<Result<PacketLine<'a>, decode::Error>>>, // actual method result
9-
);
10-
119
/// Non-IO methods
1210
impl<T> StreamingPeekableIter<T>
1311
where

git-packetline/src/read/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
use crate::MAX_LINE_LEN;
33
use crate::{PacketLine, U16_HEX_BYTES};
44

5+
type ExhaustiveOutcome<'a> = (
6+
bool, // is_done
7+
Option<PacketLine<'static>>, // stopped_at
8+
Option<std::io::Result<Result<PacketLine<'a>, crate::decode::Error>>>, // actual method result
9+
);
10+
511
/// Read pack lines one after another, without consuming more than needed from the underlying
612
/// [`Read`][std::io::Read]. [`Flush`][PacketLine::Flush] lines cause the reader to stop producing lines forever,
713
/// leaving [`Read`][std::io::Read] at the start of whatever comes next.

git-transport/src/client/blocking_io/bufread_ext.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use std::{
1010
pub type HandleProgress = Box<dyn FnMut(bool, &[u8])>;
1111

1212
/// This trait exists to get a version of a `git_packetline::Provider` without type parameters.
13-
/// For the sake of usability, it also implements [`std::io::BufRead`] making it trivial to (eventually)
14-
/// read pack files while keeping the possibility to read individual lines with low overhead.
13+
/// For the sake of usability, it also implements [`std::io::BufRead`] making it trivial to
14+
/// read pack files while keeping open the option to read individual lines with low overhead.
1515
pub trait ExtendedBufRead: io::BufRead {
1616
/// Set the handler to which progress will be delivered.
1717
///

0 commit comments

Comments
 (0)