diff --git a/src/buffer/immutable.rs b/src/buffer/immutable.rs index 8bbe0115d2e..8e2d73ecc04 100644 --- a/src/buffer/immutable.rs +++ b/src/buffer/immutable.rs @@ -1,7 +1,5 @@ use std::{iter::FromIterator, sync::Arc, usize}; -use crate::types::NativeType; - use super::bytes::Bytes; /// [`Buffer`] is a contiguous memory region of plain old data types @@ -9,7 +7,7 @@ use super::bytes::Bytes; /// /// The easiest way to think about [`Buffer`] is being equivalent to /// a `Arc>`, with the following differences: -/// * `T` must be [`NativeType`] +/// * `T` must be [`std::fmt::Debug`] /// * slicing and cloning is `O(1)`. /// * it supports external allocated memory (via FFI) /// @@ -34,7 +32,7 @@ use super::bytes::Bytes; /// assert_eq!(buffer.get_mut(), None); /// ``` #[derive(Clone, PartialEq)] -pub struct Buffer { +pub struct Buffer { /// the internal byte buffer. data: Arc>, @@ -46,20 +44,20 @@ pub struct Buffer { length: usize, } -impl std::fmt::Debug for Buffer { +impl std::fmt::Debug for Buffer { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Debug::fmt(&**self, f) } } -impl Default for Buffer { +impl Default for Buffer { #[inline] fn default() -> Self { Vec::new().into() } } -impl Buffer { +impl Buffer { /// Creates an empty [`Buffer`]. #[inline] pub fn new() -> Self { @@ -162,7 +160,7 @@ impl Buffer { } } -impl From> for Buffer { +impl From> for Buffer { #[inline] fn from(p: Vec) -> Self { let bytes: Bytes = p.into(); @@ -174,7 +172,7 @@ impl From> for Buffer { } } -impl std::ops::Deref for Buffer { +impl std::ops::Deref for Buffer { type Target = [T]; #[inline] @@ -183,7 +181,7 @@ impl std::ops::Deref for Buffer { } } -impl FromIterator for Buffer { +impl FromIterator for Buffer { #[inline] fn from_iter>(iter: I) -> Self { Vec::from_iter(iter).into()