Have std::string::ToString for X automatically provide std::convert::From<X> for String
Nobody has claimed this yet.
- Dominant language
- Markdown
- Stars
- 6.6k
- Forks
- 1.7k
- Avg merge
- 16h 14m
- Merged PRs (30d)
- 1
Description
Is there a good reason the following can't be done?
impl<T> std::convert::From<T> for std::string::String where T: std::string::ToString {
fn from(t: T) -> Self {
t.to_string()
}
The only thing I can think of is if the value of T converted to String has a different meaning of the value of T.display() (as that's where a lot of the ToString implementations are coming from) such that you might want different behavior there.
Being able to do something like s: String = 42.into() anywhere would be nice.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files, tests, or entry points. Start by evaluating the proposed blanket From implementation and its API implications; done means reaching a documented decision on whether this conversion should be added.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 18/100