ruuda / claxon

A FLAC decoder in Rust
Apache License 2.0
285 stars 28 forks source link

Issues with privacy #7

Closed est31 closed 6 years ago

est31 commented 6 years ago

When I wanted to update audrey to claxon version 0.3, I saw that claxon::FlacSamples now depends on only one type, which is generic on a Trait. Now there are a few problems:

  1. in order for audrey to be able to store the samples struct, it needs to be generic with that type as well. But the type is private!
  2. the only type that impls the trait is BufferedReader, which is opaque, too.

So what about a facade instead? If there was a public facade/wrapper for FrameReader which is generic on the io::Read trait, my problems would be solved.

Maybe there are further issues that can occur, not sure but if you pushed an updated version to github I will try it out :).

ruuda commented 6 years ago

ReadBytes and BufferedReader are public on master, and there is also a ReadBytes implementation for io::Cursor<T: AsRef<[u8]>>. Is that sufficient to resolve your problem?

It is an implementation detail that should not have to be exposed in the first place, but I am not sure whether it can be avoided. impl Trait should help with FlacSamples, but the issue also applies to FrameReader.

est31 commented 6 years ago

@ruuda yes that helps really greatly! I was able to port to the master version of claxon :). So the issue is resolved. When do you plan to publish a new version of claxon to crates.io?

ruuda commented 6 years ago

I wanted to address some of the rough edges from the parts that enable decoding Flac embedded in other containers first, but I haven’t gotten around to that yet.

ruuda commented 6 years ago

Although if something is blocked on it, I could try to make a release as is this weekend.

est31 commented 6 years ago

@ruuda nothing is really blocked on it, but having a release would still be nice. audrey is having a release soon and it would be cool if we can update claxon as well. If no, we'll ship the update in a future release :).

ruuda commented 6 years ago

Claxon v0.4.0 is now available on crates.io.

est31 commented 6 years ago

@ruuda thank you!