[][src]Struct git_packetline::provider::ReadWithSidebands

pub struct ReadWithSidebands<'a, T, F> where
    T: Read
{ /* fields omitted */ }

An implementor of BufRead yielding packet lines on each call to read_line(). It's also possible to hide the underlying packet lines using the Read implementation which is useful if they represent binary data, like the one of a pack file.

Performance Notice

Reading from this intermediary copies bytes 3 times: OS -> (parent) line provider buffer -> our buffer -> caller's output buffer which won't make this very efficient for huge bandwidths.

Implementations

impl<'a, T> ReadWithSidebands<'a, T, fn(_: bool, _: &[u8])> where
    T: Read
[src]

pub fn new(parent: &'a mut Provider<T>) -> Self[src]

impl<'a, T, F> ReadWithSidebands<'a, T, F> where
    T: Read,
    F: FnMut(bool, &[u8]), 
[src]

pub fn with_progress_handler(
    parent: &'a mut Provider<T>,
    handle_progress: F
) -> Self
[src]

Create a new instance with the given parent provider and the handle_progress function.

Progress or error information will be passed to the given handle_progress(is_error, text) function, with is_error: bool being true in case the text is to be interpreted as error.

pub fn without_progress_handler(parent: &'a mut Provider<T>) -> Self[src]

Create a new instance without a progress handler.

pub fn reset_with(&mut self, delimiters: &'static [PacketLine<'static>])[src]

Forwards to the parent Provider::reset_with()

pub fn stopped_at(&self) -> Option<PacketLine<'static>>[src]

Forwards to the parent Provider::stopped_at()

pub fn set_progress_handler(&mut self, handle_progress: Option<F>)[src]

Set or unset the progress handler.

pub fn peek_data_line(&mut self) -> Option<Result<Result<&[u8], Error>>>[src]

Effectively forwards to the parent Provider::peek_line(), allowing to see what would be returned next on a call to read_line().

Trait Implementations

impl<'a, T, F> BufRead for ReadWithSidebands<'a, T, F> where
    T: Read,
    F: FnMut(bool, &[u8]), 
[src]

impl<'a, T, F> Drop for ReadWithSidebands<'a, T, F> where
    T: Read
[src]

impl<'a, T, F> Read for ReadWithSidebands<'a, T, F> where
    T: Read,
    F: FnMut(bool, &[u8]), 
[src]

Auto Trait Implementations

impl<'a, T, F> RefUnwindSafe for ReadWithSidebands<'a, T, F> where
    F: RefUnwindSafe,
    T: RefUnwindSafe
[src]

impl<'a, T, F> Send for ReadWithSidebands<'a, T, F> where
    F: Send,
    T: Send
[src]

impl<'a, T, F> Sync for ReadWithSidebands<'a, T, F> where
    F: Sync,
    T: Sync
[src]

impl<'a, T, F> Unpin for ReadWithSidebands<'a, T, F> where
    F: Unpin
[src]

impl<'a, T, F> !UnwindSafe for ReadWithSidebands<'a, T, F>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<B> BufReadExt for B where
    B: BufRead
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.