[−][src]Struct git_packetline::Provider
Read pack lines one after another, without consuming more than needed from the underlying
Read
. Flush
lines cause the reader to stop producing lines forever,
leaving Read
at the start of whatever comes next.
Implementations
impl<T> Provider<T> where
T: Read,
[src]
T: Read,
pub fn new(read: T, delimiters: &'static [PacketLine<'static>]) -> Self
[src]
Return a new instance from read
which will stop decoding packet lines when receiving one of the given delimiters
.
pub fn stopped_at(&self) -> Option<PacketLine<'static>>
[src]
Returns the packet line that stopped the iteration, or
None
if the end wasn't reached yet, on EOF, or if fail_on_err_lines()
was true.
pub fn replace(&mut self, read: T) -> T
[src]
Replace the reader used with the given read
, resetting all other iteration state as well.
pub fn reset(&mut self)
[src]
Reset all iteration state allowing to continue a stopped iteration that is not yet at EOF.
This can happen once a delimiter is reached.
pub fn reset_with(&mut self, delimiters: &'static [PacketLine<'static>])
[src]
Similar to reset()
with support to changing the delimiters
.
pub fn fail_on_err_lines(&mut self, value: bool)
[src]
If value
is true
the provider will check for special ERR
packet lines and stop iteration when one is encountered.
Use [stopped_at()]
Provider::stopped_at() to inspect the cause of the end of the iteration.
pub fn read_line(&mut self) -> Option<Result<Result<PacketLine<'_>, Error>>>
[src]
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:
- EOF
- ERR packet line encountered if
fail_on_err_lines()
is true. - A
delimiter
packet line encountered
pub fn peek_buffer_replace_and_truncate(
&mut self,
position: usize,
replace_with: u8
)
[src]
&mut self,
position: usize,
replace_with: u8
)
Modify the peek buffer, overwriting the byte at position
with the given byte to replace_with
.
Note that position
does not include the 4 bytes prefix (they are invisible outside the reader)
pub fn peek_line(&mut self) -> Option<Result<Result<PacketLine<'_>, Error>>>
[src]
Peek the next packet line without consuming it.
Multiple calls to peek will return the same packet line, if there is one.
pub fn as_read_with_sidebands<F: FnMut(bool, &[u8])>(
&mut self,
handle_progress: F
) -> ReadWithSidebands<'_, T, F>ⓘNotable traits for ReadWithSidebands<'a, T, F>
impl<'a, T, F> Read for ReadWithSidebands<'a, T, F> where
T: Read,
F: FnMut(bool, &[u8]),
[src]
&mut self,
handle_progress: F
) -> ReadWithSidebands<'_, T, F>ⓘ
Notable traits for ReadWithSidebands<'a, T, F>
impl<'a, T, F> Read for ReadWithSidebands<'a, T, F> where
T: Read,
F: FnMut(bool, &[u8]),
Return this instance as implementor of Read
assuming side bands to be used in all received packet lines.
Each invocation of read_line()
returns a packet line.
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.
Please note that side bands need to be negotiated with the server.
pub fn as_read_without_sidebands<F: FnMut(bool, &[u8])>(
&mut self
) -> ReadWithSidebands<'_, T, F>ⓘNotable traits for ReadWithSidebands<'a, T, F>
impl<'a, T, F> Read for ReadWithSidebands<'a, T, F> where
T: Read,
F: FnMut(bool, &[u8]),
[src]
&mut self
) -> ReadWithSidebands<'_, T, F>ⓘ
Notable traits for ReadWithSidebands<'a, T, F>
impl<'a, T, F> Read for ReadWithSidebands<'a, T, F> where
T: Read,
F: FnMut(bool, &[u8]),
Same as as_read_with_sidebands(…)
, but for channels without side band support.
The type parameter F
needs to be configured for this method to be callable using the 'turbofish' operator.
Use as_read()
.
pub fn as_read(&mut self) -> ReadWithSidebands<'_, T, fn(_: bool, _: &[u8])>ⓘNotable traits for ReadWithSidebands<'a, T, F>
impl<'a, T, F> Read for ReadWithSidebands<'a, T, F> where
T: Read,
F: FnMut(bool, &[u8]),
[src]
Notable traits for ReadWithSidebands<'a, T, F>
impl<'a, T, F> Read for ReadWithSidebands<'a, T, F> where
T: Read,
F: FnMut(bool, &[u8]),
Same as as_read_with_sidebands(…)
, but for channels without side band support.
Due to the preconfigured function type this method can be called without 'turbofish'.
Auto Trait Implementations
impl<T> RefUnwindSafe for Provider<T> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T> Send for Provider<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for Provider<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for Provider<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for Provider<T> where
T: UnwindSafe,
[src]
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,