use std::{any::Any, fmt::Debug};
pub use crate::base::states::{
compound_state::CompoundState, real_vector_state::RealVectorState, se2_state::SE2State,
se3_state::SE3State, so2_state::SO2State, so3_state::SO3State,
};
pub trait DynClone {
fn clone_box(&self) -> Box<dyn State>;
}
impl<T> DynClone for T
where
T: State + Clone + 'static,
{
fn clone_box(&self) -> Box<dyn State> {
Box::new(self.clone())
}
}
pub trait State: DynClone + Debug + Any + Send + Sync + 'static {
fn as_any(&self) -> &dyn Any;
}
impl Clone for Box<dyn State> {
fn clone(&self) -> Self {
self.clone_box()
}
}