1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use std::convert::Infallible;

use super::MakeService;

#[derive(Clone)]
pub struct CloneFactory<T> {
    svc: T,
}

impl<T> MakeService for CloneFactory<T>
where
    T: Clone,
{
    type Service = T;

    type Error = Infallible;

    fn make_via_ref(&self, _old: Option<&Self::Service>) -> Result<Self::Service, Self::Error> {
        Ok(self.svc.clone())
    }
}