Struct Device

Source
pub struct Device {
    pub host: Host,
    pub serial: DeviceSerial,
    pub run_as_package: Option<String>,
    pub storage: AndroidStorage,
    pub tempfile: UnixPathBuf,
}
Expand description

Represents an ADB device.

Fields§

§host: Host

ADB host that controls this device.

§serial: DeviceSerial

Serial number uniquely identifying this ADB device.

§run_as_package: Option<String>§storage: AndroidStorage§tempfile: UnixPathBuf

Cache intermediate tempfile name used in pushing via run_as.

Implementations§

Source§

impl Device

Source

pub async fn new( host: Host, serial: DeviceSerial, storage: AndroidStorageInput, ) -> Result<Device>

Source

pub async fn clear_app_data(&self, package: &str) -> Result<bool>

Source

pub async fn create_dir(&self, path: &UnixPath) -> Result<()>

Source

pub async fn chmod( &self, path: &UnixPath, mask: &str, recursive: bool, ) -> Result<()>

Source

pub async fn execute_host_command( &self, command: &str, has_output: bool, has_length: bool, ) -> Result<Vec<u8>>

Source

pub async fn execute_host_command_to_string( &self, command: &str, has_output: bool, has_length: bool, ) -> Result<String>

Source

pub fn enable_run_as_for_path(&self, path: &UnixPath) -> bool

Source

pub async fn execute_host_shell_command( &self, shell_command: &str, ) -> Result<String>

Source

pub async fn execute_host_exec_out_command( &self, shell_command: &str, ) -> Result<Vec<u8>>

Source

pub async fn execute_host_shell_command_as( &self, shell_command: &str, enable_run_as: bool, ) -> Result<String>

Source

pub async fn is_app_installed(&self, package: &str) -> Result<bool>

Source

pub async fn launch<T: AsRef<str>>( &self, package: &str, activity: &str, am_start_args: &[T], ) -> Result<bool>

Source

pub async fn force_stop(&self, package: &str) -> Result<()>

Source

pub async fn forward_port(&self, local: u16, remote: u16) -> Result<u16>

Source

pub async fn kill_forward_port(&self, local: u16) -> Result<()>

Source

pub async fn kill_forward_all_ports(&self) -> Result<()>

Source

pub async fn reverse_port(&self, remote: u16, local: u16) -> Result<u16>

Source

pub async fn kill_reverse_port(&self, remote: u16) -> Result<()>

Source

pub async fn kill_reverse_all_ports(&self) -> Result<()>

Source

pub async fn list_dir(&self, src: &UnixPath) -> Result<Vec<RemoteDirEntry>>

Source

pub async fn path_exists( &self, path: &UnixPath, enable_run_as: bool, ) -> Result<bool>

Source

pub async fn pull<W: AsyncWrite + Unpin>( &self, src: &UnixPath, buffer: &mut W, ) -> Result<()>

Source

pub async fn pull_dir(&self, src: &UnixPath, dest_dir: &Path) -> Result<()>

Source

pub async fn push<R: AsyncRead + Unpin>( &self, buffer: &mut R, dest: &UnixPath, mode: u32, ) -> Result<()>

Source

pub async fn push_dir( &self, source: &Path, dest_dir: &UnixPath, mode: u32, ) -> Result<()>

Source

pub async fn remove(&self, path: &UnixPath) -> Result<()>

Trait Implementations§

Source§

impl Clone for Device

Source§

fn clone(&self) -> Device

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Device

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Device

§

impl RefUnwindSafe for Device

§

impl Send for Device

§

impl Sync for Device

§

impl Unpin for Device

§

impl UnwindSafe for Device

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.