Skip to content

Make all file writes generic #290

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

Merged
merged 5 commits into from
Apr 20, 2024
Merged

Make all file writes generic #290

merged 5 commits into from
Apr 20, 2024

Conversation

Serial-ATA
Copy link
Owner

@Serial-ATA Serial-ATA commented Nov 11, 2023

This adds two new traits, Truncate and Length, which are two operations we needed
that required the use of File.

With these two traits, combined with std::io::Read, std::io::Write and std::io::Seek, other types can now be treated as files.

It is now possible to write to a Cursor<Vec<u8>>.

TODO: changelog entry

@milesegan
Copy link

Are you interested in any help getting this one over the finish line? It would be great to be able to use lofty in wasm/web.

@Serial-ATA
Copy link
Owner Author

Are you interested in any help getting this one over the finish line?

Aside from me having to rebase this since its months old, it actually works just fine. I originally kept this as a draft due to the insane number of repetitive where clauses I had to add just to get it working.

I was hoping to find some kind of hack to clean this up, but in the end the only way is just waiting for Implied Bounds to land (so probably 6 years from now 🫤).

I haven't really looked at this in awhile, but since there's a handful of reactions on it I'll go ahead and merge it in as-is. I'll just need a day or two to bring the branch up to date.

@milesegan
Copy link

Thanks! I'm happy to help out with any grunt work if that's useful.

Thanks again for all your great work on lofty!

@Serial-ATA Serial-ATA added this to the 0.19.0 milestone Apr 20, 2024
@Serial-ATA
Copy link
Owner Author

Dealing with all those merge conflicts was painful, I won't let PRs sit like this anymore 😄.

This'll be out in 0.19, still a few things I need to do before release.

@Serial-ATA Serial-ATA merged commit d19e1dc into main Apr 20, 2024
@Serial-ATA Serial-ATA deleted the generic-writes branch April 20, 2024 16:46
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 this pull request may close these issues.

2 participants