Small Working Example of Rust's Stable Structures

We are currently working on simulating a directory structure, with directories, file metadata, and content inside of them.

We started working with Motoko Hashmaps, and we have done some progress but I would really like to avoid the pre-upgrade and post-upgrade calls.

Could anyone share some working code of Rust Stable Structures, it would help us understand them better. Thanks!

P.S. This is the link to the IC’s Stable Structures in Rust:

Do you mean other examples than those already provided in the stable-structures repo?

https://github.com/dfinity/stable-structures#more-examples

https://github.com/dfinity/stable-structures/tree/main/examples/src

Indeed David, those examples are just a template, and a very small example.

Not a real small app of any kind, like for a example a TODO app or a small recipe app, something that actually would benefit from the stable data structures and has now the advantage of not needing the pre-upgrade and post-upgrade calls for data persistence.

In that case you for example, maybe, have a look to Internet Identity and the Bitcoin canisters repo. They both use the stable structures. Hope that helps.

1 Like

Yes, that will help David, much appreciated.

2 Likes