pub struct ThreadRef {
pub remote: Option<RemoteName>,
pub id: ThreadId,
}Expand description
A client-facing reference to a thread: which daemon it lives on
(remote: None means the local daemon) plus its thread ID there.
On the wire this serializes as the historical composite string —
"{remote}/{id}" for remote threads, bare "{id}" for local ones — so
clients see a plain string and the daemon parses it back losslessly.
A session is identified by its root thread’s ThreadRef.
Ordering is (remote, id): local threads sort before remote ones, then
by thread ID. (This differs from lexicographic ordering of the composite
string, which would interleave remotes with local IDs.)
Fields§
§remote: Option<RemoteName>The remote daemon hosting the thread; None for the local daemon.
id: ThreadIdThe thread’s ID on its home daemon.
Implementations§
Source§impl ThreadRef
impl ThreadRef
Sourcepub fn remote(remote: RemoteName, id: ThreadId) -> Self
pub fn remote(remote: RemoteName, id: ThreadId) -> Self
A reference to a thread on the named remote daemon.
§Panics
Panics if remote contains /, which would make the composite wire
encoding ("{remote}/{id}") ambiguous.
Sourcepub fn prefixed(self, remote: &RemoteName) -> Self
pub fn prefixed(self, remote: &RemoteName) -> Self
Re-home this reference onto remote (used when a daemon proxies a
remote daemon’s messages to its own clients).
§Panics
Panics if remote contains /, which would make the composite wire
encoding ("{remote}/{id}") ambiguous.
Sourcepub fn strip(self, remote: &RemoteName) -> Self
pub fn strip(self, remote: &RemoteName) -> Self
Strip the given remote, yielding the thread’s ID on its home daemon. References to other remotes (or local ones) are returned unchanged.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ThreadRef
impl<'de> Deserialize<'de> for ThreadRef
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
impl Eq for ThreadRef
Source§impl Ord for ThreadRef
impl Ord for ThreadRef
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for ThreadRef
impl PartialOrd for ThreadRef
impl StructuralPartialEq for ThreadRef
Auto Trait Implementations§
impl Freeze for ThreadRef
impl RefUnwindSafe for ThreadRef
impl Send for ThreadRef
impl Sync for ThreadRef
impl Unpin for ThreadRef
impl UnsafeUnpin for ThreadRef
impl UnwindSafe for ThreadRef
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.