pub struct KeyboardBinding { /* private fields */ }Expand description
A KeyboardBinding represents a connection to a keyboard input device.
The KeyboardBinding parses and exposes keyboard device descriptor properties (e.g., the
available keyboard keys) for the device it is associated with. It also parses InputReports
from the device, and sends them to the device binding owner over event_sender.
Implementations§
Source§impl KeyboardBinding
impl KeyboardBinding
Sourcepub async fn new(
device_proxy: InputDeviceProxy,
device_id: u32,
input_event_sender: UnboundedSender<InputEvent>,
device_node: Node,
metrics_logger: MetricsLogger,
) -> Result<Self, Error>
pub async fn new( device_proxy: InputDeviceProxy, device_id: u32, input_event_sender: UnboundedSender<InputEvent>, device_node: Node, metrics_logger: MetricsLogger, ) -> Result<Self, Error>
Creates a new InputDeviceBinding from the device_proxy.
The binding will start listening for input reports immediately and send new InputEvents
to the device binding owner over input_event_sender.
§Parameters
device_proxy: The proxy to bind the newInputDeviceBindingto.device_id: The unique identifier of this device.input_event_sender: The channel to send new InputEvents to.device_node: The inspect node for this device bindingmetrics_logger: The metrics logger.
§Errors
If there was an error binding to the proxy.
Sourcepub fn to_modifiers(keys: &[&Key]) -> Option<Modifiers>
pub fn to_modifiers(keys: &[&Key]) -> Option<Modifiers>
Converts a vector of keyboard keys to the appropriate [fidl_ui_input3::Modifiers] bitflags.
For example, if keys contains Key::CapsLock, the bitflags will contain the corresponding
flags for CapsLock.
§Parameters
keys: The keys to check for modifiers.
§Returns
Returns None if there are no modifier keys present.
Trait Implementations§
Source§impl InputDeviceBinding for KeyboardBinding
impl InputDeviceBinding for KeyboardBinding
Source§fn input_event_sender(&self) -> UnboundedSender<InputEvent>
fn input_event_sender(&self) -> UnboundedSender<InputEvent>
Source§fn get_device_descriptor(&self) -> InputDeviceDescriptor
fn get_device_descriptor(&self) -> InputDeviceDescriptor
Auto Trait Implementations§
impl Freeze for KeyboardBinding
impl !RefUnwindSafe for KeyboardBinding
impl Send for KeyboardBinding
impl Sync for KeyboardBinding
impl Unpin for KeyboardBinding
impl !UnwindSafe for KeyboardBinding
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
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
T to [Self]§impl<T> IntoAny for T
impl<T> IntoAny for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more