Struct thrift::transport::TTcpChannel [−][src]
pub struct TTcpChannel { /* fields omitted */ }
Expand description
Bidirectional TCP/IP channel.
Examples
Create a TTcpChannel
.
use std::io::{Read, Write};
use thrift::transport::TTcpChannel;
let mut c = TTcpChannel::new();
c.open("localhost:9090").unwrap();
let mut buf = vec![0u8; 4];
c.read(&mut buf).unwrap();
c.write(&vec![0, 1, 2]).unwrap();
Create a TTcpChannel
by wrapping an existing TcpStream
.
use std::io::{Read, Write};
use std::net::TcpStream;
use thrift::transport::TTcpChannel;
let stream = TcpStream::connect("127.0.0.1:9189").unwrap();
// no need to call c.open() since we've already connected above
let mut c = TTcpChannel::with_stream(stream);
let mut buf = vec![0u8; 4];
c.read(&mut buf).unwrap();
c.write(&vec![0, 1, 2]).unwrap();
Implementations
pub fn new() -> TTcpChannelⓘNotable traits for TTcpChannelimpl Read for TTcpChannelimpl Write for TTcpChannel
pub fn new() -> TTcpChannelⓘNotable traits for TTcpChannelimpl Read for TTcpChannelimpl Write for TTcpChannel
impl Read for TTcpChannelimpl Write for TTcpChannel
Create an uninitialized TTcpChannel
.
The returned instance must be opened using TTcpChannel::open(...)
before it can be used.
pub fn with_stream(stream: TcpStream) -> TTcpChannelⓘNotable traits for TTcpChannelimpl Read for TTcpChannelimpl Write for TTcpChannel
pub fn with_stream(stream: TcpStream) -> TTcpChannelⓘNotable traits for TTcpChannelimpl Read for TTcpChannelimpl Write for TTcpChannel
impl Read for TTcpChannelimpl Write for TTcpChannel
Create a TTcpChannel
that wraps an existing TcpStream
.
The passed-in stream is assumed to have been opened before being wrapped
by the created TTcpChannel
instance.
Connect to remote_address
, which should implement ToSocketAddrs
trait.
Trait Implementations
fn default() -> TTcpChannelⓘNotable traits for TTcpChannelimpl Read for TTcpChannelimpl Write for TTcpChannel
fn default() -> TTcpChannelⓘNotable traits for TTcpChannelimpl Read for TTcpChannelimpl Write for TTcpChannel
impl Read for TTcpChannelimpl Write for TTcpChannel
Returns the “default value” for a type. 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 TTcpChannel
impl Send for TTcpChannel
impl Sync for TTcpChannel
impl Unpin for TTcpChannel
impl UnwindSafe for TTcpChannel
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