pub struct ClientSession { /* private fields */ }Expand description
A live session with the v2 broker.
Wraps the underlying local IPC stream plus the broker’s Negotiated
reply. Future slices add operations on top (streaming frames, HTTP
endpoint discovery, etc.); slice 4 exposes only the handshake
result so downstream consumers can pin the API shape now.
Implementations§
Source§impl ClientSession
impl ClientSession
Sourcepub fn negotiated(&self) -> &Negotiated
pub fn negotiated(&self) -> &Negotiated
The broker’s negotiated reply to our Hello.
Sourcepub fn into_inner(self) -> (LegacyStream, Negotiated)
pub fn into_inner(self) -> (LegacyStream, Negotiated)
Consume the session into the raw byte stream + negotiated reply.
Slices that add post-handshake operations build them on this raw stream until the v2 client surface stabilizes.
Sourcepub fn connect_backend(self) -> Result<LegacyStream, BackendDialError>
pub fn connect_backend(self) -> Result<LegacyStream, BackendDialError>
Dial the backend the broker named, and hand back that connection.
The stream inside a ClientSession is connected to the broker,
not to the backend — it exists to carry the Hello. The data connection
is a second dial, to Negotiated.backend_pipe, and this performs it.
This is v1’s BrokerNegotiated route, step for step: client.rs
reads the HelloReply, refuses an empty backend_pipe, then calls
crate::broker::client::connect_local_socket on it and treats that socket as the
connection. Keeping the sequence identical is the point — a consumer
moving from v1’s client_compat re-exports to client_v2 must not be
able to tell, and the way to guarantee that is to do the same thing
rather than something equivalent-looking.
The broker stream is dropped here, as v1 drops it: its job ended with the reply.
Sourcepub fn into_backend_io(self) -> Result<OwnedBackendIo, BackendDialError>
pub fn into_backend_io(self) -> Result<OwnedBackendIo, BackendDialError>
connect_backend, handed back as an owned OS
handle for a consumer that wants to run its own protocol over it.
The v2 counterpart of v1’s into_backend_io. v1 can hand back the
session’s own stream because by then it is already the backend
connection; here the dial happens first, so the handle a caller
receives is the same kind of socket either way.
Unix-only, matching v1: the Windows OwnedHandle path is deferred
(#720) and returns IntoBackendIoError::WindowsUnsupported. Plain
backticks, not an intra-doc link: that variant is #[cfg(windows)],
so a link to it is unresolvable on the platform CI documents. The
neighbouring reference in adopt.rs is written the same way for the
same reason. zccache
already re-dials with its own transport on Windows for that reason, so
this parity is what keeps its two platform lanes unchanged.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ClientSession
impl RefUnwindSafe for ClientSession
impl Send for ClientSession
impl Sync for ClientSession
impl Unpin for ClientSession
impl UnsafeUnpin for ClientSession
impl UnwindSafe for ClientSession
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>. Box<dyn Any> can
then be further downcast into Box<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>. Rc<Any> 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> DowncastSync for T
impl<T> DowncastSync for T
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