pub struct FocusListener { /* private fields */ }
Expand description
FocusListener listens to focus change and notify to related input modules.
Implementations§
Source§impl FocusListener
impl FocusListener
Sourcepub fn new(
focus_chain_publisher: FocusChainProviderPublisher,
metrics_logger: MetricsLogger,
) -> Result<Self, Error>
pub fn new( focus_chain_publisher: FocusChainProviderPublisher, metrics_logger: MetricsLogger, ) -> Result<Self, Error>
Creates a new focus listener that holds proxy to text manager. The caller is expected to spawn a task to continually listen to focus change event.
§Arguments
focus_chain_publisher
: Allows focus chain updates to be sent to downstream listeners. Note that this is not required forFocusListener
to function, so it could be made anOption
in future changes.
§Example
ⓘ
let mut listener = FocusListener::new(focus_chain_publisher);
let task = fuchsia_async::Task::local(async move {
listener.dispatch_focus_changes().await
});
§FIDL
Required:
fuchsia.ui.views.FocusChainListener
fuchsia.ui.keyboard.focus.Controller
§Errors
If unable to connect to the text_manager protocol.
Sourcepub async fn dispatch_focus_changes(&mut self) -> Result<(), Error>
pub async fn dispatch_focus_changes(&mut self) -> Result<(), Error>
Dispatches focus chain updates from focus_chain_listener
to text_manager
and any subscribers of focus_chain_publisher
.
Auto Trait Implementations§
impl Freeze for FocusListener
impl !RefUnwindSafe for FocusListener
impl Send for FocusListener
impl Sync for FocusListener
impl Unpin for FocusListener
impl !UnwindSafe for FocusListener
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more