Skip to content

Commit

Permalink
Add doctest example for Buffer::from_bytes (#6920)
Browse files Browse the repository at this point in the history
* Add doctest example for

* Remove typo

* Update arrow-buffer/src/buffer/immutable.rs

---------

Co-authored-by: Andrew Lamb <[email protected]>
  • Loading branch information
kylebarron and alamb authored Jan 1, 2025
1 parent 5249f99 commit fbee05f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions arrow-buffer/src/buffer/immutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ unsafe impl Sync for Buffer where Bytes: Sync {}

impl Buffer {
/// Auxiliary method to create a new Buffer
///
/// This can be used with a [`bytes::Bytes`] via `into()`:
///
/// ```
/// # use arrow_buffer::Buffer;
/// let bytes = bytes::Bytes::from_static(b"foo");
/// let buffer = Buffer::from_bytes(bytes.into());
/// ```
#[inline]
pub fn from_bytes(bytes: Bytes) -> Self {
let length = bytes.len();
Expand Down

0 comments on commit fbee05f

Please sign in to comment.