implement Clone for slices

This commit is contained in:
Daniel Micay 2013-06-23 22:16:19 -04:00
parent 60ed659620
commit 8779be39e1

View File

@ -56,6 +56,18 @@ impl<'self, T> Clone for &'self T {
fn clone(&self) -> &'self T { *self }
}
impl<'self, T> Clone for &'self [T] {
/// Return a shallow copy of the slice.
#[inline]
fn clone(&self) -> &'self [T] { *self }
}
impl<'self> Clone for &'self str {
/// Return a shallow copy of the slice.
#[inline]
fn clone(&self) -> &'self str { *self }
}
macro_rules! clone_impl(
($t:ty) => {
impl Clone for $t {