Skip to content

Implementing Into #30

New issue

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

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

Already on GitHub? # to your account

Closed
dtolnay opened this issue Apr 25, 2017 · 2 comments
Closed

Implementing Into #30

dtolnay opened this issue Apr 25, 2017 · 2 comments

Comments

@dtolnay
Copy link
Member

dtolnay commented Apr 25, 2017

Is there ever a case where Into should be implemented instead of From?

@dtolnay
Copy link
Member Author

dtolnay commented Apr 26, 2017

I found these in the standard library:

impl Into<Box<Path>> for PathBuf;
impl Into<Box<CStr>> for CString;
impl Into<Box<OsStr>> for OsString;

Is there some rule that makes it not possible to write these using From? Any other tradeoffs?

@dtolnay
Copy link
Member Author

dtolnay commented Apr 26, 2017

From rust-lang/rust#40009:

Currently, the opposite direction isn't doable with From (only Into) because of the separation between liballoc and libcollections. I'm holding off on those for a later PR.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants