Struct thrift::transport::TBufferChannel [−][src]
pub struct TBufferChannel { /* fields omitted */ }
Expand description
In-memory read and write channel with fixed-size read and write buffers.
On a write
bytes are written to the internal write buffer. Writes are no
longer accepted once this buffer is full. Callers must empty_write_buffer()
before subsequent writes are accepted.
You can set readable bytes in the internal read buffer by filling it with
set_readable_bytes(...)
. Callers can then read until the buffer is
depleted. No further reads are accepted until the internal read buffer is
replenished again.
Implementations
pub fn with_capacity(
read_capacity: usize,
write_capacity: usize
) -> TBufferChannelⓘNotable traits for TBufferChannelimpl Read for TBufferChannelimpl Write for TBufferChannel
pub fn with_capacity(
read_capacity: usize,
write_capacity: usize
) -> TBufferChannelⓘNotable traits for TBufferChannelimpl Read for TBufferChannelimpl Write for TBufferChannel
impl Read for TBufferChannelimpl Write for TBufferChannel
Constructs a new, empty TBufferChannel
with the given
read buffer capacity and write buffer capacity.
Return a copy of the bytes held by the internal read buffer. Returns an empty vector if no readable bytes are present.
Reset the number of readable bytes to zero.
Subsequent calls to read
will return nothing.
Copy bytes from the source buffer buf
into the internal read buffer,
overwriting any existing bytes. Returns the number of bytes copied,
which is min(buf.len(), internal_read_buf.len())
.
Return a copy of the bytes held by the internal write buffer. Returns an empty vector if no bytes were written.
Resets the internal write buffer, making it seem like no bytes were
written. Calling write_buffer
after this returns an empty vector.
Overwrites the contents of the read buffer with the contents of the write buffer. The write buffer is emptied after this operation.
Trait Implementations
fn clone(&self) -> TBufferChannelⓘNotable traits for TBufferChannelimpl Read for TBufferChannelimpl Write for TBufferChannel
fn clone(&self) -> TBufferChannelⓘNotable traits for TBufferChannelimpl Read for TBufferChannelimpl Write for TBufferChannel
impl Read for TBufferChannelimpl Write for TBufferChannel
Returns a copy of the value. Read more
Performs copy-assignment from source
. Read more
Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
Like read
, except that it reads into a slice of buffers. Read more
can_vector
)Determines if this Read
er has an efficient read_vectored
implementation. Read more
read_initializer
)Determines if this Read
er can work with buffers of uninitialized
memory. Read more
Read all bytes until EOF in this source, placing them into buf
. Read more
Read all bytes until EOF in this source, appending them to buf
. Read more
Read the exact number of bytes required to fill buf
. Read more
Creates a “by reference” adapter for this instance of Read
. Read more
Creates an adapter which will chain this stream with another. Read more
Split the channel into a readable half and a writable half, where the
readable half implements io::Read
and the writable half implements
io::Write
. Returns None
if the channel was not initialized, or if it
cannot be split safely. Read more
Write a buffer into this writer, returning how many bytes were written. Read more
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
can_vector
)Determines if this Write
r has an efficient write_vectored
implementation. Read more
Attempts to write an entire buffer into this writer. Read more
write_all_vectored
)Attempts to write multiple buffers into this writer. Read more
Writes a formatted string into this writer, returning any error encountered. Read more
Auto Trait Implementations
impl RefUnwindSafe for TBufferChannel
impl Send for TBufferChannel
impl Sync for TBufferChannel
impl Unpin for TBufferChannel
impl UnwindSafe for TBufferChannel
Blanket Implementations
Mutably borrows from an owned value. Read more
Reads an unsigned 8 bit integer from the underlying reader. Read more
Reads a signed 8 bit integer from the underlying reader. Read more
Reads an unsigned 16 bit integer from the underlying reader. Read more
Reads a signed 16 bit integer from the underlying reader. Read more
Reads an unsigned 24 bit integer from the underlying reader. Read more
Reads a signed 24 bit integer from the underlying reader. Read more
Reads an unsigned 32 bit integer from the underlying reader. Read more
Reads a signed 32 bit integer from the underlying reader. Read more
Reads an unsigned 48 bit integer from the underlying reader. Read more
Reads a signed 48 bit integer from the underlying reader. Read more
Reads an unsigned 64 bit integer from the underlying reader. Read more
Reads a signed 64 bit integer from the underlying reader. Read more
Reads an unsigned 128 bit integer from the underlying reader. Read more
Reads a signed 128 bit integer from the underlying reader. Read more
Reads an unsigned n-bytes integer from the underlying reader. Read more
Reads a signed n-bytes integer from the underlying reader. Read more
Reads an unsigned n-bytes integer from the underlying reader.
Reads a signed n-bytes integer from the underlying reader.
Reads a IEEE754 single-precision (4 bytes) floating point number from the underlying reader. Read more
Reads a IEEE754 double-precision (8 bytes) floating point number from the underlying reader. Read more
Reads a sequence of unsigned 16 bit integers from the underlying reader. Read more
Reads a sequence of unsigned 32 bit integers from the underlying reader. Read more
Reads a sequence of unsigned 64 bit integers from the underlying reader. Read more
Reads a sequence of unsigned 128 bit integers from the underlying reader. Read more
Reads a sequence of signed 8 bit integers from the underlying reader. Read more
Reads a sequence of signed 16 bit integers from the underlying reader. Read more
Reads a sequence of signed 32 bit integers from the underlying reader. Read more
Reads a sequence of signed 64 bit integers from the underlying reader. Read more
Reads a sequence of signed 128 bit integers from the underlying reader. Read more
Reads a sequence of IEEE754 single-precision (4 bytes) floating point numbers from the underlying reader. Read more
Reads a sequence of IEEE754 double-precision (8 bytes) floating point numbers from the underlying reader. Read more
Writes an unsigned 8 bit integer to the underlying writer. Read more
Writes a signed 8 bit integer to the underlying writer. Read more
Writes an unsigned 16 bit integer to the underlying writer. Read more
Writes a signed 16 bit integer to the underlying writer. Read more
Writes an unsigned 24 bit integer to the underlying writer. Read more
Writes a signed 24 bit integer to the underlying writer. Read more
Writes an unsigned 32 bit integer to the underlying writer. Read more
Writes a signed 32 bit integer to the underlying writer. Read more
Writes an unsigned 48 bit integer to the underlying writer. Read more
Writes a signed 48 bit integer to the underlying writer. Read more
Writes an unsigned 64 bit integer to the underlying writer. Read more
Writes a signed 64 bit integer to the underlying writer. Read more
Writes an unsigned 128 bit integer to the underlying writer.
Writes a signed 128 bit integer to the underlying writer.
Writes an unsigned n-bytes integer to the underlying writer. Read more
Writes a signed n-bytes integer to the underlying writer. Read more
Writes an unsigned n-bytes integer to the underlying writer. Read more
Writes a signed n-bytes integer to the underlying writer. Read more
Writes a IEEE754 single-precision (4 bytes) floating point number to the underlying writer. Read more