pub struct RtmpStream { /* private fields */ }
Expand description
A stream for RTMP that wrapped Tokio’s TcpStream
.
If you constructs this struct from some address, use RtmpStream::connect("aaa.bbb.ccc.ddd:1935")
.
If you do it from already created std’s TCPStream. use RtmpStream::from_std(std_stream)
Implementations§
Source§impl RtmpStream
impl RtmpStream
Sourcepub async fn connect<A: ToSocketAddrs>(addr: A) -> IOResult<Self>
pub async fn connect<A: ToSocketAddrs>(addr: A) -> IOResult<Self>
Opens a RTMP connection to a remote host. When connection succeeded, this wraps tokio’s TcpStream in RtmpStream. Read more
Sourcepub fn from_std(std_stream: StdStream) -> IOResult<Self>
pub fn from_std(std_stream: StdStream) -> IOResult<Self>
Creates new RtmpStream from a std::net::TcpStream
.
When connection succeeded, this wraps tokio’s TcpStream in RtmpStream.
Read more
Sourcepub fn into_std(self) -> IOResult<StdStream>
pub fn into_std(self) -> IOResult<StdStream>
Turns a sheave_core::net::rtmp::RtmpStream into
std::net::TcpStream`.
Read more
Sourcepub fn local_addr(&self) -> IOResult<SocketAddr>
pub fn local_addr(&self) -> IOResult<SocketAddr>
Returns the local address that this stream is bound to. Read more
Sourcepub fn take_error(&self) -> IOResult<Option<IOError>>
pub fn take_error(&self) -> IOResult<Option<IOError>>
Returns the value of the SO_ERROR
option.
Sourcepub fn peer_addr(&self) -> IOResult<SocketAddr>
pub fn peer_addr(&self) -> IOResult<SocketAddr>
Returns the remote address that this stream is connected to. Read more
Sourcepub fn poll_peek(
&self,
cx: &mut FutureContext<'_>,
buf: &mut ReadBuf<'_>,
) -> Poll<IOResult<usize>>
pub fn poll_peek( &self, cx: &mut FutureContext<'_>, buf: &mut ReadBuf<'_>, ) -> Poll<IOResult<usize>>
Attempts to receive data on the socket, without removing that data from the queue, registering the current task for wakeup if data is not yet available. Read more
Sourcepub async fn ready(&self, interest: Interest) -> IOResult<Ready>
pub async fn ready(&self, interest: Interest) -> IOResult<Ready>
Waits for any of the requested ready states. Read more
Sourcepub async fn readable(&self) -> IOResult<()>
pub async fn readable(&self) -> IOResult<()>
Waits for the socket to become readable. Read more
Sourcepub fn poll_read_ready(&self, cx: &mut FutureContext<'_>) -> Poll<IOResult<()>>
pub fn poll_read_ready(&self, cx: &mut FutureContext<'_>) -> Poll<IOResult<()>>
Polls for read readiness. Read more
Sourcepub fn try_read(&self, buf: &mut [u8]) -> IOResult<usize>
pub fn try_read(&self, buf: &mut [u8]) -> IOResult<usize>
Tries to read data from the stream into the provided buffer, returning how many bytes were read. Read more
Sourcepub fn try_read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> IOResult<usize>
pub fn try_read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> IOResult<usize>
Tries to read data from the stream into the provided buffers, returning how many bytes were read. Read more
Sourcepub fn try_read_buf<B: BufMut>(&self, buf: &mut B) -> IOResult<usize>
pub fn try_read_buf<B: BufMut>(&self, buf: &mut B) -> IOResult<usize>
Tries to read data from the stream into the provided buffer, advancing the buffer’s internal cursor, returning how many bytes were read. Read more
Sourcepub async fn writable(&self) -> IOResult<()>
pub async fn writable(&self) -> IOResult<()>
Waits for the socket to become writable. Read more
Sourcepub fn poll_write_ready(&self, cx: &mut FutureContext<'_>) -> Poll<IOResult<()>>
pub fn poll_write_ready(&self, cx: &mut FutureContext<'_>) -> Poll<IOResult<()>>
Polls for write readiness. Read more
Sourcepub fn try_write(&self, buf: &[u8]) -> IOResult<usize>
pub fn try_write(&self, buf: &[u8]) -> IOResult<usize>
Tries to write several buffers to the stream, returning how many bytes were written. Read more
Sourcepub fn try_write_vectored(&self, bufs: &[IoSlice<'_>]) -> IOResult<usize>
pub fn try_write_vectored(&self, bufs: &[IoSlice<'_>]) -> IOResult<usize>
Tries to write several buffers to the stream, returning how many bytes were written. Read more
Sourcepub fn try_io<R>(
&self,
interest: Interest,
f: impl FnOnce() -> IOResult<R>,
) -> IOResult<R>
pub fn try_io<R>( &self, interest: Interest, f: impl FnOnce() -> IOResult<R>, ) -> IOResult<R>
Tries to read or write from the socket using a user-provided IO operation. Read more
Sourcepub async fn async_io<R>(
&self,
interest: Interest,
f: impl FnMut() -> IOResult<R>,
) -> IOResult<R>
pub async fn async_io<R>( &self, interest: Interest, f: impl FnMut() -> IOResult<R>, ) -> IOResult<R>
Reads or writes from the socket using a user-provided IO operation. Read more
Sourcepub async fn peek(&self, buf: &mut [u8]) -> IOResult<usize>
pub async fn peek(&self, buf: &mut [u8]) -> IOResult<usize>
Receives data on the socket from the remote address to which it is connected, without removing that data from the queue. On success, returns the number of bytes peeked. Read more
Sourcepub fn nodelay(&self) -> IOResult<bool>
pub fn nodelay(&self) -> IOResult<bool>
Gets the value of the TCP_NODELAY option on this socket. Read more
Sourcepub fn set_nodelay(&self, nodelay: bool) -> IOResult<()>
pub fn set_nodelay(&self, nodelay: bool) -> IOResult<()>
Sets the value of the TCP_NODELAY option on this socket. Read more
Sourcepub fn linger(&self) -> IOResult<Option<Duration>>
pub fn linger(&self) -> IOResult<Option<Duration>>
Reads the linger duration for this socket by getting the SO_LINGER option. Read more
Sourcepub fn set_linger(&self, dur: Option<Duration>) -> IOResult<()>
pub fn set_linger(&self, dur: Option<Duration>) -> IOResult<()>
Sets the linger duration of this socket by setting the SO_LINGER option. Read more
Sourcepub fn ttl(&self) -> IOResult<u32>
pub fn ttl(&self) -> IOResult<u32>
Gets the value of the IP_TTL option for this socket. Read more
Sourcepub fn set_ttl(&self, ttl: u32) -> IOResult<()>
pub fn set_ttl(&self, ttl: u32) -> IOResult<()>
Sets the value for the IP_TTL option on this socket. Read more
Sourcepub fn split<'a>(&'a mut self) -> (ReadHalf<'a>, WriteHalf<'a>)
pub fn split<'a>(&'a mut self) -> (ReadHalf<'a>, WriteHalf<'a>)
Splits a TcpStream into a read half and a write half, which can be used to read and write the stream concurrently. Read more
Sourcepub fn into_split(self) -> (OwnedReadHalf, OwnedWriteHalf)
pub fn into_split(self) -> (OwnedReadHalf, OwnedWriteHalf)
Splits a TcpStream into a read half and a write half, which can be used to read and write the stream concurrently. Read more
Trait Implementations§
Source§impl AsFd for RtmpStream
impl AsFd for RtmpStream
Source§fn as_fd(&self) -> BorrowedFd<'_>
fn as_fd(&self) -> BorrowedFd<'_>
Source§impl AsRawFd for RtmpStream
impl AsRawFd for RtmpStream
Source§impl AsyncRead for RtmpStream
impl AsyncRead for RtmpStream
Source§impl AsyncWrite for RtmpStream
impl AsyncWrite for RtmpStream
Source§fn poll_write(
self: Pin<&mut Self>,
cx: &mut FutureContext<'_>,
buf: &[u8],
) -> Poll<IOResult<usize>>
fn poll_write( self: Pin<&mut Self>, cx: &mut FutureContext<'_>, buf: &[u8], ) -> Poll<IOResult<usize>>
buf
into the object. Read moreSource§fn poll_flush(
self: Pin<&mut Self>,
cx: &mut FutureContext<'_>,
) -> Poll<IOResult<()>>
fn poll_flush( self: Pin<&mut Self>, cx: &mut FutureContext<'_>, ) -> Poll<IOResult<()>>
Source§fn poll_shutdown(
self: Pin<&mut Self>,
cx: &mut FutureContext<'_>,
) -> Poll<IOResult<()>>
fn poll_shutdown( self: Pin<&mut Self>, cx: &mut FutureContext<'_>, ) -> Poll<IOResult<()>>
§fn poll_write_vectored(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
bufs: &[IoSlice<'_>],
) -> Poll<Result<usize, Error>>
fn poll_write_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>], ) -> Poll<Result<usize, Error>>
poll_write
, except that it writes from a slice of buffers. Read more§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
poll_write_vectored
implementation. Read moreSource§impl Debug for RtmpStream
impl Debug for RtmpStream
Source§impl From<TcpStream> for RtmpStream
impl From<TcpStream> for RtmpStream
Source§impl TryFrom<TcpStream> for RtmpStream
impl TryFrom<TcpStream> for RtmpStream
impl<'__pin> Unpin for RtmpStreamwhere
PinnedFieldsOf<__Origin<'__pin>>: Unpin,
Auto Trait Implementations§
impl !Freeze for RtmpStream
impl RefUnwindSafe for RtmpStream
impl Send for RtmpStream
impl Sync for RtmpStream
impl UnwindSafe for RtmpStream
Blanket Implementations§
§impl<R> AsyncReadExt for Rwhere
R: AsyncRead + ?Sized,
impl<R> AsyncReadExt for Rwhere
R: AsyncRead + ?Sized,
§fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Read<'a, Self>where
Self: Unpin,
fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Read<'a, Self>where
Self: Unpin,
§fn read_buf<'a, B>(&'a mut self, buf: &'a mut B) -> ReadBuf<'a, Self, B>
fn read_buf<'a, B>(&'a mut self, buf: &'a mut B) -> ReadBuf<'a, Self, B>
§fn read_exact<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadExact<'a, Self>where
Self: Unpin,
fn read_exact<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadExact<'a, Self>where
Self: Unpin,
buf
. Read more§fn read_u8(&mut self) -> ReadU8<&mut Self>where
Self: Unpin,
fn read_u8(&mut self) -> ReadU8<&mut Self>where
Self: Unpin,
§fn read_i8(&mut self) -> ReadI8<&mut Self>where
Self: Unpin,
fn read_i8(&mut self) -> ReadI8<&mut Self>where
Self: Unpin,
§fn read_u16(&mut self) -> ReadU16<&mut Self>where
Self: Unpin,
fn read_u16(&mut self) -> ReadU16<&mut Self>where
Self: Unpin,
§fn read_i16(&mut self) -> ReadI16<&mut Self>where
Self: Unpin,
fn read_i16(&mut self) -> ReadI16<&mut Self>where
Self: Unpin,
§fn read_u32(&mut self) -> ReadU32<&mut Self>where
Self: Unpin,
fn read_u32(&mut self) -> ReadU32<&mut Self>where
Self: Unpin,
§fn read_i32(&mut self) -> ReadI32<&mut Self>where
Self: Unpin,
fn read_i32(&mut self) -> ReadI32<&mut Self>where
Self: Unpin,
§fn read_u64(&mut self) -> ReadU64<&mut Self>where
Self: Unpin,
fn read_u64(&mut self) -> ReadU64<&mut Self>where
Self: Unpin,
§fn read_i64(&mut self) -> ReadI64<&mut Self>where
Self: Unpin,
fn read_i64(&mut self) -> ReadI64<&mut Self>where
Self: Unpin,
§fn read_u128(&mut self) -> ReadU128<&mut Self>where
Self: Unpin,
fn read_u128(&mut self) -> ReadU128<&mut Self>where
Self: Unpin,
§fn read_i128(&mut self) -> ReadI128<&mut Self>where
Self: Unpin,
fn read_i128(&mut self) -> ReadI128<&mut Self>where
Self: Unpin,
§fn read_f32(&mut self) -> ReadF32<&mut Self>where
Self: Unpin,
fn read_f32(&mut self) -> ReadF32<&mut Self>where
Self: Unpin,
§fn read_f64(&mut self) -> ReadF64<&mut Self>where
Self: Unpin,
fn read_f64(&mut self) -> ReadF64<&mut Self>where
Self: Unpin,
§fn read_u16_le(&mut self) -> ReadU16Le<&mut Self>where
Self: Unpin,
fn read_u16_le(&mut self) -> ReadU16Le<&mut Self>where
Self: Unpin,
§fn read_i16_le(&mut self) -> ReadI16Le<&mut Self>where
Self: Unpin,
fn read_i16_le(&mut self) -> ReadI16Le<&mut Self>where
Self: Unpin,
§fn read_u32_le(&mut self) -> ReadU32Le<&mut Self>where
Self: Unpin,
fn read_u32_le(&mut self) -> ReadU32Le<&mut Self>where
Self: Unpin,
§fn read_i32_le(&mut self) -> ReadI32Le<&mut Self>where
Self: Unpin,
fn read_i32_le(&mut self) -> ReadI32Le<&mut Self>where
Self: Unpin,
§fn read_u64_le(&mut self) -> ReadU64Le<&mut Self>where
Self: Unpin,
fn read_u64_le(&mut self) -> ReadU64Le<&mut Self>where
Self: Unpin,
§fn read_i64_le(&mut self) -> ReadI64Le<&mut Self>where
Self: Unpin,
fn read_i64_le(&mut self) -> ReadI64Le<&mut Self>where
Self: Unpin,
§fn read_u128_le(&mut self) -> ReadU128Le<&mut Self>where
Self: Unpin,
fn read_u128_le(&mut self) -> ReadU128Le<&mut Self>where
Self: Unpin,
§fn read_i128_le(&mut self) -> ReadI128Le<&mut Self>where
Self: Unpin,
fn read_i128_le(&mut self) -> ReadI128Le<&mut Self>where
Self: Unpin,
§fn read_f32_le(&mut self) -> ReadF32Le<&mut Self>where
Self: Unpin,
fn read_f32_le(&mut self) -> ReadF32Le<&mut Self>where
Self: Unpin,
§fn read_f64_le(&mut self) -> ReadF64Le<&mut Self>where
Self: Unpin,
fn read_f64_le(&mut self) -> ReadF64Le<&mut Self>where
Self: Unpin,
§fn read_to_end<'a>(&'a mut self, buf: &'a mut Vec<u8>) -> ReadToEnd<'a, Self>where
Self: Unpin,
fn read_to_end<'a>(&'a mut self, buf: &'a mut Vec<u8>) -> ReadToEnd<'a, Self>where
Self: Unpin,
buf
. Read more§fn read_to_string<'a>(
&'a mut self,
dst: &'a mut String,
) -> ReadToString<'a, Self>where
Self: Unpin,
fn read_to_string<'a>(
&'a mut self,
dst: &'a mut String,
) -> ReadToString<'a, Self>where
Self: Unpin,
buf
. Read more