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

Character iterator comparison #42

Open
timothee-haudebourg opened this issue Mar 16, 2020 · 1 comment
Open

Character iterator comparison #42

timothee-haudebourg opened this issue Mar 16, 2020 · 1 comment

Comments

@timothee-haudebourg
Copy link

i need to compare (without regard for the case) two strings that are not UTF-8 encoded. The only access I have to the individual chars is through an iterator.

Would it be possible for this crate to expose a comparison interface between two char iterators? Something like:

/// Check the equality of two character iterators.
fn stream_eq<A: Iterator<Item=char>, B: Iterator<Item=char>>(a: A, b: B) -> bool;

/// Compare two character iterators.
fn stream_cmp<A: Iterator<Item=char>, B: Iterator<Item=char>>(a: A, b: B) -> cmp::Ordering;
@timothee-haudebourg
Copy link
Author

In addition, it would be nice to have a similar hashing function:

/// Compute the hash of a character iterator without regard for the case.
fn stream_hash<Chars: Iterator<Item=char>, H: Hasher>(chars: Chars, h: &mut H);

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

No branches or pull requests

1 participant