Skip to content

Improve docs around Val conversion in collections#1774

Merged
mootz12 merged 3 commits intomainfrom
improve-collections-docs
Mar 19, 2026
Merged

Improve docs around Val conversion in collections#1774
mootz12 merged 3 commits intomainfrom
improve-collections-docs

Conversation

@mootz12
Copy link
Copy Markdown
Contributor

@mootz12 mootz12 commented Mar 18, 2026

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 Vec and Map structs, but was missing on some of the utility functions where validation was unclear.

Copilot AI review requested due to automatic review settings March 18, 2026 17:23
Comment thread soroban-sdk/src/map.rs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Map rustdoc and added docs for Map::{keys, values, iter, try_iter}.
  • Expanded iter module-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.

Comment thread soroban-sdk/src/map.rs Outdated
Comment thread soroban-sdk/src/map.rs Outdated
Comment thread soroban-sdk/src/map.rs Outdated
Comment thread soroban-sdk/src/vec.rs
Comment thread soroban-sdk/src/iter.rs
@mootz12 mootz12 requested a review from a team March 18, 2026 18:02
@mootz12 mootz12 added this pull request to the merge queue Mar 19, 2026
Merged via the queue into main with commit f7bdf7e Mar 19, 2026
178 of 180 checks passed
@mootz12 mootz12 deleted the improve-collections-docs branch March 19, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants