Geethapranay1 commented on code in PR #3580:
URL: https://github.com/apache/fory/pull/3580#discussion_r3105022858
##########
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:
hi @chaokunyang
moved all the put/get methods out of buffer.rs into a new unsafe_util.rs,
buffer stays clean as the public API and the codegen now references
fory_core::unsafe_util instead of fory_core::buffer::Writer, all tests passed.
--
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]