rustler
rustler copied to clipboard
impl Sync for OwnedBinary?
I have the need to share owned binaries across threads via RwLock. My hunch is that it's safe to implement Sync for OwnedBinary, but I haven't looked at these guts in quite some time.
OwnedBinary
is effectively a mutable buffer without internal synchronisation, how could it be Sync
?
For the same reason Vec<u8>
is Sync
despite it being a mutable buffer without internal synchronization: ownership rules will prevent mutating the OwnedBinary
when it is shared.
True, I checked again, as to be expected it doesn't have any interior mutability (wasn't completely sure about the realloc).