pub struct ConnectionContext {
pub connection_id: Uuid,
pub notify: NotifySender,
}Expand description
Per-connection state passed to every JSON-RPC method handler.
Why: threading this uniformly (rather than adding a second handler trait
just for session.attach) keeps the dispatch path — and every future
method — on one call signature. See the module docs for the STDIO vs.
HTTP distinction.
What: connection_id is a fresh Uuid per STDIO process invocation or
per HTTP POST /rpc call; notify is that connection’s outbound
notification sink.
Test: context::tests::connection_context_is_constructible.
Fields§
§connection_id: Uuid§notify: NotifySenderImplementations§
Source§impl ConnectionContext
impl ConnectionContext
Sourcepub fn new(notify: NotifySender) -> Self
pub fn new(notify: NotifySender) -> Self
Build a fresh context with a brand-new connection_id and the given
notify sender.
Why: every transport builds exactly one context per connection
(STDIO: once per process; HTTP: once per POST /rpc call).
What: Uuid::new_v4() for the id, notify stored verbatim.
Test: context::tests::connection_context_is_constructible.
Trait Implementations§
Source§impl Clone for ConnectionContext
impl Clone for ConnectionContext
Source§fn clone(&self) -> ConnectionContext
fn clone(&self) -> ConnectionContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ConnectionContext
impl RefUnwindSafe for ConnectionContext
impl Send for ConnectionContext
impl Sync for ConnectionContext
impl Unpin for ConnectionContext
impl UnsafeUnpin for ConnectionContext
impl UnwindSafe for ConnectionContext
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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