X-Git-Url: https://git.chrismorgan.info/anymap/blobdiff_plain/18518214c4609e182be5277b14c7c510c8fa9505..fdba2f45b9b9d6fa05be6a4d0849add42d94516e:/src/with_clone.rs diff --git a/src/with_clone.rs b/src/with_clone.rs deleted file mode 100644 index 7bdb5b0..0000000 --- a/src/with_clone.rs +++ /dev/null @@ -1,37 +0,0 @@ -use std::fmt; - -#[doc(hidden)] -pub trait CloneToAny { - /// Clone `self` into a new `Box` object. - fn clone_to_any(&self) -> Box; -} - -impl CloneToAny for T { - fn clone_to_any(&self) -> Box { - Box::new(self.clone()) - } -} - -#[doc(hidden)] -/// Pretty much just `std::any::Any + Clone`. -pub trait Any: ::std::any::Any + CloneToAny { } - -impl Any for T { } - -impl Clone for Box { - fn clone(&self) -> Box { - (**self).clone_to_any() - } -} - -impl<'a> fmt::Debug for &'a Any { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("&Any") - } -} - -impl<'a> fmt::Debug for Box { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("Box") - } -}