Skip to content

stable-layout: change fields visibility of StableVec<T> from public to private#740

Open
yilin0518 wants to merge 1 commit into
anza-xyz:masterfrom
yilin0518:master
Open

stable-layout: change fields visibility of StableVec<T> from public to private#740
yilin0518 wants to merge 1 commit into
anza-xyz:masterfrom
yilin0518:master

Conversation

@yilin0518

@yilin0518 yilin0518 commented May 26, 2026

Copy link
Copy Markdown

This pull request solves the issue #615 which mentions that public fields may have potential risks. This PR makes improvements to the StableVec struct in the stable-layout crate, focusing on encapsulation and API usability. The most important changes are:

Encapsulation improvements:

  • Changed the fields addr, cap, and len in the StableVec struct from public to private, preventing direct modification from outside the struct and improving safety.

API enhancements:

  • Added a new public method cap() to the StableVec implementation, allowing users to access the capacity of the vector in a controlled manner.

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.

1 participant