Serial-ATA / lofty-rs

Audio metadata library
Apache License 2.0
182 stars 34 forks source link

Make all file writes generic #290

Closed Serial-ATA closed 2 months ago

Serial-ATA commented 8 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 2 months ago

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

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