ConnectionState

Struct ConnectionState 

Source
pub struct ConnectionState { /* private fields */ }
Expand description

The state for a connection accessed through a QuicEndpoint using a QuicConnection component.

Implementations§

Source§

impl ConnectionState

Source

pub fn get_remote_address(&self) -> SocketAddr

gets the remote address of the connection

Source

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.

Source

pub fn is_drained(&mut self) -> bool

Returns true once there is no longer any need to keep this connection entity around.

Source

pub fn accept_stream(&mut self, direction: Dir) -> Option<StreamId>

Accepts a new stream of a certain direction if one is available.

Source

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.

Source

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.

Source

pub fn get_open_remote_streams(&mut self, direction: Dir) -> u64

Gets the number of remotely opened streams of a certain direction.

Source

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.

Source

pub fn set_send_stream_priority( &mut self, StreamId: StreamId, priority: i32, ) -> Result<(), ClosedStreamError>

Sets the priority of a send stream.

Source

pub fn get_send_stream_priority( &mut self, StreamId: StreamId, ) -> Result<i32, ClosedStreamError>

Gets the priority of a send stream.

Source

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.

Source

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.

Source

pub fn finish_send_stream( &mut self, StreamId: StreamId, ) -> Result<(), StreamFinishError>

Finishes a send stream

Source

pub fn reset_send_stream( &mut self, StreamId: StreamId, code: u64, ) -> Result<(), ResetStreamError>

Abandon transmitting data on a send stream

Source

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

Source

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.

Source

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.

Source

pub fn get_datagram_max_size(&mut self) -> Option<usize>

Gets the maximum size datagram that can be sent.

Source

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.

Source

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.

Source

pub fn receive_datagram(&mut self) -> Option<Box<[u8]>>

Take the next unordered unreliable datagram from the receive buffer.

Source

pub fn accept_uni_stream(&self) -> Option<StreamId>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts 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>

Converts 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)

Converts &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)

Converts &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
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ConditionalSend for T
where T: Send,