@@ -13,18 +13,12 @@ pub trait Buffer {
1313 fn as_ngx_buf_mut ( & mut self ) -> * mut ngx_buf_t ;
1414
1515 /// Returns the buffer contents as a byte slice.
16- ///
17- /// # Safety
18- /// This function is marked as unsafe because it involves raw pointer manipulation.
1916 fn as_bytes ( & self ) -> & [ u8 ] {
2017 let buf = self . as_ngx_buf ( ) ;
2118 unsafe { slice:: from_raw_parts ( ( * buf) . pos , self . len ( ) ) }
2219 }
2320
2421 /// Returns the length of the buffer contents.
25- ///
26- /// # Safety
27- /// This function is marked as unsafe because it involves raw pointer manipulation.
2822 fn len ( & self ) -> usize {
2923 let buf = self . as_ngx_buf ( ) ;
3024 unsafe {
@@ -68,9 +62,6 @@ pub trait Buffer {
6862/// The `MutableBuffer` trait extends the `Buffer` trait and provides methods for working with a mutable buffer.
6963pub trait MutableBuffer : Buffer {
7064 /// Returns a mutable reference to the buffer contents as a byte slice.
71- ///
72- /// # Safety
73- /// This function is marked as unsafe because it involves raw pointer manipulation.
7465 fn as_bytes_mut ( & mut self ) -> & mut [ u8 ] {
7566 let buf = self . as_ngx_buf_mut ( ) ;
7667 unsafe { slice:: from_raw_parts_mut ( ( * buf) . pos , self . len ( ) ) }
@@ -105,9 +96,6 @@ impl Buffer for TemporaryBuffer {
10596
10697impl MutableBuffer for TemporaryBuffer {
10798 /// Returns a mutable reference to the buffer contents as a byte slice.
108- ///
109- /// # Safety
110- /// This function is marked as unsafe because it involves raw pointer manipulation.
11199 fn as_bytes_mut ( & mut self ) -> & mut [ u8 ] {
112100 unsafe { slice:: from_raw_parts_mut ( ( * self . 0 ) . pos , self . len ( ) ) }
113101 }
0 commit comments