Struct thrift::transport::TFramedWriteTransport
[−]
[src]
pub struct TFramedWriteTransport<C> where
C: Write, { /* fields omitted */ }
Transport that writes framed messages.
A TFramedWriteTransport
maintains a fixed-size internal write buffer. All
writes are made to this buffer and are sent to the wrapped channel only
when TFramedWriteTransport::flush()
is called. On a flush a fixed-length
header with a count of the buffered bytes is written, followed by the bytes
themselves.
Examples
Create and use a TFramedWriteTransport
.
use std::io::Write; use thrift::transport::{TFramedWriteTransport, TTcpChannel}; let mut c = TTcpChannel::new(); c.open("localhost:9090").unwrap(); let mut t = TFramedWriteTransport::new(c); t.write(&[0x00]).unwrap(); t.flush().unwrap();
Methods
impl<C> TFramedWriteTransport<C> where
C: Write,
[src]
C: Write,
fn new(channel: C) -> TFramedWriteTransport<C>
Create a TFramedTransport
with default-sized internal read and
write buffers that wraps the given TIoChannel
.
fn with_capacity(write_capacity: usize, channel: C) -> TFramedWriteTransport<C>
Create a TFramedTransport
with an internal read buffer of size
read_capacity
and an internal write buffer of size
write_capacity
that wraps the given TIoChannel
.
Trait Implementations
impl<C: Debug> Debug for TFramedWriteTransport<C> where
C: Write,
[src]
C: Write,
impl<C> Write for TFramedWriteTransport<C> where
C: Write,
[src]
C: Write,
fn write(&mut self, b: &[u8]) -> Result<usize>
Write a buffer into this object, returning how many bytes were written. Read more
fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
1.0.0
Attempts to write an entire buffer into this write. Read more
fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
1.0.0
Writes a formatted string into this writer, returning any error encountered. Read more
fn by_ref(&mut self) -> &mut Self
1.0.0
Creates a "by reference" adaptor for this instance of Write
. Read more