fastcgi_client/request.rs
1// Copyright 2022 jmjoy
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use crate::Params;
16use tokio::io::AsyncRead;
17
18/// fastcgi request.
19pub struct Request<'a, I: AsyncRead + Unpin> {
20 pub(crate) params: Params<'a>,
21 pub(crate) stdin: I,
22}
23
24impl<'a, I: AsyncRead + Unpin> Request<'a, I> {
25 pub fn new(params: Params<'a>, stdin: I) -> Self {
26 Self { params, stdin }
27 }
28
29 pub fn params(&self) -> &Params<'a> {
30 &self.params
31 }
32
33 pub fn params_mut(&mut self) -> &mut Params<'a> {
34 &mut self.params
35 }
36
37 pub fn stdin(&self) -> &I {
38 &self.stdin
39 }
40
41 pub fn stdin_mut(&mut self) -> &mut I {
42 &mut self.stdin
43 }
44}