Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a String trait to avoid duplicating ~str, @str, &static/str operations #4526

Closed
catamorphism opened this issue Jan 18, 2013 · 3 comments
Closed
Labels
A-traits Area: Trait system C-cleanup Category: PRs that clean code up or issues documenting cleanup.

Comments

@catamorphism
Copy link
Contributor

I'm going to naively suggest this because it seems like a better idea than making a copy of the whole str library for things that return @str. Now people can tell me why that's a bad idea :-)

@bstrie
Copy link
Contributor

bstrie commented Mar 12, 2013

Can you be more specific about what you have in mind? Is this just an empty String trait to be used as a typeclass for generic string functions, or is there more to it?

@bstrie
Copy link
Contributor

bstrie commented May 28, 2013

This should probably wait until the DST proposal #6308 is implemented.

@huonw
Copy link
Member

huonw commented Jun 13, 2013

Most functions in std::str are either methods on &str or functions taking &str, and there is now a Str trait that provides .as_slice() to do an explicit coercion of a generic string to &str (if it is ever necessary), so this can probably be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-traits Area: Trait system C-cleanup Category: PRs that clean code up or issues documenting cleanup.
Projects
None yet
Development

No branches or pull requests

4 participants