/// Creates a new focus listener that holds proxy to text manager and shortcut manager.
/// The caller is expected to spawn a task to continually listen to focus change event.
/// Example:
/// let mut listener = FocusListener::new();
/// fuchsia_async::Task::local(async move {
///     let _ = listener.dispatch_focus_changes().await;
/// }).detach();
///
/// # Errors
/// If unable to connect to text_manager, shortcut manager or protocols.
Creates a new focus listener that holds proxy to text manager and shortcut manager.
The caller is expected to spawn a task to continually listen to focus change event.
Creates a new focus listener that holds proxy to text manager and shortcut manager . The caller is expected to spawn a task to continually listen to focus change event .
pub fn new() -> Result<Self, Error> {
        let text_manager = connect_to_protocol::<fidl_focus::ControllerMarker>()?;
        let shortcut_manager = connect_to_protocol::<fidl_ui_shortcut::ManagerMarker>()?;
        let (focus_chain_listener_client_end, focus_chain_listener) =
            fidl::endpoints::create_request_stream::<focus::FocusChainListenerMarker>()?;
        let focus_chain_listener_registry: focus::FocusChainListenerRegistryProxy =
            connect_to_protocol::<focus::FocusChainListenerRegistryMarker>()?;
        focus_chain_listener_registry
            .register(focus_chain_listener_client_end)
            .context("Failed to register focus chain listener.")?;
        Ok(Self::new_listener(text_manager, shortcut_manager, focus_chain_listener))
    }
pub fn new ( ) -> Result < Self , Error > { let text_manager = connect_to_protocol :: < fidl_focus :: ControllerMarker > ( ) ? ; let shortcut_manager = connect_to_protocol :: < fidl_ui_shortcut :: ManagerMarker > ( ) ? ; let ( focus_chain_listener_client_end , focus_chain_listener ) = fidl :: endpoints :: create_request_stream :: < focus :: FocusChainListenerMarker > ( ) ? ; let focus_chain_listener_registry : focus :: FocusChainListenerRegistryProxy = connect_to_protocol :: < focus :: FocusChainListenerRegistryMarker > ( ) ? ; focus_chain_listener_registry . register ( focus_chain_listener_client_end ) . context ( " " ) ? ; Ok ( Self :: new_listener ( text_manager , shortcut_manager , focus_chain_listener ) ) }
Creates a new focus listener that holds proxy to text manager and shortcut manager.
Creates a new focus listener that holds proxy to text manager and shortcut manager .
errors
If unable to connect to text_manager, shortcut manager or protocols.
If unable to connect to text_manager shortcut manager or protocols .