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: bool
§args: Option<Vec<String>>
Implementations§
Source§impl AutoLaunchBuilder
impl AutoLaunchBuilder
pub fn new() -> AutoLaunchBuilder
Sourcepub fn set_app_name(&mut self, name: &str) -> &mut Self
pub fn set_app_name(&mut self, name: &str) -> &mut Self
Set the app_name
Sourcepub fn set_app_path(&mut self, path: &str) -> &mut Self
pub fn set_app_path(&mut self, path: &str) -> &mut Self
Set the app_path
Sourcepub fn set_use_launch_agent(&mut self, use_launch_agent: bool) -> &mut Self
pub fn set_use_launch_agent(&mut self, use_launch_agent: bool) -> &mut Self
Set the use_launch_agent
This setting only works on macOS
Trait Implementations§
Source§impl Clone for AutoLaunchBuilder
impl Clone for AutoLaunchBuilder
Source§fn clone(&self) -> AutoLaunchBuilder
fn clone(&self) -> AutoLaunchBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for AutoLaunchBuilder
impl Debug for AutoLaunchBuilder
Source§impl Default for AutoLaunchBuilder
impl Default for AutoLaunchBuilder
Source§fn default() -> AutoLaunchBuilder
fn default() -> AutoLaunchBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for AutoLaunchBuilder
impl RefUnwindSafe for AutoLaunchBuilder
impl Send for AutoLaunchBuilder
impl Sync for AutoLaunchBuilder
impl Unpin for AutoLaunchBuilder
impl UnwindSafe for AutoLaunchBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more