@@ -13,18 +13,12 @@ pub trait Buffer {
13
13
fn as_ngx_buf_mut ( & mut self ) -> * mut ngx_buf_t ;
14
14
15
15
/// Returns the buffer contents as a byte slice.
16
- ///
17
- /// # Safety
18
- /// This function is marked as unsafe because it involves raw pointer manipulation.
19
16
fn as_bytes ( & self ) -> & [ u8 ] {
20
17
let buf = self . as_ngx_buf ( ) ;
21
18
unsafe { slice:: from_raw_parts ( ( * buf) . pos , self . len ( ) ) }
22
19
}
23
20
24
21
/// Returns the length of the buffer contents.
25
- ///
26
- /// # Safety
27
- /// This function is marked as unsafe because it involves raw pointer manipulation.
28
22
fn len ( & self ) -> usize {
29
23
let buf = self . as_ngx_buf ( ) ;
30
24
unsafe {
@@ -68,9 +62,6 @@ pub trait Buffer {
68
62
/// The `MutableBuffer` trait extends the `Buffer` trait and provides methods for working with a mutable buffer.
69
63
pub trait MutableBuffer : Buffer {
70
64
/// 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.
74
65
fn as_bytes_mut ( & mut self ) -> & mut [ u8 ] {
75
66
let buf = self . as_ngx_buf_mut ( ) ;
76
67
unsafe { slice:: from_raw_parts_mut ( ( * buf) . pos , self . len ( ) ) }
@@ -105,9 +96,6 @@ impl Buffer for TemporaryBuffer {
105
96
106
97
impl MutableBuffer for TemporaryBuffer {
107
98
/// 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.
111
99
fn as_bytes_mut ( & mut self ) -> & mut [ u8 ] {
112
100
unsafe { slice:: from_raw_parts_mut ( ( * self . 0 ) . pos , self . len ( ) ) }
113
101
}
0 commit comments