Skip to main content

ServiceMain

Type Alias ServiceMain 

Source
pub type ServiceMain<T> = dyn Fn(Receiver<T>, Vec<String>, Option<Vec<String>>) -> Result<T> + Sync + Send;
Expand description

Type signature of a service’s main function used by this library.

The three parameters are used as follows:

  • Receiver<T>: a std::sync::mpsc::Receiver<T> that is used to transmit service stop signals to the main function for handling.
  • Vec<String>: the operating system arguments passed to the binary at process load time. For a binary running as a Windows Service, these are the arguments passed to -BinaryPath
  • Option<Vec<String>>: the start parameters passed as part of Windows Service startup, if the binary is running as a Windows Service. This argument should be None if this is not running as a Windows Service