2021-08-10 14:23:33 +04:00
|
|
|
use messagebus::{
|
|
|
|
derive::{Error as MbError, Message},
|
2021-09-03 18:46:56 +04:00
|
|
|
error, Message, TypeTagged,
|
2021-08-10 14:23:33 +04:00
|
|
|
};
|
|
|
|
use thiserror::Error;
|
|
|
|
|
|
|
|
#[derive(Debug, Error, MbError)]
|
|
|
|
enum Error {
|
|
|
|
#[error("Error({0})")]
|
|
|
|
Error(anyhow::Error),
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<M: Message> From<error::Error<M>> for Error {
|
|
|
|
fn from(err: error::Error<M>) -> Self {
|
|
|
|
Self::Error(err.into())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Message)]
|
2021-08-12 13:16:30 +04:00
|
|
|
#[namespace("api")]
|
|
|
|
pub struct Msg<F>(pub F);
|
2021-08-10 14:23:33 +04:00
|
|
|
|
|
|
|
#[derive(Debug, Clone, Message)]
|
|
|
|
#[type_tag("api::Query")]
|
2021-09-15 13:33:25 +04:00
|
|
|
pub struct Qqq<F, G, H>(pub F, pub G, pub H);
|
2021-08-10 14:23:33 +04:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
assert_eq!(
|
|
|
|
Qqq::<Msg<i32>, Msg<()>, u64>::type_tag_(),
|
|
|
|
"api::Query<api::Msg<i32>,api::Msg<()>,u64>"
|
|
|
|
);
|
|
|
|
}
|