-
Notifications
You must be signed in to change notification settings - Fork 20
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 Copy for StaticString #35
Comments
Well, keep in mind that What exactly is a use case for an implicit- |
IIRC, My use-case is a static string that is copied in several places at run-time and then modified with some suffixes. |
Is specialization working well enough in nightly to be tried? Edit: it's not, even without specialization, Drop is special if it has a trait bound the struct definition must have it too So this is either wont-fix or will need to copy the |
The compiler ppl is focusing on const evaluation, lazy normalization and I don't think specialization will be stabilized anytime soon (maybe not even after stable const generics). @paulocsanz É nóis que tá na quebrada, brother! |
@c410-f3r This crate is nightly only tho, so not being stabilized isn't really a deal breaker, it just need to work in a good enough way. kkkkk eai meu bom, sempre bom encontrar outro br pelas internetes |
One thing to note is that So calling
My point being that I don't quite see how You can already copy them really easily via several different functions. You just can't do it with the assignment operator. Which is fine I'd say. |
The biggest issue is that you can't impl copy for structs that contain StaticString. So you can't use it in impls that depend that trait bound. |
I suppose that's true, although I'm not sure how common that would be as a thing people would actually want to do (which is to say you can't do that with In any case, there's definitely zero chance I'm gonna duplicate the entire implementation of StaticVec just to have a |
I mean nobody cares because its impossible when dealing with heap allocations, its not a need but a improvement. Anyway I agree with you that duplicating it isn't the solution. |
I'm not sure that it's impossible for heap-based containers. From a purely technical perspective it would be the same as what happens when you call I don't really see any way that you could have In general though I'm still basically of the opinion that pretty much only plain-old-data structs should really ever be |
I wanted to avoid bumping this issue because although I disagree with you about the importance of
Also |
Thank you guys for this fruitful conversation. Looks like If desirable, someone is free to re-open it. |
Currently,
StaticString
doesn't implementCopy
because its implementation relies uponStaticVec
, which also doesn't implementCopy
. I suggest the creation of another "copyable" structure likeStaticVecCopy
(I don't know :P) with a macro or a trait to avoid internal code duplication.The text was updated successfully, but these errors were encountered: