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 Set Algebra iterators to trait Set: Intersection, Difference, Sym. Diff, Union. #8154

Closed
bluss opened this issue Jul 31, 2013 · 2 comments
Labels
A-collections Area: std::collections.

Comments

@bluss
Copy link
Member

bluss commented Jul 31, 2013

These methods exist (or used to exist) in the Set trait, and should be reintroduced when we can express methods returning iterators in a trait.

/* These are the old methods */
/// Visit the values representing the difference
fn difference(&self, other: &Self, f: &fn(&T) -> bool) -> bool;

/// Visit the values representing the symmetric difference
fn symmetric_difference(&self, other: &Self, f: &fn(&T) -> bool) -> bool;

/// Visit the values representing the intersection
fn intersection(&self, other: &Self, f: &fn(&T) -> bool) -> bool;

/// Visit the values representing the union
fn union(&self, other: &Self, f: &fn(&T) -> bool) -> bool;

Bonus points for: Allow operations across two sets with matching element types but generic Set impl.

@pnkfelix
Copy link
Member

pnkfelix commented Sep 9, 2013

Just to keep bugs appropriately linked: one hypothetical solution for expressing trait methods that return iterators is to make the iterator's type an associated type of the trait. A la #5033.

@steveklabnik
Copy link
Member

We no longer have a Set trait, and so I'm giving this a close.

flip1995 pushed a commit to flip1995/rust that referenced this issue Jan 13, 2022
Consider auto-deref when linting `manual_swap`

fixes rust-lang#8154

changelog: Don't lint `manual_swap` when a field access involves auto-deref
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-collections Area: std::collections.
Projects
None yet
Development

No branches or pull requests

3 participants