Struct mozdevice::Device

source ·
pub struct Device {
    pub host: Host,
    pub serial: DeviceSerial,
    pub adbd_root: bool,
    pub is_rooted: bool,
    pub su_0_root: bool,
    pub su_c_root: bool,
    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.

§adbd_root: bool

adb running as root

§is_rooted: bool

Flag for rooted device

§su_0_root: bool

“su 0” command available

§su_c_root: bool

“su -c” command available

§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 fn new( host: Host, serial: DeviceSerial, storage: AndroidStorageInput ) -> Result<Device>

source

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

source

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

source

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

source

pub fn execute_host_command( &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 fn execute_host_shell_command(&self, shell_command: &str) -> Result<String>

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

pub fn pull(&self, src: &UnixPath, buffer: &mut dyn Write) -> Result<()>

source

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

source

pub fn push( &self, buffer: &mut dyn Read, dest: &UnixPath, mode: u32 ) -> Result<()>

source

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

source

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

Trait Implementations§

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§

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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.