pub struct ADBCmd { /* private fields */ }Expand description
ADBCmd allows you to execute adb commands asynchronously.
Implementations§
source§impl ADBCmd
impl ADBCmd
pub fn new(cmd: String, is_shell: bool) -> Self
pub fn create_cmd(self) -> Command
sourcepub async fn run_async<F>(&self, args: Vec<String>, fnc: F)
pub 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;sourcepub async fn run(&self, args: Vec<String>) -> Result<String, String>
pub async fn run(&self, args: Vec<String>) -> Result<String, String>
use std::process::Command;
use ADB::cmd::ADBCmd;
let adb_cmd = ADBCmd::new();
let result = adb_cmd.run(vec!["devices".to_string()]);sourcepub async fn get_var_arg(self, args: Vec<String>) -> bool
pub 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);
Trait Implementations§
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