Module rust_examples::rc [−][src]
Expand description
This module presents various kinds of pointers and their behaviour under Clone.
The example covered in tests demonstrates the comparison between
- Shared references that can be simply cloned (shallow copied)
- Box pointer to heap data that, because they are owned, delegate cloning to the owned instance (i.e. are potentially deep copied)
- Rc smart pointer which implements Clone by imcrementing reference counter and returning a cheap copy of itself with the same data reference (i.e. shallow copy at the cost of an additional counter)
