From d52e7c77b17efe0aa9f19cdab5448d01a9e0a529 Mon Sep 17 00:00:00 2001 From: Corentin L Date: Mon, 25 Nov 2024 17:09:27 +0100 Subject: [PATCH] feat: fix doc + add github action --- .github/workflows/rust-quality.yml | 8 ++++++++ adb_client/README.md | 10 +++++----- adb_client/src/adb_device_ext.rs | 12 ++++++------ adb_client/src/server_device/commands/framebuffer.rs | 2 +- adb_client/src/server_device/commands/list.rs | 2 +- adb_client/src/server_device/commands/recv.rs | 2 +- adb_client/src/server_device/commands/send.rs | 2 +- adb_client/src/server_device/commands/stat.rs | 2 +- 8 files changed, 24 insertions(+), 16 deletions(-) diff --git a/.github/workflows/rust-quality.yml b/.github/workflows/rust-quality.yml index a501df5..2d8deb7 100644 --- a/.github/workflows/rust-quality.yml +++ b/.github/workflows/rust-quality.yml @@ -23,6 +23,14 @@ jobs: - name: Run formatter run : cargo fmt --all --check + doc: + name: "doc" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run doc + run : cargo doc --all-features --keep-going --offline + tests: name: "tests" runs-on: ubuntu-latest diff --git a/adb_client/README.md b/adb_client/README.md index f29bca5..e6df4d3 100644 --- a/adb_client/README.md +++ b/adb_client/README.md @@ -31,9 +31,9 @@ let mut server = ADBServer::new(SocketAddrV4::new(server_ip, server_port)); server.devices(); ``` -### Using ADB server as proxy +### Using ADB server as bridge -#### [TCP] Launch a command on device +#### Launch a command on device ```rust no_run use adb_client::{ADBServer, ADBDeviceExt}; @@ -43,7 +43,7 @@ let mut device = server.get_device().expect("cannot get device"); device.shell_command(["df", "-h"],std::io::stdout()); ``` -#### [TCP] Push a file to the device +#### Push a file to the device ```rust no_run use adb_client::ADBServer; @@ -59,7 +59,7 @@ device.push(&mut input, "/data/local/tmp"); ### Interacting directly with device -#### [USB] Launch a command on device +#### (USB) Launch a command on device ```rust no_run use adb_client::{ADBUSBDevice, ADBDeviceExt}; @@ -70,7 +70,7 @@ let mut device = ADBUSBDevice::new(vendor_id, product_id).expect("cannot find de device.shell_command(["df", "-h"],std::io::stdout()); ``` -#### [USB] Push a file to the device +#### (USB) Push a file to the device ```rust no_run use adb_client::{ADBUSBDevice, ADBDeviceExt}; diff --git a/adb_client/src/adb_device_ext.rs b/adb_client/src/adb_device_ext.rs index 6bd92a9..d5e300f 100644 --- a/adb_client/src/adb_device_ext.rs +++ b/adb_client/src/adb_device_ext.rs @@ -4,9 +4,9 @@ use std::path::Path; use crate::models::AdbStatResponse; use crate::{RebootType, Result}; -/// Trait representing all features available on both [`ADBServerDevice`] and [`ADBMessageDevice`] ([`ADBUSBDevice`]) +/// Trait representing all features available on devices. pub trait ADBDeviceExt { - /// Runs 'command' in a shell on the device, and write its output and error streams into [`output`]. + /// Runs 'command' in a shell on the device, and write its output and error streams into `output`. fn shell_command( &mut self, command: impl IntoIterator, @@ -14,17 +14,17 @@ pub trait ADBDeviceExt { ) -> Result<()>; /// Starts an interactive shell session on the device. - /// Input data is read from [reader] and write to [writer]. - /// [W] has a 'static bound as it is internally used in a thread. + /// Input data is read from `reader` and write to `writer`. + /// `W` has a 'static bound as it is internally used in a thread. fn shell(&mut self, reader: R, writer: W) -> Result<()>; /// Display the stat information for a remote file fn stat(&mut self, remote_path: &str) -> Result; - /// Pull the remote file pointed to by [source] and write its contents into [`output`] + /// Pull the remote file pointed to by `source` and write its contents into `output` fn pull, W: Write>(&mut self, source: A, output: W) -> Result<()>; - /// Push [stream] to [path] on the device. + /// Push `stream` to `path` on the device. fn push>(&mut self, stream: R, path: A) -> Result<()>; /// Reboots the device using given reboot type diff --git a/adb_client/src/server_device/commands/framebuffer.rs b/adb_client/src/server_device/commands/framebuffer.rs index 16e9518..706c663 100644 --- a/adb_client/src/server_device/commands/framebuffer.rs +++ b/adb_client/src/server_device/commands/framebuffer.rs @@ -104,7 +104,7 @@ impl TryFrom<[u8; std::mem::size_of::()]> for FrameBufferInfoV2 { impl ADBServerDevice { /// Dump framebuffer of this device into given ['path'] - /// Big help from source code (https://android.googlesource.com/platform/system/adb/+/refs/heads/main/framebuffer_service.cpp) + /// Big help from source code () pub fn framebuffer>(&mut self, path: P) -> Result<()> { let img = self.framebuffer_inner()?; Ok(img.save(path.as_ref())?) diff --git a/adb_client/src/server_device/commands/list.rs b/adb_client/src/server_device/commands/list.rs index c2fb130..2cb464a 100644 --- a/adb_client/src/server_device/commands/list.rs +++ b/adb_client/src/server_device/commands/list.rs @@ -9,7 +9,7 @@ use std::{ }; impl ADBServerDevice { - /// Lists files in [path] on the device. + /// Lists files in `path` on the device. pub fn list>(&mut self, path: A) -> Result<()> { let serial = self.identifier.clone(); self.connect()? diff --git a/adb_client/src/server_device/commands/recv.rs b/adb_client/src/server_device/commands/recv.rs index 84fb788..250f470 100644 --- a/adb_client/src/server_device/commands/recv.rs +++ b/adb_client/src/server_device/commands/recv.rs @@ -69,7 +69,7 @@ impl Read for ADBRecvCommandReader { } impl ADBServerDevice { - /// Receives [path] to [stream] from the device. + /// Receives `path` to `stream` from the device. pub fn pull>(&mut self, path: A, stream: &mut dyn Write) -> Result<()> { let serial = self.identifier.clone(); self.connect()? diff --git a/adb_client/src/server_device/commands/send.rs b/adb_client/src/server_device/commands/send.rs index 2b7eff7..ca536cc 100644 --- a/adb_client/src/server_device/commands/send.rs +++ b/adb_client/src/server_device/commands/send.rs @@ -42,7 +42,7 @@ impl Write for ADBSendCommandWriter { } impl ADBServerDevice { - /// Send [stream] to [path] on the device. + /// Send `stream` to `path` on the device. pub fn push>(&mut self, stream: R, path: A) -> Result<()> { log::info!("Sending data to {}", path.as_ref()); let serial = self.identifier.clone(); diff --git a/adb_client/src/server_device/commands/stat.rs b/adb_client/src/server_device/commands/stat.rs index 8cc76d4..0f3165d 100644 --- a/adb_client/src/server_device/commands/stat.rs +++ b/adb_client/src/server_device/commands/stat.rs @@ -41,7 +41,7 @@ impl ADBServerDevice { } } - /// Stat file given as [path] on the device. + /// Stat file given as `path` on the device. pub fn stat>(&mut self, path: A) -> Result { let serial = self.identifier.clone(); self.connect()?