use mnesis::*;
#[derive(Debug, Clone)]
enum MyEvent { A }
impl Message for MyEvent {}
impl DomainEvent for MyEvent {
fn name(&self) -> &'static str { "A" }
}
#[derive(Default, Debug, Clone)]
struct MyState;
impl AggregateState for MyState {
type Event = MyEvent;
fn initial() -> Self { Self::default() }
fn apply(self, _: &MyEvent) -> Self { self }
}
#[derive(Debug)]
enum BadError {
Something,
}
#[derive(Debug)]
struct MyAggregate;
impl Aggregate for MyAggregate {
type State = MyState;
type Error = BadError; type Id = MyId;
}
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
struct MyId(String);
impl MyId {
fn new(v: u64) -> Self { Self(v.to_string()) }
}
impl std::fmt::Display for MyId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}", self.0) }
}
impl AsRef<[u8]> for MyId {
fn as_ref(&self) -> &[u8] { self.0.as_bytes() }
}
fn main() {}