fn create_input_devices(
    device_type: DeviceType,
    device_name: &str,
    device_state: u64,
) -> Vec<InputDevice> {
    let mut devices = Vec::new();
    let mut source_states = Vec::new();
    source_states.push(SourceState {
        source: Some(DeviceStateSource::Hardware),
        state: Some(DeviceState {
            toggle_flags: ToggleStateFlags::from_bits(1),
            ..DeviceState::EMPTY
        }),
        ..SourceState::EMPTY
    });
    source_states.push(SourceState {
        source: Some(DeviceStateSource::Software),
        state: Some(u64_to_state(device_state)),
        ..SourceState::EMPTY
    });
    let device = InputDevice {
        device_name: Some(device_name.to_string()),
        device_type: Some(device_type),
        source_states: Some(source_states),
        mutable_toggle_state: ToggleStateFlags::from_bits(12),
        state: Some(u64_to_state(device_state)),
        ..InputDevice::EMPTY
    };
    devices.push(device);
    devices
}
/// Creates a one-item list of input devices with the given properties.
Creates a one-item list of input devices with the given properties.
Creates a one - item list of input devices with the given properties .
fn create_input_devices(
    device_type: DeviceType,
    device_name: &str,
    device_state: u64,
) -> Vec<InputDevice> {
    let mut devices = Vec::new();
    let mut source_states = Vec::new();
    source_states.push(SourceState {
        source: Some(DeviceStateSource::Hardware),
        state: Some(DeviceState {
            toggle_flags: ToggleStateFlags::from_bits(1),
            ..DeviceState::EMPTY
        }),
        ..SourceState::EMPTY
    });
    source_states.push(SourceState {
        source: Some(DeviceStateSource::Software),
        state: Some(u64_to_state(device_state)),
        ..SourceState::EMPTY
    });
    let device = InputDevice {
        device_name: Some(device_name.to_string()),
        device_type: Some(device_type),
        source_states: Some(source_states),
        mutable_toggle_state: ToggleStateFlags::from_bits(12),
        state: Some(u64_to_state(device_state)),
        ..InputDevice::EMPTY
    };
    devices.push(device);
    devices
}
fn create_input_devices ( device_type : DeviceType , device_name : & str , device_state : u64 , ) -> Vec < InputDevice > { let mut devices = Vec :: new ( ) ; let mut source_states = Vec :: new ( ) ; source_states . push ( SourceState { source : Some ( DeviceStateSource :: Hardware ) , state : Some ( DeviceState { toggle_flags : ToggleStateFlags :: from_bits ( 1 ) , .. DeviceState :: EMPTY } ) , .. SourceState :: EMPTY } ) ; source_states . push ( SourceState { source : Some ( DeviceStateSource :: Software ) , state : Some ( u64_to_state ( device_state ) ) , .. SourceState :: EMPTY } ) ; let device = InputDevice { device_name : Some ( device_name . to_string ( ) ) , device_type : Some ( device_type ) , source_states : Some ( source_states ) , mutable_toggle_state : ToggleStateFlags :: from_bits ( 12 ) , state : Some ( u64_to_state ( device_state ) ) , .. InputDevice :: EMPTY } ; devices . push ( device ) ; devices }
Creates a one-item list of input devices with the given properties.
Creates a one - item list of input devices with the given properties .
device_type
DeviceType
device_name
&str
device_state
u64
device_type
DeviceType
device_name
&str
device_state
u64