]> git.lizzy.rs Git - rust.git/commit
Add ToOwned::clone_into (unstable as toowned_clone_into)
authorScott McMurray <scottmcm@users.noreply.github.com>
Sun, 2 Apr 2017 02:33:45 +0000 (19:33 -0700)
committerScott McMurray <scottmcm@users.noreply.github.com>
Thu, 13 Apr 2017 00:21:15 +0000 (17:21 -0700)
commit7ec27ae63d762234ad768fb605bd40bbbc52c7a0
tree932053cae56ba36ac896ffdfdf6a38e01b83f5b9
parent44855a4cef3e83c76c386fdcf034447a8ee128e4
Add ToOwned::clone_into (unstable as toowned_clone_into)

to_owned generalizes clone; this generalizes clone_from.  Use to_owned to
give it a default impl.  Customize the impl for [T], str, and T:Clone.

Use it in Cow::clone_from to reuse resources when cloning Owned into Owned.
src/doc/unstable-book/src/SUMMARY.md
src/doc/unstable-book/src/toowned-clone-into.md [new file with mode: 0644]
src/libcollections/borrow.rs
src/libcollections/slice.rs
src/libcollections/str.rs
src/libcollections/tests/cow_str.rs
src/libcollections/vec.rs