pub struct SingleLaneSession<P: Protocol, C, S> { /* private fields */ }Expand description
A session over a transport that carries exactly one lane.
Built from a lane that already exists — a framed TCP or unix stream — and hands it out once.
Implementations§
Source§impl<P: Protocol, C> SingleLaneSession<P, C, NoServiceLane<P>>
impl<P: Protocol, C> SingleLaneSession<P, C, NoServiceLane<P>>
Source§impl<P: Protocol, S> SingleLaneSession<P, NoClientLane<P>, S>
impl<P: Protocol, S> SingleLaneSession<P, NoClientLane<P>, S>
Source§impl<P, T> SingleLaneSession<P, Framed<T, ClientCodec<P>>, NoServiceLane<P>>
impl<P, T> SingleLaneSession<P, Framed<T, ClientCodec<P>>, NoServiceLane<P>>
Sourcepub fn client_io(io: T) -> Self
pub fn client_io(io: T) -> Self
r[impl jetstream.session.conformance.single-stream]
Frame a byte stream — TCP, TLS, a unix socket, stdio — as the one
lane this peer can open. Its capabilities are
Capabilities::byte_stream unless the caller reports an
identity the stream established, as a TLS stream would.
Source§impl<P, T> SingleLaneSession<P, NoClientLane<P>, Framed<T, ServerCodec<P>>>where
P: Protocol,
T: AsyncRead + AsyncWrite + Send + Sync + Unpin,
Framed<T, ServerCodec<P>>: Contextual,
impl<P, T> SingleLaneSession<P, NoClientLane<P>, Framed<T, ServerCodec<P>>>where
P: Protocol,
T: AsyncRead + AsyncWrite + Send + Sync + Unpin,
Framed<T, ServerCodec<P>>: Contextual,
Sourcepub fn service_io(io: T) -> Self
pub fn service_io(io: T) -> Self
r[impl jetstream.session.conformance.single-stream] Frame an accepted byte stream as the one lane this peer serves.
For a stream that knows its peer — a unix socket or TCP. Anything
else wants Self::service_io_with_context.
Source§impl<P, T> SingleLaneSession<P, NoClientLane<P>, ContextualLane<Framed<T, ServerCodec<P>>>>
impl<P, T> SingleLaneSession<P, NoClientLane<P>, ContextualLane<Framed<T, ServerCodec<P>>>>
Sourcepub fn service_io_with_context(io: T, context: Context) -> Self
pub fn service_io_with_context(io: T, context: Context) -> Self
r[impl jetstream.session.conformance.single-stream] Frame an accepted byte stream whose peer identity the caller supplies rather than the stream knowing it.
r[impl jetstream.session.identity]
This is the path for a TLS stream, whose peer is established by a
handshake the framed bytes never see, and for stdio or an
in-memory stream, which have no peer at all — pass
Context::default for those.
Source§impl<P: Protocol, C, S> SingleLaneSession<P, C, S>
impl<P: Protocol, C, S> SingleLaneSession<P, C, S>
Sourcepub fn live_lanes(&self) -> usize
pub fn live_lanes(&self) -> usize
How many lanes this session is currently keeping alive.
Sourcepub fn with_identity(self, identity: IdentityKind) -> Self
pub fn with_identity(self, identity: IdentityKind) -> Self
Report a peer identity model other than
IdentityKind::None — a TLS stream authenticates its peer even
though it carries one lane.
Sourcepub fn with_context(self, context: Context) -> Self
pub fn with_context(self, context: Context) -> Self
Attach the peer identity the transport established.
r[impl jetstream.session.identity] A lane accepted from this session reports this identity rather than whatever the framed stream underneath knows, so a TLS adapter’s authenticated peer reaches the handler.
Trait Implementations§
Source§impl<P: Protocol, C, S> Debug for SingleLaneSession<P, C, S>
impl<P: Protocol, C, S> Debug for SingleLaneSession<P, C, S>
Source§impl<P: Protocol, C, S> Drop for SingleLaneSession<P, C, S>
r[impl jetstream.session.lifetime]
A lane must not outlive its session, so a session that goes away
without close — dropped during error unwinding, say — terminates
its lane just the same.
impl<P: Protocol, C, S> Drop for SingleLaneSession<P, C, S>
r[impl jetstream.session.lifetime]
A lane must not outlive its session, so a session that goes away
without close — dropped during error unwinding, say — terminates
its lane just the same.
Source§impl<P, C, S> Session<P> for SingleLaneSession<P, C, S>
impl<P, C, S> Session<P> for SingleLaneSession<P, C, S>
Source§fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
r[impl jetstream.session.lifetime] Terminates the lane whether or not it has been handed out: cancelling reaches a lane the caller already owns, so a call in flight on it fails rather than continuing to run on a session that has closed. A lane handed out concurrently with this call is born cancelled rather than escaping it.
Source§type ClientLane = LaneGuard<C>
type ClientLane = LaneGuard<C>
Source§type ServiceLane = LaneGuard<S>
type ServiceLane = LaneGuard<S>
Source§fn capabilities(&self) -> Capabilities
fn capabilities(&self) -> Capabilities
Source§fn context(&self) -> Context
fn context(&self) -> Context
Source§fn open_lane<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Self::ClientLane, SessionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn open_lane<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Self::ClientLane, SessionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn accept_lane<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Self::ServiceLane, SessionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn accept_lane<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Self::ServiceLane, SessionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl<P, C, S> !Freeze for SingleLaneSession<P, C, S>
impl<P, C, S> !RefUnwindSafe for SingleLaneSession<P, C, S>
impl<P, C, S> !UnwindSafe for SingleLaneSession<P, C, S>
impl<P, C, S> Send for SingleLaneSession<P, C, S>
impl<P, C, S> Sync for SingleLaneSession<P, C, S>
impl<P, C, S> Unpin for SingleLaneSession<P, C, S>
impl<P, C, S> UnsafeUnpin for SingleLaneSession<P, C, S>where
Mutex<Option<C>>: UnsafeUnpin,
Mutex<Option<S>>: UnsafeUnpin,
PhantomData<fn() -> P>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more