All Downloads are FREE. Search and download functionalities are using the official Maven repository.

rust-server.server-make-service.mustache Maven / Gradle / Ivy

There is a newer version: 7.9.0
Show newest version

pub struct MakeService where
    T: Api + Clone + Send + 'static,
    C: Has {{#hasAuthMethods}}+ Has>{{/hasAuthMethods}} + Send + Sync + 'static
{
    api_impl: T,
    marker: PhantomData,
}

impl MakeService where
    T: Api + Clone + Send + 'static,
    C: Has {{#hasAuthMethods}}+ Has>{{/hasAuthMethods}} + Send + Sync + 'static
{
    pub fn new(api_impl: T) -> Self {
        MakeService {
            api_impl,
            marker: PhantomData
        }
    }
}


impl hyper::service::Service for MakeService where
    T: Api + Clone + Send + 'static,
    C: Has {{#hasAuthMethods}}+ Has>{{/hasAuthMethods}} + Send + Sync + 'static
{
    type Response = Service;
    type Error = crate::ServiceError;
    type Future = future::Ready>;

    fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll> {
        Poll::Ready(Ok(()))
    }

    fn call(&mut self, target: Target) -> Self::Future {
        future::ok(Service::new(
            self.api_impl.clone(),
        ))
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy