(index: usize)
| 1787 | } |
| 1788 | |
| 1789 | fn console_port_for_avd_index(index: usize) -> Result<u16, AppError> { |
| 1790 | let index = u16::try_from(index).map_err(|_| { |
| 1791 | AppError::native("Android emulator console port overflowed while deriving ports.") |
| 1792 | })?; |
| 1793 | let console_offset = index.checked_mul(2).ok_or_else(|| { |
| 1794 | AppError::native("Android emulator console port overflowed while deriving ports.") |
| 1795 | })?; |
| 1796 | DEFAULT_EMULATOR_CONSOLE_PORT_BASE |
| 1797 | .checked_add(console_offset) |
| 1798 | .ok_or_else(|| { |
| 1799 | AppError::native("Android emulator console port overflowed while deriving ports.") |
| 1800 | }) |
| 1801 | } |
| 1802 | |
| 1803 | fn console_port_from_serial(serial: &str) -> Option<u16> { |
| 1804 | serial.strip_prefix("emulator-")?.parse::<u16>().ok() |
no outgoing calls
no test coverage detected