pub fn spawn_key_event_injector(&self, mut stream: ui_input3::KeyEventInjectorRequestStream) {
        let mut keyboard3 = self.keyboard3.clone();
        let mut ime_service = self.ime_service.clone();
        fuchsia_async::Task::spawn(
            async move {
                let inverse_keymap = InverseKeymap::new(&keymaps::US_QWERTY);
                while let Some(msg) = stream.try_next().await.context(concat!(
                    "keyboard::Service::spawn_key_event_injector: ",
                    "error while reading the request stream for ",
                    "fuchsia.ui.input3.KeyEventInjector"
                ))? {
                    match msg {
                        ui_input3::KeyEventInjectorRequest::Inject {
                            mut key_event,
                            responder,
                            ..
                        } => {
                            key_event.key = key_event.key.or_else(|| {
                                key_from_key_meaning(&inverse_keymap, key_event.key_meaning)
                            });
                            ime_service
                                .inject_input(KeyEvent::new(
                                    &key_event,
                                    keyboard3.get_keys_pressed().await,
                                )?)
                                .await
                                .unwrap_or_else(|e| {
                                    // Most of the time this is not a real error: what it actually
                                    // means is that we tried to offer text input to a text edit
                                    // field, but no such field is currently in focus.  Therefore
                                    // increasing the verbosity of the message, so that it's only
                                    // printed when you *really* need it for debugging.
                                    fx_log_debug!(
                                        concat!(
                                            "keyboard::Service::spawn_key_event_injector: ",
                                            "error injecting input into IME: {:?}"
                                        ),
                                        e
                                    )
                                });
                            let was_handled = if keyboard3
                                .handle_key_event(key_event)
                                .await
                                .context("error handling input3 keyboard event")?
                            {
                                ui_input3::KeyEventStatus::Handled
                            } else {
                                ui_input3::KeyEventStatus::NotHandled
                            };
                            responder.send(was_handled).context(concat!(
                                "keyboard::Service::spawn_key_event_injector: ",
                                "error while sending response"
                            ))?;
                        }
                    }
                }
                Ok(())
            }
            .unwrap_or_else(|e: anyhow::Error| fx_log_err!("couldn't run: {:?}", e)),
        )
        .detach();
    }
/// Starts a task that processes `fuchsia.ui.input3.KeyEventInjector` requests.
/// This method returns immediately without blocking.
Starts a task that processes `fuchsia.ui.input3.KeyEventInjector` requests.
This method returns immediately without blocking.
Starts a task that processes ` fuchsia . ui . input3 . KeyEventInjector ` requests . This method returns immediately without blocking .
pub fn spawn_key_event_injector(&self, mut stream: ui_input3::KeyEventInjectorRequestStream) {
        let mut keyboard3 = self.keyboard3.clone();
        let mut ime_service = self.ime_service.clone();
        fuchsia_async::Task::spawn(
            async move {
                let inverse_keymap = InverseKeymap::new(&keymaps::US_QWERTY);
                while let Some(msg) = stream.try_next().await.context(concat!(
                    "keyboard::Service::spawn_key_event_injector: ",
                    "error while reading the request stream for ",
                    "fuchsia.ui.input3.KeyEventInjector"
                ))? {
                    match msg {
                        ui_input3::KeyEventInjectorRequest::Inject {
                            mut key_event,
                            responder,
                            ..
                        } => {
                            key_event.key = key_event.key.or_else(|| {
                                key_from_key_meaning(&inverse_keymap, key_event.key_meaning)
                            });
                            ime_service
                                .inject_input(KeyEvent::new(
                                    &key_event,
                                    keyboard3.get_keys_pressed().await,
                                )?)
                                .await
                                .unwrap_or_else(|e| {
                                    // Most of the time this is not a real error: what it actually
                                    // means is that we tried to offer text input to a text edit
                                    // field, but no such field is currently in focus.  Therefore
                                    // increasing the verbosity of the message, so that it's only
                                    // printed when you *really* need it for debugging.
                                    fx_log_debug!(
                                        concat!(
                                            "keyboard::Service::spawn_key_event_injector: ",
                                            "error injecting input into IME: {:?}"
                                        ),
                                        e
                                    )
                                });
                            let was_handled = if keyboard3
                                .handle_key_event(key_event)
                                .await
                                .context("error handling input3 keyboard event")?
                            {
                                ui_input3::KeyEventStatus::Handled
                            } else {
                                ui_input3::KeyEventStatus::NotHandled
                            };
                            responder.send(was_handled).context(concat!(
                                "keyboard::Service::spawn_key_event_injector: ",
                                "error while sending response"
                            ))?;
                        }
                    }
                }
                Ok(())
            }
            .unwrap_or_else(|e: anyhow::Error| fx_log_err!("couldn't run: {:?}", e)),
        )
        .detach();
    }
pub fn spawn_key_event_injector ( & self , mut stream : ui_input3 :: KeyEventInjectorRequestStream ) { let mut keyboard3 = self . keyboard3 . clone ( ) ; let mut ime_service = self . ime_service . clone ( ) ; fuchsia_async :: Task :: spawn ( async move { let inverse_keymap = InverseKeymap :: new ( & keymaps :: US_QWERTY ) ; while let Some ( msg ) = stream . try_next ( ) . await . context ( concat ! ( " " " " " " ) ) ? { match msg { ui_input3 :: KeyEventInjectorRequest :: Inject { mut key_event , responder , .. } => { key_event . key = key_event . key . or_else ( | | { key_from_key_meaning ( & inverse_keymap , key_event . key_meaning ) } ) ; ime_service . inject_input ( KeyEvent :: new ( & key_event , keyboard3 . get_keys_pressed ( ) . await , ) ? ) . await . unwrap_or_else ( | e | { // Most of the time this is not a real error: what it actually // means is that we tried to offer text input to a text edit // field, but no such field is currently in focus.  Therefore // increasing the verbosity of the message, so that it's only // printed when you *really* need it for debugging. fx_log_debug ! ( concat ( " " " " ) e ) } ) ; let was_handled = if keyboard3 . handle_key_event ( key_event ) . await . context ( " " ) ? { ui_input3 :: KeyEventStatus :: Handled } else { ui_input3 :: KeyEventStatus :: NotHandled } ; responder . send ( was_handled ) . context ( concat ! ( " " " " ) ) ? ; } } } Ok ( ( ) ) } . unwrap_or_else ( | e : anyhow :: Error | fx_log_err ! ( " " e ) ) , ) . detach ( ) ; }
Starts a task that processes `fuchsia.ui.input3.KeyEventInjector` requests.
Starts a task that processes ` fuchsia . ui . input3 . KeyEventInjector ` requests .
&self
stream
ui_input3::KeyEventInjectorRequestStream
&self
stream
ui_input3::KeyEventInjectorRequestStream