Skip to content

Cleaner Debug output for ImageBuffer #1613

@kneasle

Description

@kneasle

Currently ImageBuffer uses #[derive(Debug)], which prints something like this (where every channel of every pixel is printed):

ImageBuffer {
    width: 64,
    height: 64,
    _phantom: PhantomData,
    data: [
        0,
        0,
        0,
        0,
       ...
        0,
        0,
        0,
    ],
}

This is frustrating when debugging my own types which contain an ImageBuffer, since even a few reasonably sized images add up to tens of millions of lines of output. It would be much nicer to see something small like ImageBuffer<Rgb8>(64x64), or perhaps something like ImageBuffer(64x64x4) if we don't want to enforce a trait bound on the pixel format. I'm open to ideas over what the format should be, and I'm happy to make a PR for this. Implementation would simply be a custom Derive impl for ImageBuffer and any other image types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions