-
Notifications
You must be signed in to change notification settings - Fork 1k
docs: Add example for creating a MutableBuffer from Buffer
#8853
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
Conversation
| /// assert_eq!(buffer.as_slice(), &[0u8, 1, 0, 0, 1, 0, 0, 0]) | ||
| /// ``` | ||
| /// | ||
| /// # Example: Creating a [`MutableBuffer`] from a [`Buffer`] |
There was a problem hiding this comment.
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
etseidl
left a comment
There was a problem hiding this 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][..]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be
| /// 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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
|
Thanks @etseidl |
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