pub struct DomainRuntime<C> { /* private fields */ }Expand description
A start/stop controller around a shared core C.
C is the domain core the loop operates on; it is held as an Arc<C> so the controller
can hand it to the spawned loop and to core callers.
Implementations§
Source§impl<C> DomainRuntime<C>
impl<C> DomainRuntime<C>
Sourcepub async fn start<F>(&self, mk: F) -> Result<bool, AlreadyRunning>
pub async fn start<F>(&self, mk: F) -> Result<bool, AlreadyRunning>
Start the background loop.
mk is called with a fresh CancellationToken and must spawn the domain loop,
returning its JoinHandle. On success the controller marks itself running and
stores the token; a watcher task flips running back to false when the loop’s
handle completes. Returns Ok(false) (a no-op) if already running.
Sourcepub async fn stop(&self) -> bool
pub async fn stop(&self) -> bool
Stop the background loop by cancelling its token.
Returns true if a token was present (i.e. the loop was running), false otherwise.
Marks running = false immediately without waiting for the loop to wind down.
Sourcepub async fn status(&self) -> RuntimeStatus
pub async fn status(&self) -> RuntimeStatus
Current running state.
Trait Implementations§
Auto Trait Implementations§
impl<C> !RefUnwindSafe for DomainRuntime<C>
impl<C> !UnwindSafe for DomainRuntime<C>
impl<C> Freeze for DomainRuntime<C>
impl<C> Send for DomainRuntime<C>
impl<C> Sync for DomainRuntime<C>
impl<C> Unpin for DomainRuntime<C>
impl<C> UnsafeUnpin for DomainRuntime<C>
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