Fix derive sharedmessage namespace

This commit is contained in:
Andrey Tkachenko 2021-09-22 16:50:30 +04:00
parent 6ef65cbfd1
commit 79a4441bfd
2 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "messagebus_derive"
version = "0.2.0"
version = "0.2.1"
authors = ["Andrey Tkachenko <andrey@aidev.ru>"]
repository = "https://github.com/andreytkachenko/messagebus.git"
keywords = ["futures", "async", "tokio", "message", "bus"]

View File

@ -14,14 +14,14 @@ fn shared_part(_ast: &syn::DeriveInput, has_shared: bool) -> proc_macro2::TokenS
quote! {
fn as_shared_ref(&self) -> std::option::Option<&dyn messagebus::SharedMessage> {Some(self)}
fn as_shared_mut(&mut self) -> std::option::Option<&mut dyn messagebus::SharedMessage>{Some(self)}
fn as_shared_boxed(self: Box<Self>) -> Result<Box<dyn SharedMessage>, Box<dyn Message>> {Ok(self)}
fn as_shared_boxed(self: Box<Self>) -> Result<Box<dyn messagebus::SharedMessage>, Box<dyn Message>> {Ok(self)}
fn as_shared_arc(self: std::sync::Arc<Self>) -> Option<std::sync::Arc<dyn messagebus::SharedMessage>>{Some(self)}
}
} else {
quote! {
fn as_shared_ref(&self) -> std::option::Option<&dyn messagebus::SharedMessage> {None}
fn as_shared_mut(&mut self) -> std::option::Option<&mut dyn messagebus::SharedMessage> {None}
fn as_shared_boxed(self: Box<Self>) -> Result<Box<dyn SharedMessage>, Box<dyn Message>> {Err(self)}
fn as_shared_boxed(self: Box<Self>) -> Result<Box<dyn messagebus::SharedMessage>, Box<dyn Message>> {Err(self)}
fn as_shared_arc(self: std::sync::Arc<Self>) -> Option<std::sync::Arc<dyn messagebus::SharedMessage>> {None}
}
}