1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use simctl::Device;

use super::{IOSContext, IOSError};
use crate::core::{Manager, Task};

/// This tasks boots an iOS Simulator with the given identifier.
pub struct BootIOSSimulator {
    /// This is the iOS Simulator that will be booted.
    pub device: Device,
}

impl Task for BootIOSSimulator {
    type Context = IOSContext;
    type Error = IOSError;

    fn verb(&self) -> &str {
        "Booting"
    }

    fn message(&self) -> &str {
        "iOS Simulator"
    }

    fn detail(&self) -> &str {
        &self.device.name
    }

    fn run(
        &self,
        context: Self::Context,
        _manager: &mut Manager,
    ) -> Result<Self::Context, Self::Error> {
        let _ = self.device.boot();

        Ok(context)
    }
}