-
Notifications
You must be signed in to change notification settings - Fork 39
Closed
Labels
Description
Contact Details
No response
Propose-a-new-feature
Store bytes in memory rather than hex string.
axon/protocol/src/types/primitive.rs
Line 74 in fd220ad
| pub struct Hex(String); |
PROS:
-
Half memory cost.
-
No error handling.
Converting hex string to bytes require error handling; conversely, are not.
axon/protocol/src/types/primitive.rs
Lines 120 to 122 in fd220ad
pub fn as_bytes(&self) -> Bytes { Bytes::from(hex_decode(&self.0[2..]).expect("impossible, already checked in from_string")) } -
Slice has a higher usage rate.
-
If using
bytes::Bytesas inner type (rather thanVec<u8>):- Cloning
bytes::Bytesis very cheap.
- Cloning
Alternatives you've considered
No response
Anything else?
No response
Reactions are currently unavailable