Skip to main content

PortWatcherLocalServerHandler

Trait PortWatcherLocalServerHandler 

Source
pub trait PortWatcherLocalServerHandler<___T: Transport = Channel> {
    // Required method
    fn watch(
        &mut self,
        responder: Responder<Watch, ___T>,
    ) -> impl Future<Output = ()>;
}
Expand description

A server handler for the PortWatcher protocol.

See PortWatcher for more details.

Required Methods§

Source

fn watch( &mut self, responder: Responder<Watch, ___T>, ) -> impl Future<Output = ()>

Get the next port event.

The first N calls return [DevicePortEvent.existing] where N is the number of ports present on the device at the time of the watcher’s creation. The next call returns [DevicePortEvent.idle] to indicate the end of existing ports. Subsequent calls block until a port is added ([DevicePortEvent.added]) or removed ([DevicePortEvent.removed]).

The server closes the PortWatcher channel with ZX_ERR_CANCELED if the number of unread events reaches a server-selected limit that is at least two times MAX_PORTS. Clients are encouraged to maintain a hanging call to Watch at all times to avoid triggering this condition.

  • response event next port event.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<___H, ___T> PortWatcherLocalServerHandler<___T> for Local<___H>
where ___H: PortWatcherServerHandler<___T>, ___T: Transport,

Source§

async fn watch(&mut self, responder: Responder<Watch, ___T>)

Implementors§