On 2/11/25 22:43, Kevin Wolf wrote:
+    /// Reads data from the child node into a linear typed buffer.
+    pub async fn read<T: IoBuffer + ?Sized>(&self, offset: u64, buf: &mut T) -> 
io::Result<()> {
+        unsafe {
+            self.read_raw(offset, buf.buffer_len(), buf.buffer_mut_ptr())
+                .await
+        }
+    }
+
+    /// Reads data from the child node into a linear, potentially 
uninitialised typed buffer.
+    pub async fn read_uninit<T: SizedIoBuffer>(
+        &self,
+        offset: u64,
+        mut buf: MaybeUninit<T>,

I think Rust doesn't guarantee no copies here, so maybe this could be

   pub async fn read_uninit<T: SizedIoBuffer>(
       &self,
       offset: u64,
       buf: &mut MaybeUninit<T>,
    ) -> io::Result<&mut T>

using assume_init_mut().

Paolo


Reply via email to