-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Support for Bytes
from bytes
crate
#45
Comments
Very happy to accept this behind a feature flag. |
Awesome to hear! So, I looked into it a bit. Looks like it is not quite as simple as I had thought, for one simple reason: the DiffableStr trait returns references to the structure that it is implemented on. That makes sense for pub trait DiffableStr: Hash + PartialEq + PartialOrd + Ord + Eq + ToOwned {
fn tokenize_lines(&self) -> Vec<&Self>;
.... I think to make this work, there's two options:
Either of these would be breaking changes (changing a public trait). Do you think getting this working is important enough to warrant making a breaking change to the API? |
I think changing the traits is fine. I think the odds that someone implements them is not very high. I just worry that you might run into limitations actually introducing a different output type in practice because you will need GATs and similar supports rust versions that don't have them yet. Potentially there is a way to make this work by going through a layer of indirection like implementing it for For what it's worth I already ran into similar issues before which is why there is |
Hey all,
Awesome crate! I'm using this in diff.rs to diff crates in the browser.
I'm using the
Bytes
crate to keep crate files in memory because it lets me keep stuff around in a reference-counted way and it also lets me create views into that. I have to use a bit of an ugly hack right now to make this work withsimilar
because you guys currently only support byte slices&[u8]
, but I want to turn these back intoBytes
structs.Looking at the code, it should be fairly simple to add native support for
Bytes
into the crate by implementing theDiffableStr
trait forBytes
, perhaps as a feature flag.Is this something you guys would be interested in? If so, I might implement it and create a merge request.
Cheers,
Patrick!
The text was updated successfully, but these errors were encountered: