File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ use crate::requests::Result;
4
4
#[ cfg( feature = "fuzz" ) ]
5
5
use arbitrary:: Arbitrary ;
6
6
use std:: io:: { Read , Write } ;
7
+ use std:: ops:: { Deref , DerefMut } ;
7
8
use zeroize:: Zeroize ;
8
9
9
10
/// Wrapper around the body of a request.
@@ -16,6 +17,20 @@ pub struct RequestBody {
16
17
buffer : Vec < u8 > ,
17
18
}
18
19
20
+ impl Deref for RequestBody {
21
+ type Target = [ u8 ] ;
22
+
23
+ fn deref ( & self ) -> & Self :: Target {
24
+ & self . buffer
25
+ }
26
+ }
27
+
28
+ impl DerefMut for RequestBody {
29
+ fn deref_mut ( & mut self ) -> & mut Self :: Target {
30
+ & mut self . buffer
31
+ }
32
+ }
33
+
19
34
impl RequestBody {
20
35
/// Create a new, emtpy request body field.
21
36
/// Available for testing only.
Original file line number Diff line number Diff line change 3
3
use super :: Result ;
4
4
use serde:: { Deserialize , Serialize } ;
5
5
use std:: io:: { Read , Write } ;
6
+ use std:: ops:: { Deref , DerefMut } ;
6
7
use zeroize:: Zeroize ;
7
8
8
9
/// Wrapper around the body of a response.
@@ -14,6 +15,20 @@ pub struct ResponseBody {
14
15
buffer : Vec < u8 > ,
15
16
}
16
17
18
+ impl Deref for ResponseBody {
19
+ type Target = [ u8 ] ;
20
+
21
+ fn deref ( & self ) -> & Self :: Target {
22
+ & self . buffer
23
+ }
24
+ }
25
+
26
+ impl DerefMut for ResponseBody {
27
+ fn deref_mut ( & mut self ) -> & mut Self :: Target {
28
+ & mut self . buffer
29
+ }
30
+ }
31
+
17
32
impl ResponseBody {
18
33
/// Create a new empty response body.
19
34
pub ( crate ) fn new ( ) -> ResponseBody {
You can’t perform that action at this time.
0 commit comments