1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use crate::header::RequestHeader;
use crate::body::Body;
#[cfg(feature = "timeout")]
use std::time::Duration;
#[derive(Debug)]
pub struct Request {
	pub header: RequestHeader,
	pub body: Body
}
impl Request {
	
	pub fn new(header: RequestHeader, body: Body) -> Self {
		Self { header, body }
	}
	
	pub fn take_body(&mut self) -> Body {
		self.body.take()
	}
	
	#[cfg(feature = "timeout")]
	pub fn body_with_timeout(&mut self, timeout: Duration) -> crate::body::BodyWithTimeout {
		self.body.take().add_timeout(timeout)
	}
	
	pub fn header(&self) -> &RequestHeader {
		&self.header
	}
	
	pub fn header_mut(&mut self) -> &mut RequestHeader {
		&mut self.header
	}
}