Struct git_repository::interrupt::Read
source · pub struct Read<R> { /* private fields */ }
Expand description
A wrapper for implementors of std::io::Read
or std::io::BufRead
with interrupt support.
It fails a read while an interrupt was requested.
Implementations§
Trait Implementations§
source§impl<R> BufRead for Read<R>where
R: BufRead,
impl<R> BufRead for Read<R>where R: BufRead,
source§fn fill_buf(&mut self) -> Result<&[u8]>
fn fill_buf(&mut self) -> Result<&[u8]>
Returns the contents of the internal buffer, filling it with more data
from the inner reader if it is empty. Read more
source§fn consume(&mut self, amt: usize)
fn consume(&mut self, amt: usize)
Tells this buffer that
amt
bytes have been consumed from the buffer,
so they should no longer be returned in calls to read
. Read moresource§fn has_data_left(&mut self) -> Result<bool, Error>
fn has_data_left(&mut self) -> Result<bool, Error>
🔬This is a nightly-only experimental API. (
buf_read_has_data_left
)Check if the underlying
Read
has any data left to be read. Read more1.0.0 · source§fn read_until(
&mut self,
byte: u8,
buf: &mut Vec<u8, Global>
) -> Result<usize, Error>
fn read_until( &mut self, byte: u8, buf: &mut Vec<u8, Global> ) -> Result<usize, Error>
1.0.0 · source§fn read_line(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_line(&mut self, buf: &mut String) -> Result<usize, Error>
Read all bytes until a newline (the
0xA
byte) is reached, and append
them to the provided String
buffer. Read moresource§impl<R> Read for Read<R>where
R: Read,
impl<R> Read for Read<R>where R: Read,
source§fn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Pull some bytes from this source into the specified buffer, returning
how many bytes were read. Read more
1.36.0 · source§fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
Like
read
, except that it reads into a slice of buffers. Read moresource§fn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector
)1.0.0 · source§fn read_to_end(&mut self, buf: &mut Vec<u8, Global>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8, Global>) -> Result<usize, Error>
Read all bytes until EOF in this source, placing them into
buf
. Read more1.0.0 · source§fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
Read all bytes until EOF in this source, appending them to
buf
. Read more1.6.0 · source§fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
Read the exact number of bytes required to fill
buf
. Read moresource§fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
read_buf
)Pull some bytes from this source into the specified buffer. Read more
source§fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
read_buf
)Read the exact number of bytes required to fill
cursor
. Read more1.0.0 · source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere Self: Sized,
Creates a “by reference” adaptor for this instance of
Read
. Read moreAuto Trait Implementations§
impl<R> RefUnwindSafe for Read<R>where R: RefUnwindSafe,
impl<R> Send for Read<R>where R: Send,
impl<R> Sync for Read<R>where R: Sync,
impl<R> Unpin for Read<R>where R: Unpin,
impl<R> UnwindSafe for Read<R>where R: UnwindSafe,
Blanket Implementations§
§impl<B> BufReadExt for Bwhere
B: BufRead,
impl<B> BufReadExt for Bwhere B: BufRead,
§fn byte_lines(self) -> ByteLines<Self>where
Self: Sized,
fn byte_lines(self) -> ByteLines<Self>where Self: Sized,
Returns an iterator over the lines of this reader, where each line
is represented as a byte string. Read more
§fn byte_records(self, terminator: u8) -> ByteRecords<Self>where
Self: Sized,
fn byte_records(self, terminator: u8) -> ByteRecords<Self>where Self: Sized,
Returns an iterator over byte-terminated records of this reader, where
each record is represented as a byte string. Read more
§fn for_byte_line<F>(&mut self, for_each_line: F) -> Result<(), Error>where
Self: Sized,
F: FnMut(&[u8]) -> Result<bool, Error>,
fn for_byte_line<F>(&mut self, for_each_line: F) -> Result<(), Error>where Self: Sized, F: FnMut(&[u8]) -> Result<bool, Error>,
Executes the given closure on each line in the underlying reader. Read more
§fn for_byte_record<F>(
&mut self,
terminator: u8,
for_each_record: F
) -> Result<(), Error>where
Self: Sized,
F: FnMut(&[u8]) -> Result<bool, Error>,
fn for_byte_record<F>( &mut self, terminator: u8, for_each_record: F ) -> Result<(), Error>where Self: Sized, F: FnMut(&[u8]) -> Result<bool, Error>,
Executes the given closure on each byte-terminated record in the
underlying reader. Read more