pub struct TcpStream { /* private fields */ }Expand description
Simple implementation of a TCP Stream
Applying only the most simple methods on this struct it is able to act as a simple TCP stream. If extended functionality is required you can access the inner Tokio TCP Stream, or raise a Issue on GitHub.
Implementations§
Source§impl TcpStream
impl TcpStream
Sourcepub fn new(io: TokioTcpStream) -> Self
pub fn new(io: TokioTcpStream) -> Self
Creates a new TCP Stream from a Tokio TCP Stream
Sourcepub async fn connect<A: ToSocketAddrs>(addr: A) -> Result<TcpStream>
pub async fn connect<A: ToSocketAddrs>(addr: A) -> Result<TcpStream>
Creates a new TCP Stream given a remote address
Sourcepub async fn send<A: DoipTcpPayload + DoipPayload + 'static>(
&mut self,
payload: A,
) -> Result<(), SocketSendError>
pub async fn send<A: DoipTcpPayload + DoipPayload + 'static>( &mut self, payload: A, ) -> Result<(), SocketSendError>
Send a DoIP frame to the sink
Sourcepub async fn read(&mut self) -> Option<Result<DoipMessage, DecodeError>>
pub async fn read(&mut self) -> Option<Result<DoipMessage, DecodeError>>
Read a DoIP frame off the stream
Sourcepub fn from_std(stream: TcpStream) -> Result<TcpStream>
pub fn from_std(stream: TcpStream) -> Result<TcpStream>
Converts a standard library TCP Stream to a DoIP Framed TCP Stream
Sourcepub fn into_split(self) -> (TcpStreamReadHalf, TcpStreamWriteHalf)
pub fn into_split(self) -> (TcpStreamReadHalf, TcpStreamWriteHalf)
Splits the TCP Stream into a Read Half and Write Half
Sourcepub fn get_stream_ref(&self) -> &TokioTcpStream
pub fn get_stream_ref(&self) -> &TokioTcpStream
Get a reference to the inner Tokio TCP Stream
Sourcepub fn into_socket(self) -> TokioTcpStream
pub fn into_socket(self) -> TokioTcpStream
Access the inner Tokio TCP Stream, consumes the DoIP TCP Stream
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for TcpStream
impl RefUnwindSafe for TcpStream
impl Send for TcpStream
impl Sync for TcpStream
impl Unpin for TcpStream
impl UnwindSafe for TcpStream
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more