Struct git_transport::client::RequestWriter
source · pub struct RequestWriter<'a> { /* private fields */ }
blocking-client
only.Expand description
A Write
implementation optimized for writing packet lines.
A type implementing Write
for packet lines, which when done can be transformed into a Read
for
obtaining the response.
Implementations§
source§impl<'a> RequestWriter<'a>
impl<'a> RequestWriter<'a>
methods with bonds to IO
sourcepub fn new_from_bufread<W: Write + 'a>(
writer: W,
reader: Box<dyn ExtendedBufRead + Unpin + 'a>,
write_mode: WriteMode,
on_into_read: MessageKind
) -> Self
pub fn new_from_bufread<W: Write + 'a>(
writer: W,
reader: Box<dyn ExtendedBufRead + Unpin + 'a>,
write_mode: WriteMode,
on_into_read: MessageKind
) -> Self
Create a new instance from a writer
(commonly a socket), a reader
into which to transform once the
writes are finished, along with configuration for the write_mode
and information about which message to write
when this instance is converted into a reader
to read the request’s response.
sourcepub fn write_message(&mut self, message: MessageKind) -> Result<()>
pub fn write_message(&mut self, message: MessageKind) -> Result<()>
Write the given message as packet line.
sourcepub fn into_read(self) -> Result<Box<dyn ExtendedBufRead + Unpin + 'a>>
pub fn into_read(self) -> Result<Box<dyn ExtendedBufRead + Unpin + 'a>>
Discard the ability to write and turn this instance into the reader for obtaining the other side’s response.
sourcepub fn into_parts(
self
) -> (Box<dyn Write + 'a>, Box<dyn ExtendedBufRead + Unpin + 'a>)
pub fn into_parts(
self
) -> (Box<dyn Write + 'a>, Box<dyn ExtendedBufRead + Unpin + 'a>)
Dissolve this instance into its write and read handles without any side-effect.
This is useful to take more over when to write with packetline or not, which is why the writer doesn’t write packetlines but verbatim.
Trait Implementations§
source§impl<'a> Write for RequestWriter<'a>
impl<'a> Write for RequestWriter<'a>
source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector
)1.0.0 · source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored
)