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

Create Str and Subsequence automata from bytes #169

Open
jfolz opened this issue Jul 25, 2024 · 1 comment · May be fixed by #170
Open

Create Str and Subsequence automata from bytes #169

jfolz opened this issue Jul 25, 2024 · 1 comment · May be fixed by #170

Comments

@jfolz
Copy link

jfolz commented Jul 25, 2024

I was wondering if there is any particular reason why Str and Subsequence automata can only be created from strings. The other parts of the API that I've looked at so far all take arbitrary byte sequences. I'm still quite new to Rust, but changing Str::new and Subsequence::new to take an AsRef<[u8]> seems to work fine.

@BurntSushi
Copy link
Owner

I think it's just an oversight. I'd be willing to accept a PR that adds impl From<&'a [u8]> for {Str,Subsequence}. I realize that we could just modify new to accept an AsRef<[u8]>, but this is susceptible to inference failures.

jfolz added a commit to jfolz/fst that referenced this issue Jul 25, 2024
@jfolz jfolz linked a pull request Jul 25, 2024 that will close this issue
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