pub struct AutoLaunchBuilder {
pub app_name: Option<String>,
pub app_path: Option<String>,
pub macos_launch_mode: MacOSLaunchMode,
pub bundle_identifiers: Option<Vec<String>>,
pub agent_extra_config: Option<String>,
pub windows_enable_mode: WindowsEnableMode,
pub linux_launch_mode: LinuxLaunchMode,
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::*;
let auto = AutoLaunchBuilder::new()
.set_app_name("the-app")
.set_app_path("/path/to/the-app")
.set_macos_launch_mode(MacOSLaunchMode::LaunchAgent)
.set_args(&["--minimized"])
.build()?;
auto.enable()?;
auto.is_enabled()?;
auto.disable()?;
auto.is_enabled()?;Fields§
§app_name: Option<String>§app_path: Option<String>§macos_launch_mode: MacOSLaunchMode§bundle_identifiers: Option<Vec<String>>§agent_extra_config: Option<String>§windows_enable_mode: WindowsEnableMode§linux_launch_mode: LinuxLaunchMode§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_macos_launch_mode(&mut self, mode: MacOSLaunchMode) -> &mut Self
pub fn set_macos_launch_mode(&mut self, mode: MacOSLaunchMode) -> &mut Self
Set the MacOSLaunchMode.
This setting only works on macOS
Sourcepub fn set_use_launch_agent(&mut self, use_launch_agent: bool) -> &mut Self
👎Deprecated since 0.6.0: Use set_macos_launch_mode instead
pub fn set_use_launch_agent(&mut self, use_launch_agent: bool) -> &mut Self
set_macos_launch_mode insteadSet the use_launch_agent (deprecated: use set_macos_launch_mode instead)
This setting only works on macOS
Sourcepub fn set_bundle_identifiers(
&mut self,
bundle_identifiers: &[impl AsRef<str>],
) -> &mut Self
pub fn set_bundle_identifiers( &mut self, bundle_identifiers: &[impl AsRef<str>], ) -> &mut Self
Set the bundle_identifiers
This setting only works on macOS
Sourcepub fn set_agent_extra_config(&mut self, config: &str) -> &mut Self
pub fn set_agent_extra_config(&mut self, config: &str) -> &mut Self
Set the agent_extra_config
This setting only works on macOS
Sourcepub fn set_windows_enable_mode(&mut self, mode: WindowsEnableMode) -> &mut Self
pub fn set_windows_enable_mode(&mut self, mode: WindowsEnableMode) -> &mut Self
Set the WindowsEnableMode.
This setting only works on Windows
Sourcepub fn set_linux_launch_mode(&mut self, mode: LinuxLaunchMode) -> &mut Self
pub fn set_linux_launch_mode(&mut self, mode: LinuxLaunchMode) -> &mut Self
Set the LinuxLaunchMode.
This setting only works on Linux
Sourcepub fn build(&self) -> Result<AutoLaunch>
pub fn build(&self) -> Result<AutoLaunch>
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