pub struct Daemon { /* private fields */ }Expand description
In-memory daemon instance. The fields are Arc<Mutex<…>>
so each accept-loop iteration can hand a handler task a
clone without colouring everything Clone.
Implementations§
Source§impl Daemon
impl Daemon
Sourcepub fn new(
cfg: Config,
probe: Arc<dyn EngineProbe>,
) -> Result<Self, DaemonError>
pub fn new( cfg: Config, probe: Arc<dyn EngineProbe>, ) -> Result<Self, DaemonError>
Build a daemon without spawning it. The caller picks an
EngineProbe — production passes HttpEngineProbe,
tests pass AlwaysReachable / AlwaysUnreachable.
Sourcepub fn spawn(self) -> Result<Shutdown, DaemonError>
pub fn spawn(self) -> Result<Shutdown, DaemonError>
Spawn the listener on a Tokio task. Returns a
Shutdown handle; dropping it does not kill the
daemon — call Shutdown::shutdown / .join()
explicitly.
Sourcepub async fn run(self) -> Result<(), DaemonError>
pub async fn run(self) -> Result<(), DaemonError>
Convenience wrapper used by the binary: spawn + await the accept loop + SIGTERM in one call.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Daemon
impl !UnwindSafe for Daemon
impl Forget for Daemon
impl Freeze for Daemon
impl Move for Daemon
impl Send for Daemon
impl Sync for Daemon
impl Unpin for Daemon
impl UnsafeUnpin for Daemon
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