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

Use pseudocode to document transmute, transmute_mut #1058

Merged
merged 1 commit into from
Mar 19, 2024
Merged

Conversation

jswrenn
Copy link
Collaborator

@jswrenn jswrenn commented Mar 19, 2024

Partially addresses #1046.

src/lib.rs Outdated
/// Src: IntoBytes,
/// Dst: FromBytes,
/// size_of::<Src>() == size_of::<Dst>(),
/// align_of::<Src>() >= align_of::<Dst>(),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// align_of::<Src>() >= align_of::<Dst>(),

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

src/lib.rs Outdated
/// Src: IntoBytes + FromBytes + NoCell,
/// Dst: FromBytes + IntoBytes + NoCell,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// Src: IntoBytes + FromBytes + NoCell,
/// Dst: FromBytes + IntoBytes + NoCell,
/// Src: FromBytes + IntoBytes + NoCell,
/// Dst: FromBytes + IntoBytes + NoCell,

IMO it's visually clearer this way that both types must implement the same set of traits.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

src/lib.rs Outdated
Comment on lines 4587 to 4588
/// Src: IntoBytes + FromBytes + NoCell,
/// Dst: IntoBytes + FromBytes + NoCell,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// Src: IntoBytes + FromBytes + NoCell,
/// Dst: IntoBytes + FromBytes + NoCell,
/// Src: FromBytes + IntoBytes + NoCell,
/// Dst: FromBytes + IntoBytes + NoCell,

Usually we list FromBytes before IntoBytes, consistent w/ the stdlib From and Into. I don't feel strongly about it, though, so feel free to leave it as-is if you prefer.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fair enough. Done.

@jswrenn jswrenn added this pull request to the merge queue Mar 19, 2024
Merged via the queue into main with commit 1211af3 Mar 19, 2024
210 checks passed
@jswrenn jswrenn deleted the doc-transmutes branch March 19, 2024 22:43
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.

None yet

2 participants