kvarn_fastcgi_client/conn.rs
1/// Connection mode, indicate is keep alive or not.
2// Copyright 2022 jmjoy
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16pub trait Mode {
17 fn is_keep_alive() -> bool;
18}
19
20/// Short connection mode.
21pub struct ShortConn;
22
23impl Mode for ShortConn {
24 fn is_keep_alive() -> bool {
25 false
26 }
27}
28
29/// Keep alive connection mode.
30pub struct KeepAlive {}
31
32impl Mode for KeepAlive {
33 fn is_keep_alive() -> bool {
34 true
35 }
36}