Add StableVec::extend method
評価
調査の方向性
Start by reading StableVec's existing push implementation and the surrounding StableVec API. Compare the requested behavior with Vec::extend, then determine how an extend operation can avoid repeating per-element growth work. Done means StableVec supports extending from another vector or slice with behavior covered by the project's existing validation.
索引モデルが issue の本文から書いたものです。
説明
Currently the only way to extend a StableVec with another vector or slice is repeatedly calling push:
let stable_vec = StableVec::<u8, _>::init(mem).expect("Memory was not for stable vec");
let bytes = bincode::encode_to_vec(value, BINCODE_CONFIG).expect("Failed to serialize value");
for byte in bytes {
stable_vec.push(&byte).expect("StableVec push failed");
}
The above code is very memory inefficient as it requires running the entire push code for every element (including growing memory!).
A similar method already exists for the std Vec: Vec::extend
- 主要言語
- Rust
- スター
- 111
- フォーク
- 39
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
dfinity/stable-structures のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
dfinity/stable-structures#439 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
dfinity/stable-structures#400 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
dfinity/stable-structures#382 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
dfinity/stable-structures#266 · コメント 3 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
dfinity/stable-structures#264 · コメント 1 件 ·
dfinity/stable-structures の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
wasi-gfx/wasi-gfx-runtime#152 ·
-
area:cli bug good first issue priority:medium
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
aaif-goose/goose#13031 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 63/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信