Skip to main content

ClientSession

Struct ClientSession 

Source
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

Source

pub fn negotiated(&self) -> &Negotiated

The broker’s negotiated reply to our Hello.

Source

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.

Source

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.

Source

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§

Source§

impl Debug for ClientSession

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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>

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

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

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

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

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<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, 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> 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> Same for T

Source§

type Output = T

Should always be Self
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.