@@ -20,7 +20,7 @@ use std::fmt::Debug;
2020use std:: ptr:: NonNull ;
2121use std:: sync:: Arc ;
2222
23- use crate :: alloc:: { Allocation , Deallocation , ALIGNMENT } ;
23+ use crate :: alloc:: { Allocation , Deallocation } ;
2424use crate :: util:: bit_chunk_iterator:: { BitChunks , UnalignedBitChunk } ;
2525use crate :: BufferBuilder ;
2626use crate :: { bit_util, bytes:: Bytes , native:: ArrowNativeType } ;
@@ -99,26 +99,6 @@ impl Buffer {
9999 buffer. into ( )
100100 }
101101
102- /// Creates a buffer from an existing aligned memory region (must already be byte-aligned), this
103- /// `Buffer` will free this piece of memory when dropped.
104- ///
105- /// # Arguments
106- ///
107- /// * `ptr` - Pointer to raw parts
108- /// * `len` - Length of raw parts in **bytes**
109- /// * `capacity` - Total allocated memory for the pointer `ptr`, in **bytes**
110- ///
111- /// # Safety
112- ///
113- /// This function is unsafe as there is no guarantee that the given pointer is valid for `len`
114- /// bytes. If the `ptr` and `capacity` come from a `Buffer`, then this is guaranteed.
115- #[ deprecated( since = "50.0.0" , note = "Use Buffer::from_vec" ) ]
116- pub unsafe fn from_raw_parts ( ptr : NonNull < u8 > , len : usize , capacity : usize ) -> Self {
117- assert ! ( len <= capacity) ;
118- let layout = Layout :: from_size_align ( capacity, ALIGNMENT ) . unwrap ( ) ;
119- Buffer :: build_with_arguments ( ptr, len, Deallocation :: Standard ( layout) )
120- }
121-
122102 /// Creates a buffer from an existing memory region. Ownership of the memory is tracked via reference counting
123103 /// and the memory will be freed using the `drop` method of [crate::alloc::Allocation] when the reference count reaches zero.
124104 ///
@@ -322,6 +302,8 @@ impl Buffer {
322302 /// Returns `MutableBuffer` for mutating the buffer if this buffer is not shared.
323303 /// Returns `Err` if this is shared or its allocation is from an external source or
324304 /// it is not allocated with alignment [`ALIGNMENT`]
305+ ///
306+ /// [`ALIGNMENT`]: crate::alloc::ALIGNMENT
325307 pub fn into_mutable ( self ) -> Result < MutableBuffer , Self > {
326308 let ptr = self . ptr ;
327309 let length = self . length ;
0 commit comments