pub trait Service:
Send
+ Sized
+ 'static {
type Stream: Stream<Item = Envelope<Self>> + Unpin + Send;
// Provided methods
fn start_by_context(
self,
ctx: Context<Self, Self::Stream>,
) -> (ServiceAddress<Self>, impl Future<Output = ()> + Send) { ... }
fn started<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 mut Context<Self, Self::Stream>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn stopped<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 mut Context<Self, Self::Stream>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
A service is an running like thread
Required Associated Types§
Provided Methods§
Sourcefn start_by_context(
self,
ctx: Context<Self, Self::Stream>,
) -> (ServiceAddress<Self>, impl Future<Output = ()> + Send)
fn start_by_context( self, ctx: Context<Self, Self::Stream>, ) -> (ServiceAddress<Self>, impl Future<Output = ()> + Send)
Start a service with the given context
Returns the address and a future that should be spawned to run the service. The caller is responsible for spawning the returned future using their async runtime.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.