Trait gix_transport::client::ReadlineBufRead

source ·
pub trait ReadlineBufRead: BufRead {
    // Required methods
    fn readline(&mut self) -> Option<Result<Result<PacketLineRef<'_>, Error>>>;
    fn readline_str(&mut self, line: &mut String) -> Result<usize>;
}
Available on crate feature blocking-client only.
Expand description

This trait exists to get a version of a gix_packetline::Provider without type parameters, but leave support for reading lines directly without forcing them through String.

For the sake of usability, it also implements std::io::BufRead making it trivial to read pack files while keeping open the option to read individual lines with low overhead.

Required Methods§

source

fn readline(&mut self) -> Option<Result<Result<PacketLineRef<'_>, Error>>>

Read a packet line into the internal buffer and return it.

Returns None if the end of iteration is reached because of one of the following:

  • natural EOF
  • ERR packet line encountered
  • A delimiter packet line encountered
source

fn readline_str(&mut self, line: &mut String) -> Result<usize>

Read a line similar to BufRead::read_line(), but assure it doesn’t try to find newlines which might concatenate multiple distinct packet lines.

Making this a trait method allows to handle differences between async and blocking.

Implementations on Foreign Types§

source§

impl<'a, T: Read> ReadlineBufRead for WithSidebands<'a, T, HandleProgress<'a>>

source§

fn readline(&mut self) -> Option<Result<Result<PacketLineRef<'_>, Error>>>

source§

fn readline_str(&mut self, line: &mut String) -> Result<usize>

source§

impl<'a, T: ReadlineBufRead + ?Sized + 'a> ReadlineBufRead for Box<T>

source§

fn readline(&mut self) -> Option<Result<Result<PacketLineRef<'_>, Error>>>

source§

fn readline_str(&mut self, line: &mut String) -> Result<usize>

source§

impl<T: Read> ReadlineBufRead for WithSidebands<'_, T, fn(_: bool, _: &[u8]) -> ProgressAction>

source§

fn readline(&mut self) -> Option<Result<Result<PacketLineRef<'_>, Error>>>

source§

fn readline_str(&mut self, line: &mut String) -> Result<usize>

Implementors§