near / near-sdk-rs

Rust library for writing NEAR smart contracts
https://near-sdk.io
Apache License 2.0
443 stars 228 forks source link

[EXT] Collections - Vector #716

Open near-arthur opened 2 years ago

near-arthur commented 2 years ago

https://docs.rs/near-sdk/3.1.0/near_sdk/collections/struct.Vector.html

For each of the following functions, add an example code snippet:

Examples should be simple, easy-to-follow, and useful to make onboarding and learning Rust SDK as straightforward as possible. See array primitive for examples of code snippet examples: https://doc.rust-lang.org/nightly/core/primitive.array.html), https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#784-790 for examples in code.

austinabell commented 2 years ago

Note that for all or most of the collection types, these are all legacy ones that will eventually be replaced by the near_sdk::store equivalents, so not sure if it's worth putting resources into.

The one exception to the new collections being documented with examples is actually the new Vector https://github.com/near/near-sdk-rs/blob/master/near-sdk/src/store/vec/mod.rs which could be improved.

Also, note that docs can be pulled from https://doc.rust-lang.org/std/vec/struct.Vec.html for the most part (esp for the new version because the API matches more closely than near_sdk::collections::Vector