intrepid-model 0.2.0

Manage complex async business logic with ease
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use super::Event;

/// A trait for types that can be converted into an event. Any given type that
/// implements this trait can be published as an event.
pub trait IntoEvent: Clone {
    /// Consume the type, producing an [`Event`]
    fn into_event(self) -> Event;
}

impl<T> IntoEvent for T
where
    T: Into<Event> + Clone,
{
    fn into_event(self) -> Event {
        self.clone().into()
    }
}