pub struct Service<'a> { /* private fields */ }
Expand description
A service builder, providing control over what commands the service supports before the service begins to run.
Implementations§
Source§impl<'a> Service<'a>
impl<'a> Service<'a>
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new Service
object.
By default, the service does not accept any service commands other than start.
Sourcepub fn can_accept(&mut self, accept: u32) -> &mut Self
pub fn can_accept(&mut self, accept: u32) -> &mut Self
The service accepts other specified commands.
Sourcepub fn can_fallback<F: FnOnce(&Service<'_>) + Send + 'a>(
&mut self,
f: F,
) -> &mut Self
pub fn can_fallback<F: FnOnce(&Service<'_>) + Send + 'a>( &mut self, f: F, ) -> &mut Self
Runs the fallback closure if the service is not started by the Service Control Manager.
Sourcepub fn run<F: FnMut(&Service<'_>, Command) + Send + Sync + 'a>(
&mut self,
callback: F,
) -> Result<(), &'static str>
pub fn run<F: FnMut(&Service<'_>, Command) + Send + Sync + 'a>( &mut self, callback: F, ) -> Result<(), &'static str>
Runs the service with the given callback closure to receive commands sent by the service control manager.
This method will block for the life of the service. It will never return and immediately terminate the current process after indicating to the service control manager that the service has stopped.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !Freeze for Service<'a>
impl<'a> !RefUnwindSafe for Service<'a>
impl<'a> Unpin for Service<'a>
impl<'a> !UnwindSafe for Service<'a>
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