From 7ffd5233548b841b770b05a915ac6d103334c64f Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 15 May 2013 19:08:50 -0700 Subject: [PATCH] core: Update clone docs --- src/libcore/clone.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/libcore/clone.rs b/src/libcore/clone.rs index 2650b96c4083c..2965b31a8c390 100644 --- a/src/libcore/clone.rs +++ b/src/libcore/clone.rs @@ -25,8 +25,9 @@ by convention implementing the `Clone` trait and calling the use core::kinds::Const; pub trait Clone { - /// Return a deep copy of the owned object tree. Types with shared ownership like managed boxes - /// are cloned with a shallow copy. + /// Returns a copy of the value. The contents of owned pointers + /// are copied to maintain uniqueness, while the contents of + /// managed pointers are not copied. fn clone(&self) -> Self; } @@ -85,8 +86,9 @@ clone_impl!(bool) clone_impl!(char) pub trait DeepClone { - /// Return a deep copy of the object tree. Types with shared ownership are also copied via a - /// deep copy, unlike `Clone`. + /// Return a deep copy of the value. Unlike `Clone`, the contents of shared pointer types + /// *are* copied. Note that this is currently unimplemented for managed boxes, as + /// it would need to handle cycles, but it is implemented for other smart-pointer types. fn deep_clone(&self) -> Self; }