Skip to content

Conversation

aturon
Copy link
Contributor

@aturon aturon commented Nov 20, 2014

This commit makes Cow more usable by allowing it to be applied to
unsized types (as was intended) and providing some basic ToOwned
implementations on slice types. It also corrects the documentation for
Cow to no longer mention DerefMut, and adds an example.

Closes #19123

This commit makes `Cow` more usable by allowing it to be applied to
unsized types (as was intended) and providing some basic `ToOwned`
implementations on slice types. It also corrects the documentation for
`Cow` to no longer mention `DerefMut`, and adds an example.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extraneous "both"

@bstrie
Copy link
Contributor

bstrie commented Nov 20, 2014

This is actually really cool, I didn't know we had this 🐄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should use into_string. to_string goes through the formatting infrastructure, and tends to over-allocate space in the heap. See this playpen example, and also see #16415.

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Nov 22, 2014
This commit makes `Cow` more usable by allowing it to be applied to
unsized types (as was intended) and providing some basic `ToOwned`
implementations on slice types. It also corrects the documentation for
`Cow` to no longer mention `DerefMut`, and adds an example.
bors added a commit that referenced this pull request Nov 23, 2014
This commit makes `Cow` more usable by allowing it to be applied to
unsized types (as was intended) and providing some basic `ToOwned`
implementations on slice types. It also corrects the documentation for
`Cow` to no longer mention `DerefMut`, and adds an example.

Closes #19123
@bors bors closed this Nov 23, 2014
lnicola pushed a commit to lnicola/rust that referenced this pull request Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The borrow module docs claim Cow implements DerefMut but it doesn't

5 participants