Skip to main content

Session

Struct Session 

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

One side of an in-memory session, created by pair.

Implementations§

Source§

impl Session

Source

pub fn closer(&self) -> Closer

A handle that closes this session without keeping it open, as a cut link would.

Trait Implementations§

Source§

impl Clone for Session

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Session for Session

Source§

fn receive_window(&self) -> Option<ReceiveWindow>

Streams share no connection window, and one holds at most its buffer.

Source§

fn reliable_reset(&self) -> bool

A reset queues behind the prefix it keeps, which the reader still drains.

Source§

type SendStream = SendStream

The outgoing stream type.
Source§

type RecvStream = Buffered<Chunks>

The incoming stream type.
Source§

type Error = Error

The error type for every operation on this session.
Source§

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

Poll for a bidirectional stream created by the peer.
Source§

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

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>

Open a send group at priority, or None when the transport orders streams by their own priority alone. Read more
Source§

fn send_datagram( &self, payload: Bytes, _: SendOptions<'_, Ungrouped>, ) -> Result<(), Error>

Send a datagram scheduled by options, best-effort. Read more
Source§

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

The maximum size of a datagram that can be sent.
Source§

fn protocol(&self) -> Option<&str>

Return the application protocol negotiated for this session, if any. Read more
Source§

fn address(&self) -> Address

Return where this transport carries the request target.
Source§

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>

Poll until the connection is closed by either side.
Source§

fn metrics(&self) -> impl Metrics

Return connection-level metrics; by default, none are tracked.
Source§

fn wire(&self) -> Option<Wire>

Return the wire counters this transport updates, or None when it tracks none.
Source§

fn probe(&self) -> Option<Probe>

Return the target this transport’s sender probes up to, or None when it has no sender. Read more
Source§

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

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

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

Accept the next unidirectional stream opened by the peer.
Source§

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

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

Open a bidirectional stream, its sending half scheduled by options, waiting for stream credit if necessary.
Source§

fn recv_datagram(&self) -> RecvDatagram<'_, Self> ⓘ

Receive the next datagram from the peer.
Source§

fn closed(&self) -> SessionClosed<'_, Self> ⓘ

Wait until the session is closed by either side, returning the reason.

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<S> Boxable for S

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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