pub struct ServiceManagerHandle<R: Runtime> { /* private fields */ }Expand description
Handle to the service manager actor. Stored as Tauri managed state.
Tauri commands send messages through the internal channel; the actor task processes them sequentially, preventing concurrent start/stop interleaving.
Implementations§
Source§impl<R: Runtime> ServiceManagerHandle<R>
impl<R: Runtime> ServiceManagerHandle<R>
Sourcepub fn new(cmd_tx: Sender<ManagerCommand<R>>) -> Self
pub fn new(cmd_tx: Sender<ManagerCommand<R>>) -> Self
Create a new handle backed by the given channel sender.
Sourcepub async fn start(
&self,
app: AppHandle<R>,
config: StartConfig,
) -> Result<(), ServiceError>
pub async fn start( &self, app: AppHandle<R>, config: StartConfig, ) -> Result<(), ServiceError>
Start a background service.
Sends a Start command to the actor. Returns AlreadyRunning if a
service is already active.
Sourcepub async fn stop(&self) -> Result<(), ServiceError>
pub async fn stop(&self) -> Result<(), ServiceError>
Stop the running background service.
Sends a Stop command to the actor. Returns NotRunning if no
service is active.
Sourcepub fn stop_blocking(&self) -> Result<(), ServiceError>
pub fn stop_blocking(&self) -> Result<(), ServiceError>
Stop the running background service synchronously.
Uses blocking_send so this can be called from synchronous contexts
(e.g., a Tauri on_event closure). Returns NotRunning if no
service is active.
Sourcepub async fn is_running(&self) -> bool
pub async fn is_running(&self) -> bool
Check whether a background service is currently running.
Sourcepub async fn get_state(&self) -> ServiceStatus
pub async fn get_state(&self) -> ServiceStatus
Get the current service lifecycle status.
Auto Trait Implementations§
impl<R> Freeze for ServiceManagerHandle<R>
impl<R> RefUnwindSafe for ServiceManagerHandle<R>
impl<R> Send for ServiceManagerHandle<R>
impl<R> Sync for ServiceManagerHandle<R>
impl<R> Unpin for ServiceManagerHandle<R>
impl<R> UnsafeUnpin for ServiceManagerHandle<R>
impl<R> UnwindSafe for ServiceManagerHandle<R>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more