CosmicHorrorDev / vdf-rs

VDF parsing and (de)serialization for Rust
Apache License 2.0
31 stars 3 forks source link

Support "zero-copy deserialization" #24

Closed CosmicHorrorDev closed 2 years ago

CosmicHorrorDev commented 3 years ago

Now the complex structure the parser uses means that it's probably cheating to still consider it zero-copy, but I think this would be possible if the parser didn't store keys and strings as Cows. The Cows are used to handle the escaped characters that could be included in the vdf text, so I think it would be best to look at what other parsers that support zero-copy deserializers do in this case.

CosmicHorrorDev commented 2 years ago

Since the parser stores strings as Cows things can be borrowed when there aren't escaped characters, it just takes some annotations and storing the value as a Cow as well