pub struct Launchd { /* private fields */ }
Expand description
Representation of a launchd.plist file. The definition of which can be found here.
Usage:
use launchd::{Launchd, Error, CalendarInterval};
use std::path::Path;
fn example() -> Result<Launchd, Error> {
Ok(Launchd::new("LABEL", Path::new("./foo/bar.txt"))?
.with_user_name("Henk")
.with_program_arguments(vec!["Hello".to_string(), "World!".to_string()])
.with_start_calendar_intervals(vec![CalendarInterval::default().with_hour(12)?])
.disabled()
// etc...
)
}
let launchd = example();
This will create a launchd representation with the label “LABEL”, running “./foo/bar.txt” with the args “Hello” and “World!”, for the user “Henk”, each day at 12.
NB: The usage is still subject to change.
Implementations§
source§impl Launchd
impl Launchd
pub fn new<S: AsRef<str>, P: AsRef<Path>>( label: S, program: P ) -> Result<Self, Error>
pub fn with_label<S: AsRef<str>>(self, label: S) -> Self
pub fn with_disabled(self, disabled: bool) -> Self
pub fn disabled(self) -> Self
pub fn with_user_name<S: AsRef<str>>(self, user_name: S) -> Self
pub fn with_group_name<S: AsRef<str>>(self, group_name: S) -> Self
pub fn with_program<P: AsRef<Path>>(self, program: P) -> Result<Self, Error>
pub fn with_bundle_program<S: AsRef<str>>(self, bundle: S) -> Self
pub fn with_program_arguments(self, program_arguments: Vec<String>) -> Self
pub fn with_run_at_load(self, run_at_load: bool) -> Self
pub fn run_at_load(self) -> Self
pub fn with_queue_directories(self, queue_directories: Vec<String>) -> Self
pub fn with_watch_paths(self, watch_paths: Vec<String>) -> Self
pub fn with_start_on_mount(self, start_on_mount: bool) -> Self
pub fn start_on_mount(self) -> Self
pub fn with_start_interval(self, start_interval: u32) -> Self
pub fn with_start_calendar_intervals( self, start_calendar_intervals: Vec<CalendarInterval> ) -> Self
pub fn with_abandon_process_group(self, value: bool) -> Self
pub fn abandon_process_group(self) -> Self
pub fn with_debug(self, value: bool) -> Self
pub fn debug(self) -> Self
pub fn with_enable_globbing(self, value: bool) -> Self
pub fn enable_globbing(self) -> Self
pub fn with_enable_transactions(self, value: bool) -> Self
pub fn enable_transactions(self) -> Self
pub fn with_enable_pressured_exit(self, value: bool) -> Self
pub fn enable_pressured_exit(self) -> Self
pub fn with_environment_variables(self, env: HashMap<String, String>) -> Self
pub fn with_exit_timeout(self, timeout: u32) -> Self
pub fn with_init_groups(self, value: bool) -> Self
pub fn init_groups(self) -> Self
pub fn with_launch_only_once(self, value: bool) -> Self
pub fn launch_only_once(self) -> Self
pub fn with_limit_load_from_hosts(self, value: Vec<String>) -> Self
pub fn with_limit_to_from_hosts(self, value: Vec<String>) -> Self
pub fn with_limit_load_to_session_type(self, value: LoadSessionType) -> Self
pub fn with_limit_load_to_hardware( self, value: HashMap<String, Vec<String>> ) -> Self
pub fn with_limit_load_from_hardware( self, value: HashMap<String, Vec<String>> ) -> Self
pub fn with_low_priority_io(self, value: bool) -> Self
pub fn low_priority_io(self) -> Self
pub fn with_low_priority_background_io(self, value: bool) -> Self
pub fn low_priority_background_io(self) -> Self
pub fn with_mach_services( self, services: HashMap<String, MachServiceEntry> ) -> Self
pub fn with_nice(self, nice: i32) -> Self
pub fn with_root_directory<P: AsRef<Path>>(self, path: P) -> Result<Self, Error>
pub fn with_standard_error_path<P: AsRef<Path>>( self, path: P ) -> Result<Self, Error>
pub fn with_standard_in_path<P: AsRef<Path>>( self, path: P ) -> Result<Self, Error>
pub fn with_standard_out_path<P: AsRef<Path>>( self, path: P ) -> Result<Self, Error>
pub fn with_throttle_interval(self, value: u32) -> Self
pub fn with_timeout(self, timeout: u32) -> Self
pub fn with_umask(self, umask: u16) -> Self
pub fn with_wait_for_debugger(self, value: bool) -> Self
pub fn wait_for_debugger(self) -> Self
pub fn with_materialize_dataless_files(self, value: bool) -> Self
pub fn materialize_dataless_files(self) -> Self
pub fn with_working_directory<P: AsRef<Path>>( self, path: P ) -> Result<Self, Error>
pub fn with_inetd_compatibility(self, wait: bool) -> Self
pub fn with_keep_alive(self, keep_alive: KeepAliveType) -> Self
pub fn with_process_type(self, process_type: ProcessType) -> Self
pub fn with_hard_resource_limits(self, limits: ResourceLimits) -> Self
pub fn with_soft_resource_limits(self, limits: ResourceLimits) -> Self
pub fn with_socket(self, socket: Sockets) -> Self
pub fn with_launch_events( self, value: HashMap<String, HashMap<String, HashMap<String, Value>>> ) -> Self
pub fn with_session_create(self, value: bool) -> Self
pub fn session_create(self) -> Self
source§impl Launchd
impl Launchd
pub fn to_writer_xml<W: Write>(&self, writer: W) -> Result<(), Error>
pub fn to_file_xml<P: AsRef<Path>>(&self, file: P) -> Result<(), Error>
pub fn to_writer_binary<W: Write>(&self, writer: W) -> Result<(), Error>
pub fn to_file_binary<P: AsRef<Path>>(&self, file: P) -> Result<(), Error>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, Error>
pub fn from_file<P: AsRef<Path>>(file: P) -> Result<Self, Error>
pub fn from_reader<R: Read + Seek>(reader: R) -> Result<Self, Error>
pub fn from_reader_xml<R: Read + Seek>(reader: R) -> Result<Self, Error>
Trait Implementations§
source§impl<'de> Deserialize<'de> for Launchd
impl<'de> Deserialize<'de> for Launchd
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq<Launchd> for Launchd
impl PartialEq<Launchd> for Launchd
impl StructuralPartialEq for Launchd
Auto Trait Implementations§
impl RefUnwindSafe for Launchd
impl Send for Launchd
impl Sync for Launchd
impl Unpin for Launchd
impl UnwindSafe for Launchd
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