pub struct ConnectionState { /* private fields */ }
Expand description
The state for a connection accessed through a QuicEndpoint using a QuicConnection component.
Implementations§
Source§impl ConnectionState
impl ConnectionState
Sourcepub fn get_remote_address(&self) -> SocketAddr
pub fn get_remote_address(&self) -> SocketAddr
gets the remote address of the connection
Sourcepub fn poll_stream_event(&mut self) -> Option<StreamEvent>
pub fn poll_stream_event(&mut self) -> Option<StreamEvent>
Takes the next stream event from the queue.
If this function is not called regularly the queue will grow indefinitely.
Sourcepub fn is_drained(&mut self) -> bool
pub fn is_drained(&mut self) -> bool
Returns true
once there is no longer any need to keep this connection entity around.
Sourcepub fn accept_stream(&mut self, direction: Dir) -> Option<StreamId>
pub fn accept_stream(&mut self, direction: Dir) -> Option<StreamId>
Accepts a new stream of a certain direction if one is available.
Sourcepub fn open_stream(
&mut self,
direction: Dir,
) -> Result<StreamId, StreamsExhausted>
pub fn open_stream( &mut self, direction: Dir, ) -> Result<StreamId, StreamsExhausted>
Attempts to open a new stream of a certain direction.
Fails if the maximum number of these streams has been reached.
Sourcepub fn get_open_send_streams(&mut self) -> usize
pub fn get_open_send_streams(&mut self) -> usize
Returns the number of send streams that may have unacknowledged data.
Can be used to determine if there is outstanding data that has not been transmitted.
Sourcepub fn get_open_remote_streams(&mut self, direction: Dir) -> u64
pub fn get_open_remote_streams(&mut self, direction: Dir) -> u64
Gets the number of remotely opened streams of a certain direction.
Sourcepub fn set_max_concurrent_streams(
&mut self,
direction: Dir,
count: u64,
) -> Result<(), VarIntBoundsExceeded>
pub fn set_max_concurrent_streams( &mut self, direction: Dir, count: u64, ) -> Result<(), VarIntBoundsExceeded>
Sets the maximum number of concurrent streams that the peer can open in a certain direction.
Sourcepub fn set_send_stream_priority(
&mut self,
StreamId: StreamId,
priority: i32,
) -> Result<(), ClosedStreamError>
pub fn set_send_stream_priority( &mut self, StreamId: StreamId, priority: i32, ) -> Result<(), ClosedStreamError>
Sets the priority of a send stream.
Sourcepub fn get_send_stream_priority(
&mut self,
StreamId: StreamId,
) -> Result<i32, ClosedStreamError>
pub fn get_send_stream_priority( &mut self, StreamId: StreamId, ) -> Result<i32, ClosedStreamError>
Gets the priority of a send stream.
Sourcepub fn write_send_stream(
&mut self,
StreamId: StreamId,
data: &[u8],
) -> Result<usize, StreamWriteError>
pub fn write_send_stream( &mut self, StreamId: StreamId, data: &[u8], ) -> Result<usize, StreamWriteError>
Attempts to write some data to a stream.
If successful returns the number of bytes that were successfully written.
Sourcepub fn read_recv_stream(
&mut self,
StreamId: StreamId,
max_size: usize,
ordered: bool,
) -> Result<Option<Chunk>, StreamReadError>
pub fn read_recv_stream( &mut self, StreamId: StreamId, max_size: usize, ordered: bool, ) -> Result<Option<Chunk>, StreamReadError>
Attempts to read up to max_size
bytes from a stream.
When none is returned the stream has been finished. If the stream is blocked on waiting for more data StreamReadError::Blocked will be returned.
If an out of order read is attempted, only out of order reads are valid from that point on.
Sourcepub fn finish_send_stream(
&mut self,
StreamId: StreamId,
) -> Result<(), StreamFinishError>
pub fn finish_send_stream( &mut self, StreamId: StreamId, ) -> Result<(), StreamFinishError>
Finishes a send stream
Sourcepub fn reset_send_stream(
&mut self,
StreamId: StreamId,
code: u64,
) -> Result<(), ResetStreamError>
pub fn reset_send_stream( &mut self, StreamId: StreamId, code: u64, ) -> Result<(), ResetStreamError>
Abandon transmitting data on a send stream
Sourcepub fn stop_recv_stream(
&mut self,
StreamId: StreamId,
code: u64,
) -> Result<(), StopStreamError>
pub fn stop_recv_stream( &mut self, StreamId: StreamId, code: u64, ) -> Result<(), StopStreamError>
Will tell the peer to stop sending data on a recv stream
Sourcepub fn send_stream_stopped(
&mut self,
StreamId: StreamId,
) -> Result<Option<u64>, ClosedStreamError>
pub fn send_stream_stopped( &mut self, StreamId: StreamId, ) -> Result<Option<u64>, ClosedStreamError>
Checks if a send stream has been stopped by the peer, returns the code if it was.
Sourcepub fn close(
&mut self,
code: u64,
reason: Box<[u8]>,
) -> Result<(), VarIntBoundsExceeded>
pub fn close( &mut self, code: u64, reason: Box<[u8]>, ) -> Result<(), VarIntBoundsExceeded>
Closes the connection in the next update
Will do nothing if the stream has already been closed.
Sourcepub fn get_datagram_max_size(&mut self) -> Option<usize>
pub fn get_datagram_max_size(&mut self) -> Option<usize>
Gets the maximum size datagram that can be sent.
Sourcepub fn get_datagram_send_buffer_space(&mut self) -> usize
pub fn get_datagram_send_buffer_space(&mut self) -> usize
Gets the amount of space available in the datagram send buffer.
When greater than zero, sending a datagram of at most this size is guaranteed not to cause older datagrams to be dropped.
Sourcepub fn send_datagram(
&mut self,
data: Box<[u8]>,
drop_old: bool,
) -> Result<(), SendDatagramError>
pub fn send_datagram( &mut self, data: Box<[u8]>, drop_old: bool, ) -> Result<(), SendDatagramError>
Attempts to write an unreliable unordered datagram to an internal buffer.
If drop_old
is true the oldest datagram in the buffer will be dropped if more space is needed.
If drop_old
is false and the buffer is full [SendDatagramError::Blocked] will be returned.
Sourcepub fn receive_datagram(&mut self) -> Option<Box<[u8]>>
pub fn receive_datagram(&mut self) -> Option<Box<[u8]>>
Take the next unordered unreliable datagram from the receive buffer.
pub fn accept_uni_stream(&self) -> Option<StreamId>
Auto Trait Implementations§
impl !Freeze for ConnectionState
impl !RefUnwindSafe for ConnectionState
impl Send for ConnectionState
impl Sync for ConnectionState
impl Unpin for ConnectionState
impl !UnwindSafe for ConnectionState
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more