-
Notifications
You must be signed in to change notification settings - Fork 64
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
Implement AsRef
and AsMut
for str
, [T]
and some other unsized types
#29
Conversation
Hi @cuviper ! Could you pls have a look at the PR? |
I see what you mean about
So a few more candidates for |
Oh, now I see you already improved the "clumsy" tests. I was thinking about the problem since you posted the PR, but hadn't checked to see that you updated it. That definitely looks nicer. Now I guess it's just a question of what unsized types we really want. @bluss, any opinions? In case you missed it, in #28 we found that going fully |
Omg, I've completely forgotten about other unsized types! xD |
Macros can ease the copy-paste aspect of this, at least. |
Added a couple of macros and implemented the traits in question for |
AsRef
and AsMut
for str
and [T]
AsRef
and AsMut
for str
, [T]
and some other unsized types
I'd love to do the ?Sized change, that's an oversight, but it's hard to see if it's possible to do. Generic is better than specific here. Only PR comment is to update it so that it compiles with --no-default-features. Also an oversight that travis doesn't test that. |
Will do later today, thanks for the hint! |
Done! Btw is it ok that I'm overwriting the same commit again and again? I can split the commits using my reflog if anybody finds it useful.. |
f8f8360
to
e14c347
Compare
Just as a side question, why to maintain compatibility with rust-1.12?... |
It's an open question in the Rust community. Some consider it fine to only support the latest-stable rustc, and some think increasing the rustc requirement should be a breaking change. This crate has chosen the more conservative position to maintain compatibility. |
... yet another point to roll out 2.0 :)) So, it there anything else to amend in the PR? |
Sorry for neglecting this. I've just merged and published it as either 1.5.1. |
No problem, there was no hurry or anything :) Thanks! |
As discussed in #28
I've also made tests to make sure that we are getting what we really want to. On the other hand the functionality and implementation is so simple and straightforward, while the tests are a little bit clumsy (especially for
AsMut<str>
), so I'm hesitating on whether or not we should keep them.