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

Implement Debug for CommandQueue #11444

Merged
merged 3 commits into from
Jan 22, 2024

Conversation

BigWingBeat
Copy link
Contributor

Objective

Allow users to impl Debug on types containing CommandQueues

Solution

Derive Debug on CommandQueue

@alice-i-cecile alice-i-cecile added A-ECS Entities, components, systems, and events C-Code-Quality A section of code that is hard to understand or change S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it labels Jan 21, 2024
Copy link
Member

@JoJoJet JoJoJet left a comment

Choose a reason for hiding this comment

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

This needs a manual implementation instead of being derived. Currently, this will print

[core::mem::maybe_uninit::MaybeUninit<u8>, core::mem::maybe_uninit::MaybeUninit<u8>, ...] repeatedly for every single byte stored in the CommandQueue (easily hundreds or thousands).

I would do:

fn fmt(&self, f: &mut Formatter) -> fmt::Result {
    f.debug_struct("CommandQueue")
        .field("byte_count", &self.bytes.len())
        .finish_non_exhaustive()
}

@alice-i-cecile alice-i-cecile removed the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Jan 21, 2024
@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Jan 22, 2024
@alice-i-cecile alice-i-cecile changed the title Derive debug on CommandQueue Implement Debug for CommandQueue Jan 22, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jan 22, 2024
Merged via the queue into bevyengine:main with commit df063ab Jan 22, 2024
22 checks passed
@BigWingBeat BigWingBeat deleted the debug-impls branch July 5, 2024 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Code-Quality A section of code that is hard to understand or change S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants