use async_trait::async_trait;
use futures_core::Stream;
use futures_util::stream::Empty;
use crate::{runtime::Runtime, Context, Envelope, Metadata};
pub type EmptyStream<S> = Empty<Envelope<S>>;
#[async_trait]
pub trait RuntimedService: Send + Sized + 'static {
type Stream: Stream<Item = Envelope<Self>> + Unpin + Send;
type Error: Send;
type Runtime: Runtime;
fn metadata(&self) -> Metadata<'_>;
async fn started(&mut self, _ctx: &mut Context<Self>) -> Result<(), Self::Error> {
Ok(())
}
async fn stopped(&mut self, _ctx: &mut Context<Self>) -> Result<(), Self::Error> {
Ok(())
}
}