Skip to content

Conversation

@madsmtm
Copy link
Member

@madsmtm madsmtm commented Feb 10, 2026

There isn't a use-case for an immutable buffer() method, so the "mut" suffix is kinda unnecessary, and "next" a bit more clearly communicates that softbuffer::Surface potentially contains more than one buffer.

There isn't a use-case for an immutable `buffer()` method, so the "mut"
suffix is kinda unnecessary, and "next" a bit more clearly communicates
that `softbuffer::Surface` potentially contains more than one buffer.
@madsmtm madsmtm added the documentation Improvements or additions to documentation label Feb 10, 2026
@madsmtm madsmtm added the enhancement New feature or request label Feb 10, 2026
@madsmtm madsmtm added this to the Softbuffer v0.5 milestone Feb 10, 2026
Comment on lines 29 to +30
/// Get a mutable reference to the buffer.
fn buffer_mut(&mut self) -> Result<Self::Buffer<'_>, SoftBufferError>;
fn next_buffer(&mut self) -> Result<Self::Buffer<'_>, SoftBufferError>;
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 doc-comment still "accurate" for the same "there is no immutable version" reason?

}

/// Set the size of the buffer that will be returned by [`Surface::buffer_mut`].
/// Set the size of the buffer that will be returned by [`Surface::next_buffer`].
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
/// Set the size of the buffer that will be returned by [`Surface::next_buffer`].
/// Set the size of the buffer that will be returned by [`Surface::next_buffer()`].

etc

- Added `Buffer::pixel_rows()` for iterating over rows of the buffer data.
- Added `Buffer::pixels_iter()` for iterating over each pixel with its associated `x`/`y` coordinate.
- Added `Buffer::byte_stride()` for pixel buffers whose rows are aligned and may contain padding bytes at the end. Prefer to use the above helpers instead of accessing pixel data directly.
- Renamed `Surface::buffer_mut` to `Surface::next_buffer`.
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
- Renamed `Surface::buffer_mut` to `Surface::next_buffer`.
- Renamed `Surface::buffer_mut()` to `Surface::next_buffer()`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

2 participants