async fn send_event_to_scenic(
        &self,
        touch_event: &touch_binding::TouchEvent,
        touch_descriptor: &touch_binding::TouchDeviceDescriptor,
        event_time: zx::Time,
    ) -> Result<(), anyhow::Error> {
        // The order in which events are sent to clients.
        let ordered_phases = vec![
            pointerinjector::EventPhase::Add,
            pointerinjector::EventPhase::Change,
            pointerinjector::EventPhase::Remove,
        ];

        let mut events: Vec<pointerinjector::Event> = vec![];
        for phase in ordered_phases {
            let contacts: Vec<touch_binding::TouchContact> = touch_event
                .injector_contacts
                .get(&phase)
                .map_or(vec![], |contacts| contacts.to_owned());
            let new_events = contacts.into_iter().map(|contact| {
                Self::create_pointer_sample_event(
                    phase,
                    &contact,
                    touch_descriptor,
                    &self.display_size,
                    event_time,
                )
            });
            events.extend(new_events);
        }

        let inner = self.inner.borrow();
        if let Some(injector) = inner.injectors.get(&touch_descriptor.device_id) {
            let events_to_send = &mut events.into_iter();
            let _ = injector.inject(events_to_send).await;
            Ok(())
        } else {
            Err(anyhow::format_err!(
                "No injector found for touch device {}.",
                touch_descriptor.device_id
            ))
        }
    }
/// Sends the given event to Scenic.
///
/// # Parameters
/// - `touch_event`: The touch event to send to Scenic.
/// - `touch_descriptor`: The descriptor for the device that sent the touch event.
/// - `event_time`: The time in nanoseconds when the event was first recorded.
Sends the given event to Scenic.
Sends the given event to Scenic .
async fn send_event_to_scenic(
        &self,
        touch_event: &touch_binding::TouchEvent,
        touch_descriptor: &touch_binding::TouchDeviceDescriptor,
        event_time: zx::Time,
    ) -> Result<(), anyhow::Error> {
        // The order in which events are sent to clients.
        let ordered_phases = vec![
            pointerinjector::EventPhase::Add,
            pointerinjector::EventPhase::Change,
            pointerinjector::EventPhase::Remove,
        ];
        let mut events: Vec<pointerinjector::Event> = vec![];
        for phase in ordered_phases {
            let contacts: Vec<touch_binding::TouchContact> = touch_event
                .injector_contacts
                .get(&phase)
                .map_or(vec![], |contacts| contacts.to_owned());
            let new_events = contacts.into_iter().map(|contact| {
                Self::create_pointer_sample_event(
                    phase,
                    &contact,
                    touch_descriptor,
                    &self.display_size,
                    event_time,
                )
            });
            events.extend(new_events);
        }
        let inner = self.inner.borrow();
        if let Some(injector) = inner.injectors.get(&touch_descriptor.device_id) {
            let events_to_send = &mut events.into_iter();
            let _ = injector.inject(events_to_send).await;
            Ok(())
        } else {
            Err(anyhow::format_err!(
                "No injector found for touch device {}.",
                touch_descriptor.device_id
            ))
        }
    }
async fn send_event_to_scenic ( & self , touch_event : & touch_binding :: TouchEvent , touch_descriptor : & touch_binding :: TouchDeviceDescriptor , event_time : zx :: Time , ) -> Result < ( ) , anyhow :: Error > { // The order in which events are sent to clients. let ordered_phases = vec ! [ pointerinjector EventPhase Add pointerinjector EventPhase Change pointerinjector EventPhase Remove ] ; let mut events : Vec < pointerinjector :: Event > = vec ! [ ] ; for phase in ordered_phases { let contacts : Vec < touch_binding :: TouchContact > = touch_event . injector_contacts . get ( & phase ) . map_or ( vec ! [ ] , | contacts | contacts . to_owned ( ) ) ; let new_events = contacts . into_iter ( ) . map ( | contact | { Self :: create_pointer_sample_event ( phase , & contact , touch_descriptor , & self . display_size , event_time , ) } ) ; events . extend ( new_events ) ; } let inner = self . inner . borrow ( ) ; if let Some ( injector ) = inner . injectors . get ( & touch_descriptor . device_id ) { let events_to_send = & mut events . into_iter ( ) ; let _ = injector . inject ( events_to_send ) . await ; Ok ( ( ) ) } else { Err ( anyhow :: format_err ! ( " " touch_descriptor device_id ) ) } }
Sends the given event to Scenic.
Sends the given event to Scenic .
&self
touch_event
&touch_binding::TouchEvent
touch_descriptor
&touch_binding::TouchDeviceDescriptor
event_time
zx::Time
&self
touch_event
&touch_binding::TouchEvent
The touch event to send to Scenic.
The touch event to send to Scenic .
touch_descriptor
&touch_binding::TouchDeviceDescriptor
The descriptor for the device that sent the touch event.
The descriptor for the device that sent the touch event .
event_time
zx::Time
The time in nanoseconds when the event was first recorded.
The time in nanoseconds when the event was first recorded .