Skip to content

Commit

Permalink
[git-packetline] fix compile errors if no features are specified
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed May 18, 2021
1 parent f16b012 commit a2b44c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion git-packetline/src/encode/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ mod blocking_io;
#[cfg(feature = "blocking-io")]
pub use blocking_io::*;

#[cfg(any(feature = "async-io", feature = "blocking-io"))]
pub(crate) fn u16_to_hex(value: u16) -> [u8; 4] {
let mut buf = [0u8; 4];
hex::encode_to_slice((value as u16).to_be_bytes(), &mut buf).expect("two bytes to 4 hex chars never fails");
Expand Down
7 changes: 6 additions & 1 deletion git-packetline/src/read/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use crate::{PacketLine, MAX_LINE_LEN, U16_HEX_BYTES};
#[cfg(any(feature = "blocking-io", feature = "async-io"))]
use crate::MAX_LINE_LEN;
use crate::{PacketLine, U16_HEX_BYTES};

/// Read pack lines one after another, without consuming more than needed from the underlying
/// [`Read`][std::io::Read]. [`Flush`][PacketLine::Flush] lines cause the reader to stop producing lines forever,
Expand All @@ -8,6 +10,7 @@ use crate::{PacketLine, MAX_LINE_LEN, U16_HEX_BYTES};
pub struct StreamingPeekableIter<T> {
read: T,
peek_buf: Vec<u8>,
#[cfg(any(feature = "blocking-io", feature = "async-io"))]
buf: Vec<u8>,
fail_on_err_lines: bool,
delimiters: &'static [PacketLine<'static>],
Expand All @@ -20,6 +23,7 @@ impl<T> StreamingPeekableIter<T> {
pub fn new(read: T, delimiters: &'static [PacketLine<'static>]) -> Self {
StreamingPeekableIter {
read,
#[cfg(any(feature = "blocking-io", feature = "async-io"))]
buf: vec![0; MAX_LINE_LEN],
peek_buf: Vec::new(),
delimiters,
Expand Down Expand Up @@ -90,4 +94,5 @@ mod blocking_io;
mod async_io;

mod sidebands;
#[cfg(any(feature = "blocking-io", feature = "async-io"))]
pub use sidebands::WithSidebands;

0 comments on commit a2b44c8

Please sign in to comment.