Open guilload opened 7 months ago
Can you provide some motivation for this change
@morrisonlevi provided some context in his original PR: #978.
My use case is similar. I recently wrote a few custom Message
implementations for types with some fields for which I can obtain a &str
or &[u8]
for free but not a String
or Vec<u8>
without allocating.
@caspermeijn, is there any chance you can look into this PR?
This PR adds the ability to encode
&str
and&[u8]
usingstring::encode
andbytes::encode
. This is useful for users writing customMessage
implementations who want to avoid unnecessary allocations.