pub trait Service:
Sized
+ Send
+ 'static {
type Init: Clone + Send;
type Input: Send;
type Event: Send;
type Output: Clone + 'static + Send;
const DISABLE_EVENTS: bool = false;
const LOCAL: bool = false;
// Required method
fn new(
init: Self::Init,
input_sender: Sender<Self::Input>,
output_sender: Sender<Self::Output>,
) -> impl Future<Output = Self> + Send;
// Provided methods
fn handler(init: Self::Init) -> ServiceManager<Self> { ... }
fn message(
&mut self,
_input: Self::Input,
_output_sender: &Sender<Self::Output>,
) -> impl Future<Output = ()> + Send { ... }
fn event_generator(&mut self) -> impl Future<Output = Self::Event> + Send { ... }
fn event_handler(
&mut self,
_event: Self::Event,
_output_sender: &Sender<Self::Output>,
) -> impl Future<Output = Result<(), Error>> + Send { ... }
}Expand description
Trait that Azalea services must implement
Provided Associated Constants§
Required Associated Types§
type Init: Clone + Send
type Input: Send
type Event: Send
type Output: Clone + 'static + Send
Required Methods§
fn new( init: Self::Init, input_sender: Sender<Self::Input>, output_sender: Sender<Self::Output>, ) -> impl Future<Output = Self> + Send
Provided Methods§
fn handler(init: Self::Init) -> ServiceManager<Self>
fn message( &mut self, _input: Self::Input, _output_sender: &Sender<Self::Output>, ) -> impl Future<Output = ()> + Send
fn event_generator(&mut self) -> impl Future<Output = Self::Event> + Send
fn event_handler( &mut self, _event: Self::Event, _output_sender: &Sender<Self::Output>, ) -> impl Future<Output = Result<(), Error>> + Send
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.