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

Port "match" package #6

Open
bartlomieju opened this issue Jul 23, 2021 · 4 comments · May be fixed by #16
Open

Port "match" package #6

bartlomieju opened this issue Jul 23, 2021 · 4 comments · May be fixed by #16

Comments

@bartlomieju
Copy link
Owner

match is used when matching indexes and should be ported as a utility module matcher.rs (match is a keyword in Rust so it would require prefixing each occurrence with r#).

@tidwall
Copy link
Collaborator

tidwall commented Jul 23, 2021

Just a tip, but I rewrote the match function for C. It may be a better point of reference.

https://github.com/tidwall/match.c/blob/master/match.c#L19

It does not include all of the weird utf8 "rune" stuff, which is probably not needed with Rust anyhow because Rust Strings are inherently sane.

@bartlomieju
Copy link
Owner Author

Ah perfect! This should be very helpful.

@tidwall
Copy link
Collaborator

tidwall commented Jul 23, 2021

which is probably not needed with Rust anyhow because Rust Strings are inherently sane.

Unless you plan on implementing it to be used on raw bytes, then you will probably need some kind of utf8 character reader.

@bartlomieju bartlomieju linked a pull request Jul 24, 2021 that will close this issue
@bartlomieju
Copy link
Owner Author

So I ended up porting the C version, but it turns out Allowable() is still require in two function for iterating over keys. There's a bit of magic going on in there as well, but it should be doable.

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 a pull request may close this issue.

2 participants