Struct Device

Source
pub struct Device { /* private fields */ }
Expand description

Wrapper around a single device returned by simctl.

Implementations§

Source§

impl Device

Source

pub fn simctl(&self) -> &Simctl

Returns an instance to the Simctl wrapper that was used to retrieve this device.

Source

pub fn info(&self) -> &DeviceInfo

Returns information about this device. This is also accessible through Device::deref.

Source§

impl Device

Source

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

Boots this device. If the device is already booted, this function will return an error (as does the underlying CLI).

NOTE: this does not automatically open the visual simulator interface. Use crate::Simctl::open() to open the visual interface.

Source

pub fn boot_with_env<I, K, V>(&self, envs: I) -> Result<()>
where I: IntoIterator<Item = (K, V)>, K: Display, V: AsRef<OsStr>,

Boots this device with the given environment variables. Do not prepend SIMCTL_CHILD_ to the variable names: this is done automatically. If the device is already booted, this function will return an error (as does the underlying CLI).

NOTE: this does not automatically open the visual simulator interface. Use crate::Simctl::open() to open the visual interface.

Source§

impl Device

Source

pub fn get_app_container( &self, bundle_id: &str, container: &Container, ) -> Result<PathBuf>

Returns a path to the given container of an application with the given bundle id.

Source§

impl Device

Source

pub fn getenv(&self, name: &str) -> Result<String>

Returns a local environment variable with the given name. Do not prepend SIMCTL_CHILD_ to the variable name. If no variable with the given name exists, this function will return an empty string (and no error).

Source§

impl Device

Source

pub fn install(&self, path: &Path) -> Result<()>

Installs an .app folder from the given path onto this device. If the app (or an earlier version) already existed on this device, its app container (see Device::get_app_container) will be overwritten while the other containers remain unchanged (i.e. data persists between upgrades).

Source§

impl Device

Source

pub fn io(&self) -> IO

Returns a wrapper around the simctl io subcommand.

Source§

impl Device

Source

pub fn keychain(&self) -> Keychain

Returns an instance of the keychain subcommand.

Source§

impl Device

Source

pub fn launch<'a>(&self, bundle_id: &'a str) -> Launch<'a>

Returns a builder that can be used to customize the launch of an app with the given bundle ID on this device.

Source§

impl Device

Source

pub fn open_url(&self, path: &str) -> Result<()>

Opens the given URL on this device.

Source§

impl Device

Source

pub fn privacy(&self) -> Privacy

Returns a wrapper around the simctl privacy subcommand.

Source§

impl Device

Source

pub fn push(&self, bundle_id: &str, push: &Push) -> Result<()>

Sends the given push message to this device for an app with the given bundle ID.

Source§

impl Device

Source

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

Shuts down this device. Returns an error if it isn’t booted.

Source§

impl Device

Source

pub fn status_bar(&self) -> StatusBar

Returns a wrapper around the simctl status_bar subcommand.

Source§

impl Device

Source

pub fn terminate(&self, bundle_id: &str) -> Result<()>

Terminates a running application with the given bundle ID on this device.

Source§

impl Device

Source

pub fn ui(&self) -> UI

Returns a wrapper around the simctl ui subcommand.

Source§

impl Device

Source

pub fn uninstall(&self, bundle_id: &str) -> Result<()>

Uninstalls an app with the given bundle ID from this device.

Trait Implementations§

Source§

impl Clone for Device

Source§

fn clone(&self) -> Device

Returns a copy 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
Source§

impl Deref for Device

Source§

type Target = DeviceInfo

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.