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

No shared conversions for other string-like types (Path, OsStr, CStr) #45008

Closed
parkovski opened this issue Oct 3, 2017 · 2 comments
Closed
Labels
C-feature-accepted Category: A feature request that has been accepted pending implementation. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@parkovski
Copy link

Conversions for Rc<str>, Arc<str>, Rc<[T]>, and Arc<[T]> were added in #42565, but it is still not possible to make a shared container for other string-like types - you still need to use double allocated containers like Rc<PathBuf>. It looks like the only types this is missing for are Path, OsStr, and CStr.

@TimNN TimNN added C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Oct 3, 2017
@dtolnay dtolnay added C-feature-accepted Category: A feature request that has been accepted pending implementation. and removed C-feature-request Category: A feature request, i.e: not implemented / a PR. labels Nov 14, 2017
@dtolnay
Copy link
Member

dtolnay commented Nov 14, 2017

Seems reasonable. @murarth or @clarcharr would you be interested in figuring out an API for this?

@murarth
Copy link
Contributor

murarth commented Nov 14, 2017

I believe impls of From<CStr> for Rc<CStr>, etc. should work just fine. I'll have a PR ready shortly.

kennytm added a commit to kennytm/rust that referenced this issue Nov 25, 2017
Implement `Rc`/`Arc` conversions for string-like types

Provides the following conversion implementations:

* `From<`{`CString`,`&CStr`}`>` for {`Arc`,`Rc`}`<CStr>`
* `From<`{`OsString`,`&OsStr`}`>` for {`Arc`,`Rc`}`<OsStr>`
* `From<`{`PathBuf`,`&Path`}`>` for {`Arc`,`Rc`}`<Path>`

Closes rust-lang#45008
bors added a commit that referenced this issue Nov 26, 2017
Implement `Rc`/`Arc` conversions for string-like types

Provides the following conversion implementations:

* `From<`{`CString`,`&CStr`}`>` for {`Arc`,`Rc`}`<CStr>`
* `From<`{`OsString`,`&OsStr`}`>` for {`Arc`,`Rc`}`<OsStr>`
* `From<`{`PathBuf`,`&Path`}`>` for {`Arc`,`Rc`}`<Path>`

Closes #45008
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-accepted Category: A feature request that has been accepted pending implementation. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants