pub struct Ipc<Ops>where
Ops: OpsT,{ /* private fields */ }Expand description
IPC endpoint that handles inbound messages for a target context and
maintains the registered method and notification handlers, keyed by the
operation type Ops.
Implementations§
Source§impl<Ops> Ipc<Ops>where
Ops: OpsT,
impl<Ops> Ipc<Ops>where
Ops: OpsT,
Sourcepub fn try_new_global_binding<Ident>(identifier: Ident) -> Result<Arc<Self>>where
Ident: ToString,
pub fn try_new_global_binding<Ident>(identifier: Ident) -> Result<Arc<Self>>where
Ident: ToString,
Creates an IPC binding bound to the global context, registering it as the global IPC handler source. Panics if a handler source is already registered.
Sourcepub fn try_new_window_binding<Ident>(
window: &Arc<Window>,
identifier: Ident,
) -> Result<Arc<Self>>where
Ident: ToString,
pub fn try_new_window_binding<Ident>(
window: &Arc<Window>,
identifier: Ident,
) -> Result<Arc<Self>>where
Ident: ToString,
Creates an IPC binding bound to the given window’s context, registering it as the global IPC handler source. Panics if a handler source is already registered.
Sourcepub async fn handle_message(
&self,
message: BorshMessage<'_, IpcId>,
source: Option<IpcTarget>,
) -> Result<()>
pub async fn handle_message( &self, message: BorshMessage<'_, IpcId>, source: Option<IpcTarget>, ) -> Result<()>
Processes an incoming Borsh-encoded IPC message, dispatching it to the appropriate registered method or notification handler, or resolving a pending outbound call when the message is a response.
Sourcepub fn method<Req, Resp>(&self, op: Ops, method: Method<Req, Resp>)
pub fn method<Req, Resp>(&self, op: Ops, method: Method<Req, Resp>)
Registers a request/response method handler for the given operation. Panics if a handler for the same operation has already been registered.
Sourcepub fn notification<Msg>(&self, op: Ops, method: Notification<Msg>)
pub fn notification<Msg>(&self, op: Ops, method: Notification<Msg>)
Registers a notification handler for the given operation. Panics if a handler for the same operation has already been registered.