pub struct ADBCmd { /* private fields */ }
Expand description
ADBCmd allows you to execute adb commands asynchronously.
Trait Implementations§
source§impl ADBCmdTrait for ADBCmd
impl ADBCmdTrait for ADBCmd
source§async fn run_async<F>(&self, args: Vec<String>, fnc: F)
async fn run_async<F>(&self, args: Vec<String>, fnc: F)
use std::process::Command;
use ADB::cmd::ADBCmd;
let adb_cmd = ADBCmd::new();
#[tokio::main]
adb_cmd.run_async(vec!["devices".to_string()], |line| {
println!("{}", line);
line
}).await;
source§fn run(&self, args: Vec<String>) -> Result<String, String>
fn run(&self, args: Vec<String>) -> Result<String, String>
run runs the given adb command synchronously.
use std::process::Command;
use ADB::cmd::ADBCmd;
let adb_cmd = ADBCmd::new("cmd".to_string(),false);
let result = adb_cmd.run(vec!["devices".to_string()]);
source§async fn get_var_arg(self, args: Vec<String>) -> bool
async fn get_var_arg(self, args: Vec<String>) -> bool
Get variable on command
let mut arg=String::from("mmi");
let exec_args=vec![];
let args= vec![
"ls".to_string(),
"/system/bin/sxrmmi".to_string()
]
let _prefix= ADBCmd::new("adb",false).get_var_arg(args);
if _prefix.is_ok(){
arg = format!("{}{}","sxr".to_string(),arg);
}else{
arg = format!("{}{}","ssnwt".to_string(),arg);
}
exec_args.push(arg);
exec_args.push("stop".to_string());
let res= ADBCmd::new("adb",false).run(exec_args);
source§fn get_file_path(path: &str) -> Result<String, String>
fn get_file_path(path: &str) -> Result<String, String>
获取文件路径
let res= ADBCmd::new("adb",false).get_file_path("./resources/file.xml");
fn new(cmd: String, is_shell: bool) -> Self
fn create_cmd(self) -> Command
Auto Trait Implementations§
impl Freeze for ADBCmd
impl RefUnwindSafe for ADBCmd
impl Send for ADBCmd
impl Sync for ADBCmd
impl Unpin for ADBCmd
impl UnwindSafe for ADBCmd
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more