pub struct ServiceThread<S: Service> {
pub join_handle: ServiceJoinHandle,
pub mailbox: Mailbox<S>,
}
Expand description
Run a service inside a dedicated thread using a mpsc::channel to send/receive messages
Fields§
§join_handle: ServiceJoinHandle
§mailbox: Mailbox<S>
Implementations§
Source§impl<S: Service + Send + 'static> ServiceThread<S>
impl<S: Service + Send + 'static> ServiceThread<S>
pub fn spawn_with(service: S) -> Self
pub fn mbox(&self) -> Mailbox<S>
Source§impl<S: Service + 'static> ServiceThread<S>
impl<S: Service + 'static> ServiceThread<S>
pub fn spawn_with_init_fn<F: FnOnce() -> S + Send + 'static>(init_fn: F) -> Self
Trait Implementations§
Source§impl<S: Service + 'static> From<ServiceThread<S>> for ShutdownHandle
impl<S: Service + 'static> From<ServiceThread<S>> for ShutdownHandle
Source§fn from(service: ServiceThread<S>) -> Self
fn from(service: ServiceThread<S>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<S> Freeze for ServiceThread<S>
impl<S> RefUnwindSafe for ServiceThread<S>
impl<S> Send for ServiceThread<S>
impl<S> !Sync for ServiceThread<S>
impl<S> Unpin for ServiceThread<S>
impl<S> UnwindSafe for ServiceThread<S>
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