Is there a way to write this code with #[derive(Message)] and #[rtype(result = "...")].
pub struct MyMsg<T> {
data: T
}
impl<T: 'static> Message for MyMsg<T> {
type Result = Result<MyMsg<T>, Error>;
}
I tried this but the compiler complains about the required lifetime bounds.
#[derive(Message)]
#[rtype(result = "Result<MyMsg<T>, Error>")]
pub struct MyMsg<T> {
pub data: T,
}
I assume you use
anyhow, because otherwiseResult<..., Error>wouldn't make much sense. (asErroris a trait, not a type)Then, I don't understand your problem, it just works:
If you expand that with
cargo expand, you can see that you get: