pub struct AutoLaunchBuilder {
    pub app_name: Option<String>,
    pub app_path: Option<String>,
    pub use_launch_agent: bool,
    pub args: Option<Vec<String>>,
}
Expand description

AutoLaunch Builder helps to eliminate the constructor difference on various platforms.

Notes

The builder will not check whether the app_path matches the platform-specify file path.

Usage

use auto_launch::*;

fn main() {
    let auto = AutoLaunchBuilder::new()
        .set_app_name("the-app")
        .set_app_path("/path/to/the-app")
        .set_use_launch_agent(true)
        .set_args(&["--minimized"])
        .build()
        .unwrap();

    auto.enable().is_ok();
    auto.is_enabled().unwrap();

    auto.disable().is_ok();
    auto.is_enabled().unwrap();
}

Fields

app_name: Option<String>app_path: Option<String>use_launch_agent: boolargs: Option<Vec<String>>

Implementations

Set the app_name

Set the app_path

Set the use_launch_agent This setting only works on macOS

Set the args

Construct a AutoLaunch instance

Errors
  • app_name is none
  • app_path is none
Panics
  • Unsupported target OS

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.