Open junglie85 opened 1 year ago
The writer event call would send the event in a backend tokio task asynchronously other than from the main task. &[u8] can't guarantee the event won't be changed in the main task.
How does that differ from the byte api which does take a slice? https://github.com/pravega/pravega-client-rust/blob/8ea1ecb594e60a79aff52edfabb41c1ea5aa51cb/src/byte/writer.rs#L158
the slice would acutually be cloned into vec right away.
It'd be helpful (cognitively) for the interfaces to be the same. I don't mind whether it's a slice or a vec that is passed in, but I think consistency is good.
I'd normally try to pass a slice because it's more flexible. However, where low latency is key, I can also envisage scenarios where a custom allocator might be preferred instead of the global allocator in the owning vec (when the allocator API is stable). In the latter case, passing in a vec might be more expressive of the ownership situation.
Could the API be re-written to support both options to give greatest flexibility?
Problem description Writing events requires a
Vec<u8>
.Suggestions for an improvement Make writing events requires
&[u8]
like the byte API.