| 1 | use bstrrust-analyzer cargo bstr 1.11.3 crate/::ByteSlicerust-analyzer cargo bstr 1.11.3 ext_slice/ByteSlice#; |
| 2 | use forensic_adbrust-analyzer cargo forensic-adb 0.8.1 crate/::{AndroidStorageInputrust-analyzer cargo forensic-adb 0.8.1 AndroidStorageInput#, DeviceErrorrust-analyzer cargo forensic-adb 0.8.1 DeviceError#, Hostrust-analyzer cargo forensic-adb 0.8.1 Host#}; |
| 3 | |
| 4 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::mainrust-analyzer cargo tokio-macros 2.5.0 main:] |
| 5 | async fn mainrust-analyzer cargo forensic-adb 0.8.1 main().() -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), DeviceErrorrust-analyzer cargo forensic-adb 0.8.1 DeviceError#> { |
| 6 | let host = Hostrust-analyzer cargo forensic-adb 0.8.1 Host#::defaultrust-analyzer cargo forensic-adb 0.8.1 impl#[Host][Default]default().(); |
| 7 | |
| 8 | let devices = host.devicesrust-analyzer cargo forensic-adb 0.8.1 impl#[Host]devices().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>().rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 9 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("Found devices: {:?}", devices); |
| 10 | |
| 11 | let device = host |
| 12 | .device_or_defaultrust-analyzer cargo forensic-adb 0.8.1 impl#[Host]device_or_default().(Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#::<&Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>::Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, AndroidStorageInputrust-analyzer cargo forensic-adb 0.8.1 AndroidStorageInput#::defaultrust-analyzer cargo forensic-adb 0.8.1 impl#[AndroidStorageInput][Default]default().()) |
| 13 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 14 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("Selected device: {:?}", device); |
| 15 | |
| 16 | let output = device.execute_host_exec_out_commandrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]execute_host_exec_out_command().("id").rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 17 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("Received response: {:?}", bstrrust-analyzer cargo bstr 1.11.3 crate/::BStrrust-analyzer cargo bstr 1.11.3 bstr/BStr#::newrust-analyzer cargo bstr 1.11.3 bstr/impl#[BStr]new().(&output)); |
| 18 | |
| 19 | let output = device |
| 20 | .execute_host_exec_out_commandrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]execute_host_exec_out_command().("pm list packages -f") |
| 21 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 22 | for line in output.linesrust-analyzer cargo bstr 1.11.3 ext_slice/ByteSlice#lines().() { |
| 23 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("Received line: {:?}", bstrrust-analyzer cargo bstr 1.11.3 crate/::BStrrust-analyzer cargo bstr 1.11.3 bstr/BStr#::newrust-analyzer cargo bstr 1.11.3 bstr/impl#[BStr]new().(line)); |
| 24 | } |
| 25 | |
| 26 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 27 | } |