Improve docs around Val conversion in collections#1774
Merged
Conversation
mootz12
commented
Mar 18, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves Soroban SDK collection documentation to clarify the semantics of iter() vs try_iter() for Vec and Map, especially around lazy Val→typed conversion and when panics can occur.
Changes:
- Added/expanded rustdoc for
Vec::{iter, try_iter}describing conversion behavior and panic semantics. - Updated
Maprustdoc and added docs forMap::{keys, values, iter, try_iter}. - Expanded
itermodule-level docs to explain the “panicking” vs “fallible” iterator wrappers.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| soroban-sdk/src/vec.rs | Adds docs for iter()/try_iter() behavior and panic guidance. |
| soroban-sdk/src/map.rs | Updates Map-level docs and documents keys()/values() and iterator variants. |
| soroban-sdk/src/iter.rs | Adds module docs explaining iterator design and error handling. |
You can also share your feedback on Copilot code review. Take the survey.
leighmcculloch
approved these changes
Mar 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Improve documentation for Vec and Map to clarify that element types in host-backed collections are validated lazily — only when accessed — not when the collection is constructed or received as a contract argument.
Why
Val conversion / type guarantees were documented for both the
VecandMapstructs, but was missing on some of the utility functions where validation was unclear.