Skip to main content

WatchClient

Struct WatchClient 

Source
pub struct WatchClient<S> { /* private fields */ }
Expand description

A negotiated lifecycle subscription. A peer without WATCH returns None during setup so the application may retain discovery polling. An error after advertising WATCH is terminal; it never triggers a protocol downgrade.

Authenticate the OS peer before connecting and compare snapshot().process_id with the peer PID the kernel reports for this connection. Agreement checks the protocol’s claim against transport evidence; it does not authenticate the executable or any discovery record. Cancelling changed poisons the underlying framed session; drop it and reconnect rather than continuing from a partial frame.

Implementations§

Source§

impl<S: AsyncRead + AsyncWrite + Unpin> WatchClient<S>

Source

pub async fn connect( stream: S, offer: &Hello, deadline: Instant, ) -> Result<Option<Self>>

Negotiate, subscribe, and receive the initial snapshot under one deadline.

Source

pub fn snapshot(&self) -> &LifecycleEvent

Most recently received state, including the initial snapshot.

Source

pub async fn changed(&mut self) -> Result<&LifecycleEvent>

Wait for new state. There is no background polling or idle timeout.

Auto Trait Implementations§

§

impl<S> Freeze for WatchClient<S>
where AsyncSession<S>: Freeze,

§

impl<S> RefUnwindSafe for WatchClient<S>

§

impl<S> Send for WatchClient<S>
where AsyncSession<S>: Send,

§

impl<S> Sync for WatchClient<S>
where AsyncSession<S>: Sync,

§

impl<S> Unpin for WatchClient<S>
where AsyncSession<S>: Unpin,

§

impl<S> UnsafeUnpin for WatchClient<S>

§

impl<S> UnwindSafe for WatchClient<S>

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> 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, 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.