Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upPick over the standard libraries for types that don't (but can) implement common traits #15294
Comments
huonw
added
E-easy
labels
Jul 1, 2014
aturon
added
the
A-libs
label
Jul 1, 2014
This comment has been minimized.
This comment has been minimized.
|
cc me |
This comment has been minimized.
This comment has been minimized.
|
Also things like |
This comment has been minimized.
This comment has been minimized.
|
I’m imagining a tool which produces a massive table where each column is a trait and each row is a struct or enum, with each cell shaded appropriately for whether there is an implementation (under any constraints) of the trait for the type. |
huonw
referenced this issue
Jul 10, 2014
Merged
std: Add some implementation of common traits #15564
japaric
referenced this issue
Jul 10, 2014
Merged
Derive Clone for Command and StdioContainer #15566
bors
added a commit
that referenced
this issue
Jul 10, 2014
bors
added a commit
that referenced
this issue
Jul 13, 2014
nham
referenced this issue
Jul 22, 2014
Merged
Implement Hash/PartialEq/Eq for TrieMap and TrieSet #15902
bors
added a commit
that referenced
this issue
Jul 23, 2014
bors
added a commit
that referenced
this issue
Jul 23, 2014
nham
referenced this issue
Jul 24, 2014
Closed
Implement some missing traits for SmallIntMap and TrieMap/TrieSet. #15963
bors
added a commit
that referenced
this issue
Jul 25, 2014
bors
added a commit
that referenced
this issue
Jul 25, 2014
bors
added a commit
that referenced
this issue
Jul 26, 2014
bors
added a commit
that referenced
this issue
Jul 27, 2014
bors
added a commit
that referenced
this issue
Jul 27, 2014
nham
referenced this issue
Jul 28, 2014
Merged
Implement PartialOrd for TrieMap, TrieSet, SmallIntMap, Bitv, and BitvSet #16038
bors
added a commit
that referenced
this issue
Jul 29, 2014
nham
added a commit
to nham/rust
that referenced
this issue
Jul 29, 2014
This was referenced Jul 31, 2014
This comment has been minimized.
This comment has been minimized.
|
For items in
|
bors
added a commit
that referenced
this issue
Aug 2, 2014
aturon
referenced this issue
Sep 26, 2014
Closed
Iterators in the std library should implement Eq where possible #12593
This comment has been minimized.
This comment has been minimized.
|
I'm not entirely sold on the usefulness of a semi-polished, but slightly manual, and still non-lossy middle ground between full-on serialization and debugging. Do we know of what examples we have today would fall in this category? I believe there are also some competing concerns with
I personally would tend to err on the side of saying "to_string is lossy" and "Show should be implementing on all primitives", but I also can't shake the feeling that there's likely a better middle ground. |
This comment has been minimized.
This comment has been minimized.
I don’t understand how serialization is applicable here. How can I use |
This comment has been minimized.
This comment has been minimized.
|
I would imagine that if you know that your type can be perfectly encoded as a string then you invoke |
This comment has been minimized.
This comment has been minimized.
|
It would also be useful to have a "debugging" serialization (e.g. used in |
This comment has been minimized.
This comment has been minimized.
|
We have BTreeMap and BTreeSet impling all the common things. So I think this issue in now just "do #17534". Can be closed? |
This comment has been minimized.
This comment has been minimized.
|
What about |
This comment has been minimized.
This comment has been minimized.
|
What's it missing? Ord/PartialOrd? |
This comment has been minimized.
This comment has been minimized.
|
Ok. EnumSet is Ord+PartialOrd now. Anything else? |
This comment has been minimized.
This comment has been minimized.
|
I think this is all and this can be closed. |
This comment has been minimized.
This comment has been minimized.
|
Almost no iterators ( |
This comment has been minimized.
This comment has been minimized.
|
Iterators like |
This comment has been minimized.
This comment has been minimized.
|
It would be completely unsound for Can you provide some concrete usecases? |
This comment has been minimized.
This comment has been minimized.
|
It's not possible to provide |
This comment has been minimized.
This comment has been minimized.
|
@thestinger I was only suggesting adding |
This comment has been minimized.
This comment has been minimized.
|
No, double-ended doesn't imply the ability to move the iterator in the reverse direction. A vector iterator has a pointer to either end of the remaining range and would need 4 pointers if it could be expanded again via |
This comment has been minimized.
This comment has been minimized.
|
Move-iterators are safe to clone, e.g. (I'm sure it would be difficult to write clone implementations for some move-iterators, but the common ones probably aren't so bad.) |
This comment has been minimized.
This comment has been minimized.
|
@thestinger Ah, I mistakenly assumed the Vec iterator had a reference to the source slice. |
alexcrichton
referenced this issue
Oct 1, 2014
Closed
Add the `formatter_len_hint` method to Show and use it in `to_string` #16544
This comment has been minimized.
This comment has been minimized.
|
Note: I've created a discuss topic to address the questions around |
japaric
referenced this issue
Dec 14, 2014
Merged
libcore: make iterator adaptors `Clone`able #19827
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Dec 17, 2014
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Dec 17, 2014
japaric
added a commit
to japaric/rust
that referenced
this issue
Jan 19, 2015
japaric
added a commit
to japaric/rust
that referenced
this issue
Jan 19, 2015
barosl
added a commit
to barosl/rust
that referenced
this issue
Jan 20, 2015
This comment has been minimized.
This comment has been minimized.
|
Given that this issue is vague, and it seems like all of the specific things mentioned here have been done, I'm giving this a close. If anyone knows of any other things that are missing, let's add them, but I don't find this ticket to be super actionable right now. |
huonw commentedJul 1, 2014
... and implement/derive them.
Traits like
Eq,Hash,Ord,Cloneare sometimes forgotten (or have been missed, in the various library changes that have happened), and this is annoying for downstream users. To paper over the deeper issue (how to make adding these impls more natural/harder to forget), impls for all the various traits can be added to types.List of types missing things just from a basic scan:
collections(only implement thePartialcomparison traits, and pretty much none of them implementHash)semver::Versionnumare missingHashurl::Path,url::UserInfouuid::UuidVariant,uuid::UuidVersion