Closed marcospb19 closed 1 year ago
I guess you can have your analogous version of Stream
around *mut bz3_state
, with a method like .as_ptr()
, and have this struct implement Send
and Sync
.
But maybe calling it Bz3State
instead of Stream
:thinking: .
:heavy_check_mark:
So far Bz3State
is just a bz3_state
wrapper. Later will add more associated methods on it, like bzip2 does. I will do some reading at bzip2-rs code...
I believe it should be safe to send (
Send
)bz3
encoder and decoders between different threads, as well as sharing immutable references (Sync
).For reference, here's the
bzip2
code:https://github.com/alexcrichton/bzip2-rs/blob/3032f3790742bffda521e54d14429f459e078eba/src/mem.rs#L13-L35
The type
Stream
implementsSend
andSync
so all decoders and encoders all auto-impl them too.This is currently a blocker for #1, adding these lines was enough for me to make it work :) .