File tree Expand file tree Collapse file tree 1 file changed +0
-28
lines changed
Expand file tree Collapse file tree 1 file changed +0
-28
lines changed Original file line number Diff line number Diff line change @@ -523,34 +523,6 @@ impl<T> Buffer<T> {
523523 }
524524}
525525
526- impl ByteBuffer {
527- /// Reinterpret the byte buffer as a slice of values of type `V`.
528- ///
529- /// # Panics
530- ///
531- /// This method will only work if the buffer has the proper size and alignment to be viewed
532- /// as a buffer of `V` values.
533- pub fn reinterpret < V : Sized > ( & self ) -> & [ V ] {
534- assert ! (
535- self . is_aligned( Alignment :: of:: <V >( ) ) ,
536- "ByteBuffer not properly aligned to {}" ,
537- type_name:: <V >( )
538- ) ;
539-
540- assert_eq ! (
541- self . length % size_of:: <V >( ) ,
542- 0 ,
543- "ByteBuffer length not a multiple of the value length"
544- ) ;
545-
546- let v_len = self . length / size_of :: < V > ( ) ;
547- let v_ptr = self . bytes . as_ptr ( ) . cast :: < V > ( ) ;
548-
549- // SAFETY: we checked that alignment and length are suitable to treat this as a &[V].
550- unsafe { std:: slice:: from_raw_parts ( v_ptr, v_len) }
551- }
552- }
553-
554526/// An iterator over Buffer elements.
555527///
556528/// This is an analog to the `std::slice::Iter` type.
You can’t perform that action at this time.
0 commit comments