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

Implementation of Clone, Debug and documentation for structures #88

Merged
merged 4 commits into from
Feb 20, 2019

Conversation

Mingun
Copy link
Contributor

@Mingun Mingun commented Jan 2, 2019

Resolves two cases from #19. I add only trivial implementations -- for example, for Drain implementing of Debug not trivial, so I do not add it

Mingun added 2 commits January 2, 2019 18:58
Clone for: Keys, Values, Iter
Debug for: Keys, Values, Iter, Entry
Docs  for: Keys, Values, Iter, Entry, ValuesMut, IterMut, IntoIter, Drain

All copied from HashMap
Clone for: Iter, Difference, Intersection, SymmetricDifference, Union
Debug for: Iter, Difference, Intersection, SymmetricDifference, Union
Docs  for: Iter, Difference, Intersection, SymmetricDifference, Union, IntoIter, Drain

All copied from HashSet
@cuviper
Copy link
Member

cuviper commented Jan 18, 2019

These all look good to me, thanks!

AFAICS this doesn't affect the minimum supported rustc though, so let's make it 1.0.3 instead of bumping to 1.1. The policy documented in src/lib.rs is to keep consistent for any given 1.x series.

@bluss
Copy link
Member

bluss commented Jan 18, 2019

I don't mind bumping to 1.1 while keeping the same minimum Rust version. Since these are new features, 1.1 seems more correct.

@Mingun
Copy link
Contributor Author

Mingun commented Jan 18, 2019

The policy documented in src/lib.rs is to keep consistent for any given 1.x series.

I tried to study attentively documentation on policy of bumping version and I did not find its any accurate mentioning. The quote from src/lib.rs very general therefore I tried to adhere to semver:

  • major changes at incompatible changes
  • minor changes when adding new functionality
  • patch changes at a bugfix and changes which are not changing behavior

As from the point of view of the library user I should depend on major.minor version, but not on major.minor.patch version (otherwise I lose automatic receiving bugfixes), I changed minor version. Thus, depending on version 1.1 I will be able accurately to tell that in the project I need functionality, that this PR implements. If I changed patch, then the project depending on 1.0 (which it should depend) and using new opportunities from 1.0.3 could break if the real version would be 1.0.0-1.0.2.

@cuviper
Copy link
Member

cuviper commented Jan 18, 2019

OK, I don't feel strongly about the version, if you're both happy with 1.1.

@Mingun
Copy link
Contributor Author

Mingun commented Jan 27, 2019

ping

@cuviper
Copy link
Member

cuviper commented Feb 20, 2019

I added Debug for IntoIter using vec::IntoIter::as_slice() to access the items. I think we could also do Drain and IterMut if vec::Drain and slice::IterMut exposed slices, which I'll propose in std. For now, this seems good enough.

Thanks!

@cuviper cuviper merged commit d8e5225 into indexmap-rs:master Feb 20, 2019
@Mingun Mingun deleted the clone+debug branch February 20, 2019 20:15
cuviper added a commit to cuviper/rust that referenced this pull request Mar 4, 2019
In indexmap-rs/indexmap#88, we found that there was no easy way to implement
`Debug` for our `IterMut` and `Drain` iterators. Those are built on
`slice::IterMut` and `vec::Drain`, which implement `Debug` themselves,
but have no other way to access their data. With a new `as_slice()`
method, we can read the data and customize its presentation.
Centril added a commit to Centril/rust that referenced this pull request Mar 9, 2019
Add as_slice() to slice::IterMut and vec::Drain

In indexmap-rs/indexmap#88, we found that there was no easy way to implement
`Debug` for our `IterMut` and `Drain` iterators. Those are built on
`slice::IterMut` and `vec::Drain`, which implement `Debug` themselves,
but have no other way to access their data. With a new `as_slice()`
method, we can read the data and customize its presentation.
Centril added a commit to Centril/rust that referenced this pull request Mar 9, 2019
Add as_slice() to slice::IterMut and vec::Drain

In indexmap-rs/indexmap#88, we found that there was no easy way to implement
`Debug` for our `IterMut` and `Drain` iterators. Those are built on
`slice::IterMut` and `vec::Drain`, which implement `Debug` themselves,
but have no other way to access their data. With a new `as_slice()`
method, we can read the data and customize its presentation.
Centril added a commit to Centril/rust that referenced this pull request Mar 9, 2019
Add as_slice() to slice::IterMut and vec::Drain

In indexmap-rs/indexmap#88, we found that there was no easy way to implement
`Debug` for our `IterMut` and `Drain` iterators. Those are built on
`slice::IterMut` and `vec::Drain`, which implement `Debug` themselves,
but have no other way to access their data. With a new `as_slice()`
method, we can read the data and customize its presentation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants