Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more methods to EncodeAsVarULE #1199

Merged
merged 7 commits into from
Oct 25, 2021

Conversation

Manishearth
Copy link
Member

@Manishearth Manishearth commented Oct 21, 2021

Part of #1082

fixes #1179

Names bikesheddable, I wanted them to all mention var_ule at least.

@Manishearth Manishearth requested a review from sffc as a code owner October 21, 2021 03:22
This was referenced Oct 21, 2021
@Manishearth Manishearth modified the milestone: ICU4X 0.4 Oct 21, 2021
utils/zerovec/src/ule/custom/encode.rs Outdated Show resolved Hide resolved
utils/zerovec/src/ule/custom/encode.rs Outdated Show resolved Hide resolved
Comment on lines 65 to 66
/// Write the corresponding [`VarULE`] type to the `dst` buffer. `dst` should
/// be the size of [`Self::encoded_var_ule_length()`]
Copy link
Member

Choose a reason for hiding this comment

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

Is the "should" here a safety constraint?

Do the bytes need to be initialized? If not, should we require that the impl writes across every byte?

Copy link
Member Author

Choose a reason for hiding this comment

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

Right now it's written such that implementations will panic if it's not followed, hence the should not must.

&mut [u8] in rust is invalid if not initialized: if we wish to allow uninitialized buffers, we must use *mut [u8] instead.

utils/zerovec/src/ule/custom/encode.rs Outdated Show resolved Hide resolved
utils/zerovec/src/varzerovec/components.rs Outdated Show resolved Hide resolved
@Manishearth Manishearth requested a review from sffc October 22, 2021 05:09
@Manishearth Manishearth merged commit 3920ad2 into unicode-org:main Oct 25, 2021
@Manishearth Manishearth deleted the encode-length branch October 25, 2021 18:59
hsivonen pushed a commit to hsivonen/icu4x that referenced this pull request Nov 11, 2021
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.

Converting to VarULE
2 participants