adb-utils 0.6.0

Rust implementation of commonly used ADB commands
Documentation
use std::process::Command;

use crate::{ADBCommand, ADBResult};

/// Pair with a device for secure TCP/IP communication
pub struct ADBPair {
    ip: String,
    port: u32,
    pin: u32,
    shell: Command,
}

impl ADBPair {
    pub fn new(ip: String, port: u32, pin: u32) -> Self {
        let mut cmd = Command::new("adb");
        cmd.arg("pair");
        ADBPair {
            ip,
            port,
            pin,
            shell: cmd,
        }
    }
}

impl ADBCommand for ADBPair {
    fn build(&mut self) -> Result<&mut Command, String> {
        self.shell
            .arg(format!("{}:{}", self.ip, self.port))
            .arg(self.pin.to_string());
        Ok(&mut self.shell)
    }

    fn process_output(&self, output: ADBResult) -> ADBResult {
        output
    }
}