docs: Add example for creating a MutableBuffer from Buffer#8853
docs: Add example for creating a MutableBuffer from Buffer#8853alamb merged 2 commits intoapache:mainfrom
MutableBuffer from Buffer#8853Conversation
| /// 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.
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
| /// # 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.
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.
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.
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