separate impl_serdeany macro for std and not

This commit is contained in:
Andrea Fioraldi 2021-04-23 17:32:25 +02:00
parent fc8056214b
commit 15b7f0523c

View File

@ -496,6 +496,7 @@ macro_rules! create_serde_registry_for_trait {
create_serde_registry_for_trait!(serdeany_registry, crate::bolts::serdeany::SerdeAny);
pub use serdeany_registry::*;
#[cfg(feature = "std")]
#[macro_export]
macro_rules! impl_serdeany {
($struct_name:ident) => {
@ -517,3 +518,19 @@ macro_rules! impl_serdeany {
}
};
}
#[cfg(not(feature = "std"))]
#[macro_export]
macro_rules! impl_serdeany {
($struct_name:ident) => {
impl $crate::bolts::serdeany::SerdeAny for $struct_name {
fn as_any(&self) -> &dyn core::any::Any {
self
}
fn as_any_mut(&mut self) -> &mut dyn core::any::Any {
self
}
}
};
}