mitinarseny / toner

🦀 + 💎 Rust SDK for TON blockchain
https://docs.rs/toner
MIT License
9 stars 2 forks source link

BinTree deserialization #1

Closed akostylev0 closed 5 months ago

akostylev0 commented 5 months ago

Hi there!

Great library, by the way, I really enjoyed working with it. I’ve added support for deserializing BinTree into a recursive structure (according to the TL-B scheme) as well as into a Vector. It seems that the Vector is the more usable option, while the recursive structure serves more as a demonstration. Please take a look, and I’d appreciate any feedback or comments.

akostylev0 commented 5 months ago

And about HashmapE, I think we should extract the n parameter as a generic const. This will allow us to implement CellDeserializeAs on it. I believe we can do this because there is no usage of n as a dynamically sized value according to the block.tlb scheme.

mitinarseny commented 5 months ago

Hey @akostylev0,

Thank you for your work! The idea with deserialization into Vec seems interesting.

I've just merged #2 that also introduces CellSerializeAsWithArgs and CellDeserializeAsWithArgs and allows passing parameters dynamically in runtime, while having all other traits usable with this approach as well. You can check out its usage here

It also introduces BinTree with only naive recursive (de)serialization implementation for now. I'd appreciate if you can adapt your code, so it would be compatible with new traits. Thanks again!

mitinarseny commented 5 months ago

Great work, thank you! ❤️