Skip to content

Conversation

@alamb
Copy link
Contributor

@alamb alamb commented Nov 16, 2025

Which issue does this PR close?

Rationale for this change

It my not be clear how to convert to a MutableBuffer, so let's add some doc examples

What changes are included in this PR?

Add doc examples

Are these changes tested?

Yes by CI

Are there any user-facing changes?

More docs, no functional change

@alamb alamb added the documentation Improvements or additions to documentation label Nov 16, 2025
@github-actions github-actions bot added the arrow Changes to the arrow crate label Nov 16, 2025
/// assert_eq!(buffer.as_slice(), &[0u8, 1, 0, 0, 1, 0, 0, 0])
/// ```
///
/// # Example: Creating a [`MutableBuffer`] from a [`Buffer`]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made a second copy of the example here to make it easier to find for people who arrive at MutableBuffer. I could avoid the copy and just leave a reference but I felt this would be easier to find

Copy link
Contributor

@etseidl etseidl left a comment

Choose a reason for hiding this comment

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

👍

/// # Example: Creating a [`MutableBuffer`] from a [`Buffer`]
/// ```
/// # use arrow_buffer::buffer::{Buffer, MutableBuffer};
/// let buffer: Buffer = Buffer::from(&[1u8, 2, 3, 4][..]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be

Suggested change
/// let buffer: Buffer = Buffer::from(&[1u8, 2, 3, 4][..]);
/// let buffer = Buffer::from(&[1u8, 2, 3, 4][..]);

? I noticed you removed the explicit typing in the earlier PR.

Copy link
Contributor Author

@alamb alamb Nov 17, 2025

Choose a reason for hiding this comment

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

Yeah I should probably make that more clear -- personally find the let buffer = Buffer::from(foo) syntax easier to understand than let buffer: Buffer = foo.into() (it looks more like a constructor to me), but really there is no concrete difference between the two syntaxes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used the Buffer::from syntax in 76b4490 -- it looks nicer now -- thank you

@alamb alamb merged commit 5ee07d1 into apache:main Nov 18, 2025
26 checks passed
@alamb
Copy link
Contributor Author

alamb commented Nov 18, 2025

Thanks @etseidl

@alamb alamb deleted the alamb/mutable_buffer_from_buffer branch November 18, 2025 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants