MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / wait_for_display_rotation

Method wait_for_display_rotation

packages/server/src/android.rs:630–644  ·  view source on GitHub ↗
(&self, serial: &str, rotation: u16)

Source from the content-addressed store, hash-verified

628 }
629
630 fn wait_for_display_rotation(&self, serial: &str, rotation: u16) {
631 let deadline = Instant::now() + Duration::from_secs(4);
632 while Instant::now() < deadline {
633 self.invalidate_display_metrics_for_serial(serial);
634 if self
635 .display_metrics_for_serial(serial)
636 .map(|metrics| metrics.rotation_quarter_turns == rotation)
637 .unwrap_or(false)
638 {
639 return;
640 }
641 thread::sleep(Duration::from_millis(100));
642 }
643 self.invalidate_display_metrics_for_serial(serial);
644 }
645
646 pub fn toggle_appearance(&self, id: &str) -> Result<(), AppError> {
647 let serial = self.serial_for_id(id)?;

Callers 1

Calls 3

sleepFunction · 0.50

Tested by

no test coverage detected