Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upCow::clone should do shallow copies? #34284
Comments
brson
added
rust-2-breakage-wishlist
A-libs
labels
Jun 15, 2016
brson
referenced this issue
Jun 15, 2016
Closed
collections: Add `shallow_copy` method to Cow which always reborrows data #33777
This comment has been minimized.
This comment has been minimized.
|
No, this is not possible impl<'a, T> Clone for Cow<'a, T> {
fn clone<'b>(&'b self) -> Cow<'a, T> { ... }
}The owned variant can only be borrowed for the scope |
This comment has been minimized.
This comment has been minimized.
|
Aha excellent point! |
alexcrichton
closed this
Jun 15, 2016
dtolnay
added
T-libs
and removed
rust-2-breakage-wishlist
labels
Feb 6, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
brson commentedJun 15, 2016
In a recent PR it was pointed out that cloning a Cow shouldn't ever need to allocate - the cloned Cow could borrow a pointer to the original.