Repository navigation
feat(core): Implement write and write_from for Writer - #4482
Conversation
|
Got this, thank you for your guidance, I will modify the api implementation and related uses in the codes later. |
|
This in itself is not very important, because it does not affect the implementation and API, but I have a little confuse about the use of Buffer and bytes::Bytes in the code. For example, Bytes is used to generate input in the bench and fuzz tests now. Is it necessary to reduce the direct usage of Bytes and replace it entirely with Buffer? Or we just focus on the API interface and the implementation underneath the API. The usage elsewhere in the code doesn't matter. |
I feel like we don't need to.
Yes, the point of Buffer is public API. |
| async fn test_writer() { | ||
| let op = new_test_operator(Capability::default()); | ||
| let res = op.write("path", vec![]).await; | ||
| let res = op.write("path", Vec::<u8>::new()).await; |
There was a problem hiding this comment.
Does this change required? I expect vec![] can work as is.
There was a problem hiding this comment.
This should be necessary because we have implemented conversion from Vec<u8> and Vec<Bytes> for Buffer. If we directly vec![], the compiler cannot determine which one it is and will report an error.
There was a problem hiding this comment.
How about changing the code here into following for better reading?
let bs: Vec<u8> = vec![];
let res = op.write("path", bs).await;
related to: #4465