Skip to main content

ConnectorServerHandler

Trait ConnectorServerHandler 

Source
pub trait ConnectorServerHandler<___T: Transport = Channel> {
    // Required methods
    fn get_spec(
        &mut self,
        responder: Responder<GetSpec, ___T>,
    ) -> impl Future<Output = ()> + Send;
    fn watch(
        &mut self,
        request: Request<Watch, ___T>,
        responder: Responder<Watch, ___T>,
    ) -> impl Future<Output = ()> + Send;

    // Provided method
    fn on_unknown_interaction(
        &mut self,
        ordinal: u64,
    ) -> impl Future<Output = ()> + Send { ... }
}
Expand description

A server handler for the Connector protocol.

See Connector for more details.

Required Methods§

Source

fn get_spec( &mut self, responder: Responder<GetSpec, ___T>, ) -> impl Future<Output = ()> + Send

Returns static hardware characteristics of the USB connector that do not change during operation.

Source

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

Hanging get for the connector state. Returns immediately on the first call, then when the state has changed since the last returned value. State transitions are delivered in order and not coalesced across calls (for example, DEVICE -> NONE -> DEVICE delivers NONE on the next call and DEVICE on the following call).

If present, setup_wake_lease keeps the system awake while the server processes the call. If the call is answered immediately, as the first call always is, the server hands it back as wake_lease unless it returns a wake lease of its own. If the call is parked, the server drops it.

If present, wake_lease is a wake lease that the client should hold while it handles the returned state. On a suspend-capable system, the server must return a wake lease on every transition of a field in Spec.wake_on (which must include data_role, including transitions to NONE so downstream drivers can drain transfers and power down before suspend), or hand back setup_wake_lease on an immediate reply when no server lease is attached.

Returns:

  • ZX_ERR_BAD_STATE: A Watch call is already pending on this channel; the existing pending call remains intact.

Provided Methods§

Source

fn on_unknown_interaction( &mut self, ordinal: u64, ) -> impl Future<Output = ()> + Send

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§