SDK/Rust/Encoding/BinWriter : Add to_bytes method to BinWriter trait for convenient serialization
What
Adds a default to_bytes implementation to the BinWriter trait.
Why
Many types implementing BinWriter require serialization to raw bytes. Adding a reusable to_bytes method simplifies this process and eliminates boilerplate in consuming code.
How
- Introduced a default
to_bytesmethod to theBinWritertrait.- It internally calls
bin_writeon a newVec<u8>and returns the result.
- It internally calls
- This change is backward-compatible and does not impact existing implementations.
Edited by Brahima Dibassi