You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2025/11/16 12:39:32 UTC
[PR] docs: Add example for creating a `MutableBuffer` from `Buffer` [arrow-rs]
alamb opened a new pull request, #8853:
URL: https://github.com/apache/arrow-rs/pull/8853
# Which issue does this PR close?
- Similar to https://github.com/apache/arrow-rs/pull/8852
# 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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] docs: Add example for creating a `MutableBuffer` from `Buffer` [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #8853:
URL: https://github.com/apache/arrow-rs/pull/8853
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] docs: Add example for creating a `MutableBuffer` from `Buffer` [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #8853:
URL: https://github.com/apache/arrow-rs/pull/8853#discussion_r2533728617
##########
arrow-buffer/src/buffer/immutable.rs:
##########
@@ -364,6 +364,23 @@ impl Buffer {
/// Returns `Err` if this is shared or its allocation is from an external source or
/// it is not allocated with alignment [`ALIGNMENT`]
///
+ /// # Example: Creating a [`MutableBuffer`] from a [`Buffer`]
+ /// ```
+ /// # use arrow_buffer::buffer::{Buffer, MutableBuffer};
+ /// let buffer: Buffer = Buffer::from(&[1u8, 2, 3, 4][..]);
Review Comment:
I used the `Buffer::from` syntax in 76b4490719 -- it looks nicer now -- thank you
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] docs: Add example for creating a `MutableBuffer` from `Buffer` [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #8853:
URL: https://github.com/apache/arrow-rs/pull/8853#issuecomment-3549537181
Thanks @etseidl
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] docs: Add example for creating a `MutableBuffer` from `Buffer` [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #8853:
URL: https://github.com/apache/arrow-rs/pull/8853#discussion_r2533719417
##########
arrow-buffer/src/buffer/immutable.rs:
##########
@@ -364,6 +364,23 @@ impl Buffer {
/// Returns `Err` if this is shared or its allocation is from an external source or
/// it is not allocated with alignment [`ALIGNMENT`]
///
+ /// # Example: Creating a [`MutableBuffer`] from a [`Buffer`]
+ /// ```
+ /// # use arrow_buffer::buffer::{Buffer, MutableBuffer};
+ /// let buffer: Buffer = Buffer::from(&[1u8, 2, 3, 4][..]);
Review 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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] docs: Add example for creating a `MutableBuffer` from `Buffer` [arrow-rs]
Posted by "etseidl (via GitHub)" <gi...@apache.org>.
etseidl commented on code in PR #8853:
URL: https://github.com/apache/arrow-rs/pull/8853#discussion_r2532056761
##########
arrow-buffer/src/buffer/immutable.rs:
##########
@@ -364,6 +364,23 @@ impl Buffer {
/// Returns `Err` if this is shared or its allocation is from an external source or
/// it is not allocated with alignment [`ALIGNMENT`]
///
+ /// # Example: Creating a [`MutableBuffer`] from a [`Buffer`]
+ /// ```
+ /// # use arrow_buffer::buffer::{Buffer, MutableBuffer};
+ /// let buffer: Buffer = Buffer::from(&[1u8, 2, 3, 4][..]);
Review Comment:
Can this be
```suggestion
/// let buffer = Buffer::from(&[1u8, 2, 3, 4][..]);
```
? I noticed you removed the explicit typing in the earlier PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] docs: Add example for creating a `MutableBuffer` from `Buffer` [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #8853:
URL: https://github.com/apache/arrow-rs/pull/8853#discussion_r2531929954
##########
arrow-buffer/src/buffer/mutable.rs:
##########
@@ -58,6 +58,23 @@ use super::Buffer;
/// let buffer: Buffer = buffer.into();
/// assert_eq!(buffer.as_slice(), &[0u8, 1, 0, 0, 1, 0, 0, 0])
/// ```
+///
+/// # Example: Creating a [`MutableBuffer`] from a [`Buffer`]
Review 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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] docs: Add example for creating a `MutableBuffer` from `Buffer` [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #8853:
URL: https://github.com/apache/arrow-rs/pull/8853#discussion_r2533719417
##########
arrow-buffer/src/buffer/immutable.rs:
##########
@@ -364,6 +364,23 @@ impl Buffer {
/// Returns `Err` if this is shared or its allocation is from an external source or
/// it is not allocated with alignment [`ALIGNMENT`]
///
+ /// # Example: Creating a [`MutableBuffer`] from a [`Buffer`]
+ /// ```
+ /// # use arrow_buffer::buffer::{Buffer, MutableBuffer};
+ /// let buffer: Buffer = Buffer::from(&[1u8, 2, 3, 4][..]);
Review 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()`, but really there is no concrete difference between the two syntaxes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org