pub mod builtin;
pub mod sensor_msgs;
pub mod std_msgs;
use serde::Serialize;
use std::convert::From;
#[macro_export]
macro_rules! ros_type_name {
($t:ty) => {{ std::any::type_name::<$t>().rsplit("::").next().unwrap() }};
}
pub trait RosMsgAdapter<'a>: Sized {
type Output: Serialize + for<'b> From<&'b Self>;
fn namespace() -> &'a str;
fn type_name() -> &'a str {
ros_type_name!(Self::Output)
}
fn type_hash() -> &'static str;
#[cfg(not(feature = "humble"))]
fn convert(&self) -> (Self::Output, &'static str) {
(self.into(), Self::type_hash())
}
#[cfg(feature = "humble")]
fn convert(&self) -> (Self::Output, &str) {
(self.into(), "TypeHashNotSupported")
}
}