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

Add 'im' feature for supporting the im crate collections #924

Merged
merged 1 commit into from
May 14, 2020
Merged

Conversation

cmyr
Copy link
Member

@cmyr cmyr commented May 13, 2020

This is an experiment; the idea is to encourage the use of these
types over std::collections.

There's currently an issue or two with im::Vector, so this includes
a poor implementation of Data there, for the time being.

docs/src/data.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@luleyleo luleyleo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm eager to give this a shot in my app 😄
I will need List<Vector<T>> support for it tho, but if I understood that correctly, @xStrom seems to be onto it.

Copy link
Member

@xStrom xStrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

And yeah @Finnerale I have List working in my dev branch. I'll clean it up and send a PR later tonight.

@cmyr
Copy link
Member Author

cmyr commented May 13, 2020

keep in mind that in this PR the impl of Data for Vector is slow, because there's an upstream issue; hope that is resolved soon.

}
*/

self.iter().zip(other.iter()).all(|(a, b)| a.same(b))
Copy link
Member

@xStrom xStrom May 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't correct after all, because it will stop comparing after the shorter iterator ends. So this will return true for [1, 2, 3] vs [1, 2, 3, 4].

The correct way would be to use eq_by but that's nightly only.

So something like the following is needed:

self.len() == other.len() && self.iter().zip(other.iter()).all(|(a, b)| a.same(b))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, good catch

This is an experiment; the idea is to encourage the use of these
types over std::collections.

There's currently an issue or two with im::Vector, so this includes
a poor implementation of `Data` there, for the time being.
@cmyr
Copy link
Member Author

cmyr commented May 14, 2020

okay, let's get this in and we can play around from here.

@cmyr cmyr merged commit 3332b17 into master May 14, 2020
@cmyr cmyr deleted the collections branch May 14, 2020 15:40
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.

None yet

3 participants