pub struct Session { /* private fields */ }Expand description
One side of an in-memory session, created by pair.
Implementations§
Trait Implementations§
Source§impl Session for Session
impl Session for Session
Source§fn receive_window(&self) -> Option<ReceiveWindow>
fn receive_window(&self) -> Option<ReceiveWindow>
Streams share no connection window, and one holds at most its buffer.
Source§fn reliable_reset(&self) -> bool
fn reliable_reset(&self) -> bool
A reset queues behind the prefix it keeps, which the reader still drains.
Source§type SendStream = SendStream
type SendStream = SendStream
The outgoing stream type.
Source§type RecvStream = Buffered<Chunks>
type RecvStream = Buffered<Chunks>
The incoming stream type.
Source§fn poll_accept_uni(&self, waiter: &Waiter) -> Poll<Result<RecvStream, Error>>
fn poll_accept_uni(&self, waiter: &Waiter) -> Poll<Result<RecvStream, Error>>
Poll for a unidirectional stream created by the peer.
Source§fn poll_accept_bi(
&self,
waiter: &Waiter,
) -> Poll<Result<(SendStream, RecvStream), Error>>
fn poll_accept_bi( &self, waiter: &Waiter, ) -> Poll<Result<(SendStream, RecvStream), Error>>
Poll for a bidirectional stream created by the peer.
Source§fn poll_open_uni(
&self,
waiter: &Waiter,
_: SendOptions<'_, Ungrouped>,
) -> Poll<Result<SendStream, Error>>
fn poll_open_uni( &self, waiter: &Waiter, _: SendOptions<'_, Ungrouped>, ) -> Poll<Result<SendStream, Error>>
Poll to open a unidirectional stream scheduled by
options, which blocks while
there are too many concurrent streams.Source§fn poll_open_bi(
&self,
waiter: &Waiter,
_: SendOptions<'_, Ungrouped>,
) -> Poll<Result<(SendStream, RecvStream), Error>>
fn poll_open_bi( &self, waiter: &Waiter, _: SendOptions<'_, Ungrouped>, ) -> Poll<Result<(SendStream, RecvStream), Error>>
Poll to open a bidirectional stream, its sending half scheduled by
options, which
blocks while there are too many concurrent streams.Source§fn send_group(&self, _: i64) -> Option<Ungrouped>
fn send_group(&self, _: i64) -> Option<Ungrouped>
Open a send group at
priority, or None when the transport orders streams by
their own priority alone. Read moreSource§fn send_datagram(
&self,
payload: Bytes,
_: SendOptions<'_, Ungrouped>,
) -> Result<(), Error>
fn send_datagram( &self, payload: Bytes, _: SendOptions<'_, Ungrouped>, ) -> Result<(), Error>
Send a datagram scheduled by
options, best-effort. Read moreSource§fn poll_recv_datagram(&self, waiter: &Waiter) -> Poll<Result<Bytes, Error>>
fn poll_recv_datagram(&self, waiter: &Waiter) -> Poll<Result<Bytes, Error>>
Poll for a datagram from the network.
Source§fn max_datagram_size(&self) -> usize
fn max_datagram_size(&self) -> usize
The maximum size of a datagram that can be sent.
Source§fn protocol(&self) -> Option<&str>
fn protocol(&self) -> Option<&str>
Return the application protocol negotiated for this session, if any. Read more
Source§fn close(&self, code: u32, reason: &str)
fn close(&self, code: u32, reason: &str)
Close the connection immediately with a code and reason. Read more
Source§fn poll_closed(&self, waiter: &Waiter) -> Poll<Error>
fn poll_closed(&self, waiter: &Waiter) -> Poll<Error>
Poll until the connection is closed by either side.
Source§fn metrics(&self) -> impl Metrics
fn metrics(&self) -> impl Metrics
Return connection-level metrics; by default, none are tracked.
Source§fn wire(&self) -> Option<Wire>
fn wire(&self) -> Option<Wire>
Return the wire counters this transport updates, or
None when it tracks none.Source§fn probe(&self) -> Option<Probe>
fn probe(&self) -> Option<Probe>
Return the target this transport’s sender probes up to, or
None when it has no sender. Read moreSource§fn set_limits(&self, limits: Limits) -> Result<(), LimitsError>
fn set_limits(&self, limits: Limits) -> Result<(), LimitsError>
Apply
limits to the live session, such as to open the receive window a server held
back until it admitted the peer. Read moreSource§fn set_keep_alive(&self, keep_alive: KeepAlive) -> Result<(), KeepAliveError>
fn set_keep_alive(&self, keep_alive: KeepAlive) -> Result<(), KeepAliveError>
Start
keep_alive: probe the peer once half of its soft passes unheard, report it
Stale through poll_liveness
once all of soft does, and close as an idle timeout once hard does. Any packet the
peer sends counts as hearing it, so a busy session sends no probe. A peer already
unheard for soft when this is called is reported stale at once. Read moreSource§fn poll_liveness(&self, waiter: &Waiter, last: Liveness) -> Poll<Liveness>
fn poll_liveness(&self, waiter: &Waiter, last: Liveness) -> Poll<Liveness>
Poll until the peer’s liveness differs from
last, returning it. Pending forever
without a keep-alive.Source§fn accept_uni(&self) -> AcceptUni<'_, Self> ⓘ
fn accept_uni(&self) -> AcceptUni<'_, Self> ⓘ
Accept the next unidirectional stream opened by the peer.
Source§fn accept_bi(&self) -> AcceptBi<'_, Self> ⓘ
fn accept_bi(&self) -> AcceptBi<'_, Self> ⓘ
Accept the next bidirectional stream opened by the peer.
Source§fn open_uni<'a>(
&'a self,
options: SendOptions<'a, <Self::SendStream as SendStream>::Group>,
) -> OpenUni<'a, Self> ⓘ
fn open_uni<'a>( &'a self, options: SendOptions<'a, <Self::SendStream as SendStream>::Group>, ) -> OpenUni<'a, Self> ⓘ
Open a unidirectional stream scheduled by
options, waiting for stream credit if
necessary.Source§fn open_bi<'a>(
&'a self,
options: SendOptions<'a, <Self::SendStream as SendStream>::Group>,
) -> OpenBi<'a, Self> ⓘ
fn open_bi<'a>( &'a self, options: SendOptions<'a, <Self::SendStream as SendStream>::Group>, ) -> OpenBi<'a, Self> ⓘ
Open a bidirectional stream, its sending half scheduled by
options, waiting for
stream credit if necessary.Source§fn recv_datagram(&self) -> RecvDatagram<'_, Self> ⓘ
fn recv_datagram(&self) -> RecvDatagram<'_, Self> ⓘ
Receive the next datagram from the peer.
Source§fn closed(&self) -> SessionClosed<'_, Self> ⓘ
fn closed(&self) -> SessionClosed<'_, Self> ⓘ
Wait until the session is closed by either side, returning the reason.
Auto Trait Implementations§
impl Freeze for Session
impl RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnsafeUnpin for Session
impl UnwindSafe for Session
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