chaokunyang commented on code in PR #3580:
URL: https://github.com/apache/fory/pull/3580#discussion_r3104901727


##########
rust/fory-core/src/buffer.rs:
##########
@@ -499,6 +499,248 @@ impl<'a> Writer<'a> {
             self.write_u64(combined);
         }
     }
+
+    /// # Safety
+    #[inline(always)]
+    pub unsafe fn prepare_write(&mut self, max_bytes: usize) -> (*mut u8, 
usize) {
+        self.reserve(max_bytes);
+        let len = self.bf.len();
+        (self.bf.as_mut_ptr().add(len), len)
+    }
+
+    /// # Safety
+    #[inline(always)]
+    pub unsafe fn finish_write(&mut self, new_len: usize) {
+        debug_assert!(new_len <= self.bf.capacity());
+        self.bf.set_len(new_len);
+    }
+
+    /// # Safety
+    #[inline(always)]
+    pub unsafe fn put_bool_at(ptr: *mut u8, value: bool) -> usize {

Review Comment:
   Could we remove all those methods from buffer.rs, you can create an 
unsafe_util.rs and put related methods there. Buffer here is a public class, bt 
those put/get methdos are internal methods, which should not be exposed to 
users 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to