As of title i am struggling to understand this difference. Aren't them byte arrays?
Do you mean Bytes from the bytes crate? To quote the docs:
Bytesis an efficient container for storing and operating on contiguous slices of memory. It is intended for use primarily in networking code, but could have applications elsewhere as well.
Bytesvalues facilitate zero-copy network programming by allowing multipleBytesobjects to point to the same underlying memory. This is managed by using a reference count to track when the memory is no longer needed and can be freed.
On the other hand&[u8] is not an owned value, but rather borrowed.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.