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


##########
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:
   makes sense. I will move all the put/get methods into a separate 
unsafe_util.rs and keep buffer.rs clean. Will push the new updates



-- 
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