lightspeed-astro 1.0.4

The new protocol for astronomical devices communication
Documentation
/// Generated server implementations.
pub mod astro_generic_service_server {
    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
    use tonic::codegen::*;
    ///Generated trait containing gRPC methods that should be implemented for use with AstroGenericServiceServer.
    #[async_trait]
    pub trait AstroGenericService: Send + Sync + 'static {
        async fn get_devices(
            &self,
            request: tonic::Request<super::super::request::GetDevicesRequest>,
        ) -> Result<
            tonic::Response<super::super::response::GetDevicesResponse>,
            tonic::Status,
        >;
        async fn set_property(
            &self,
            request: tonic::Request<super::super::request::SetPropertyRequest>,
        ) -> Result<
            tonic::Response<super::super::response::SetPropertyResponse>,
            tonic::Status,
        >;
    }
    #[derive(Debug)]
    pub struct AstroGenericServiceServer<T: AstroGenericService> {
        inner: _Inner<T>,
        accept_compression_encodings: (),
        send_compression_encodings: (),
    }
    struct _Inner<T>(Arc<T>);
    impl<T: AstroGenericService> AstroGenericServiceServer<T> {
        pub fn new(inner: T) -> Self {
            Self::from_arc(Arc::new(inner))
        }
        pub fn from_arc(inner: Arc<T>) -> Self {
            let inner = _Inner(inner);
            Self {
                inner,
                accept_compression_encodings: Default::default(),
                send_compression_encodings: Default::default(),
            }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> InterceptedService<Self, F>
        where
            F: tonic::service::Interceptor,
        {
            InterceptedService::new(Self::new(inner), interceptor)
        }
    }
    impl<T, B> tonic::codegen::Service<http::Request<B>> for AstroGenericServiceServer<T>
    where
        T: AstroGenericService,
        B: Body + Send + 'static,
        B::Error: Into<StdError> + Send + 'static,
    {
        type Response = http::Response<tonic::body::BoxBody>;
        type Error = std::convert::Infallible;
        type Future = BoxFuture<Self::Response, Self::Error>;
        fn poll_ready(
            &mut self,
            _cx: &mut Context<'_>,
        ) -> Poll<Result<(), Self::Error>> {
            Poll::Ready(Ok(()))
        }
        fn call(&mut self, req: http::Request<B>) -> Self::Future {
            let inner = self.inner.clone();
            match req.uri().path() {
                "/lightspeed.service.AstroGenericService/GetDevices" => {
                    #[allow(non_camel_case_types)]
                    struct GetDevicesSvc<T: AstroGenericService>(pub Arc<T>);
                    impl<
                        T: AstroGenericService,
                    > tonic::server::UnaryService<
                        super::super::request::GetDevicesRequest,
                    > for GetDevicesSvc<T> {
                        type Response = super::super::response::GetDevicesResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<
                                super::super::request::GetDevicesRequest,
                            >,
                        ) -> Self::Future {
                            let inner = self.0.clone();
                            let fut = async move { (*inner).get_devices(request).await };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let inner = inner.0;
                        let method = GetDevicesSvc(inner);
                        let codec = tonic::codec::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            );
                        let res = grpc.unary(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                "/lightspeed.service.AstroGenericService/SetProperty" => {
                    #[allow(non_camel_case_types)]
                    struct SetPropertySvc<T: AstroGenericService>(pub Arc<T>);
                    impl<
                        T: AstroGenericService,
                    > tonic::server::UnaryService<
                        super::super::request::SetPropertyRequest,
                    > for SetPropertySvc<T> {
                        type Response = super::super::response::SetPropertyResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<
                                super::super::request::SetPropertyRequest,
                            >,
                        ) -> Self::Future {
                            let inner = self.0.clone();
                            let fut = async move {
                                (*inner).set_property(request).await
                            };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let inner = inner.0;
                        let method = SetPropertySvc(inner);
                        let codec = tonic::codec::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            );
                        let res = grpc.unary(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                _ => {
                    Box::pin(async move {
                        Ok(
                            http::Response::builder()
                                .status(200)
                                .header("grpc-status", "12")
                                .header("content-type", "application/grpc")
                                .body(empty_body())
                                .unwrap(),
                        )
                    })
                }
            }
        }
    }
    impl<T: AstroGenericService> Clone for AstroGenericServiceServer<T> {
        fn clone(&self) -> Self {
            let inner = self.inner.clone();
            Self {
                inner,
                accept_compression_encodings: self.accept_compression_encodings,
                send_compression_encodings: self.send_compression_encodings,
            }
        }
    }
    impl<T: AstroGenericService> Clone for _Inner<T> {
        fn clone(&self) -> Self {
            Self(self.0.clone())
        }
    }
    impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
            write!(f, "{:?}", self.0)
        }
    }
    impl<T: AstroGenericService> tonic::transport::NamedService
    for AstroGenericServiceServer<T> {
        const NAME: &'static str = "lightspeed.service.AstroGenericService";
    }
}
/// Generated server implementations.
pub mod astro_ccd_service_server {
    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
    use tonic::codegen::*;
    ///Generated trait containing gRPC methods that should be implemented for use with AstroCcdServiceServer.
    #[async_trait]
    pub trait AstroCcdService: Send + Sync + 'static {
        async fn get_devices(
            &self,
            request: tonic::Request<super::super::request::GetDevicesRequest>,
        ) -> Result<
            tonic::Response<super::super::response::GetDevicesResponse>,
            tonic::Status,
        >;
        async fn set_property(
            &self,
            request: tonic::Request<super::super::request::SetPropertyRequest>,
        ) -> Result<
            tonic::Response<super::super::response::SetPropertyResponse>,
            tonic::Status,
        >;
        async fn expose(
            &self,
            request: tonic::Request<super::super::request::CcdExposureRequest>,
        ) -> Result<
            tonic::Response<super::super::request::CcdExposureResponse>,
            tonic::Status,
        >;
    }
    #[derive(Debug)]
    pub struct AstroCcdServiceServer<T: AstroCcdService> {
        inner: _Inner<T>,
        accept_compression_encodings: (),
        send_compression_encodings: (),
    }
    struct _Inner<T>(Arc<T>);
    impl<T: AstroCcdService> AstroCcdServiceServer<T> {
        pub fn new(inner: T) -> Self {
            Self::from_arc(Arc::new(inner))
        }
        pub fn from_arc(inner: Arc<T>) -> Self {
            let inner = _Inner(inner);
            Self {
                inner,
                accept_compression_encodings: Default::default(),
                send_compression_encodings: Default::default(),
            }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> InterceptedService<Self, F>
        where
            F: tonic::service::Interceptor,
        {
            InterceptedService::new(Self::new(inner), interceptor)
        }
    }
    impl<T, B> tonic::codegen::Service<http::Request<B>> for AstroCcdServiceServer<T>
    where
        T: AstroCcdService,
        B: Body + Send + 'static,
        B::Error: Into<StdError> + Send + 'static,
    {
        type Response = http::Response<tonic::body::BoxBody>;
        type Error = std::convert::Infallible;
        type Future = BoxFuture<Self::Response, Self::Error>;
        fn poll_ready(
            &mut self,
            _cx: &mut Context<'_>,
        ) -> Poll<Result<(), Self::Error>> {
            Poll::Ready(Ok(()))
        }
        fn call(&mut self, req: http::Request<B>) -> Self::Future {
            let inner = self.inner.clone();
            match req.uri().path() {
                "/lightspeed.service.AstroCcdService/GetDevices" => {
                    #[allow(non_camel_case_types)]
                    struct GetDevicesSvc<T: AstroCcdService>(pub Arc<T>);
                    impl<
                        T: AstroCcdService,
                    > tonic::server::UnaryService<
                        super::super::request::GetDevicesRequest,
                    > for GetDevicesSvc<T> {
                        type Response = super::super::response::GetDevicesResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<
                                super::super::request::GetDevicesRequest,
                            >,
                        ) -> Self::Future {
                            let inner = self.0.clone();
                            let fut = async move { (*inner).get_devices(request).await };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let inner = inner.0;
                        let method = GetDevicesSvc(inner);
                        let codec = tonic::codec::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            );
                        let res = grpc.unary(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                "/lightspeed.service.AstroCcdService/SetProperty" => {
                    #[allow(non_camel_case_types)]
                    struct SetPropertySvc<T: AstroCcdService>(pub Arc<T>);
                    impl<
                        T: AstroCcdService,
                    > tonic::server::UnaryService<
                        super::super::request::SetPropertyRequest,
                    > for SetPropertySvc<T> {
                        type Response = super::super::response::SetPropertyResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<
                                super::super::request::SetPropertyRequest,
                            >,
                        ) -> Self::Future {
                            let inner = self.0.clone();
                            let fut = async move {
                                (*inner).set_property(request).await
                            };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let inner = inner.0;
                        let method = SetPropertySvc(inner);
                        let codec = tonic::codec::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            );
                        let res = grpc.unary(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                "/lightspeed.service.AstroCcdService/Expose" => {
                    #[allow(non_camel_case_types)]
                    struct ExposeSvc<T: AstroCcdService>(pub Arc<T>);
                    impl<
                        T: AstroCcdService,
                    > tonic::server::UnaryService<
                        super::super::request::CcdExposureRequest,
                    > for ExposeSvc<T> {
                        type Response = super::super::request::CcdExposureResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<
                                super::super::request::CcdExposureRequest,
                            >,
                        ) -> Self::Future {
                            let inner = self.0.clone();
                            let fut = async move { (*inner).expose(request).await };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let inner = inner.0;
                        let method = ExposeSvc(inner);
                        let codec = tonic::codec::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            );
                        let res = grpc.unary(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                _ => {
                    Box::pin(async move {
                        Ok(
                            http::Response::builder()
                                .status(200)
                                .header("grpc-status", "12")
                                .header("content-type", "application/grpc")
                                .body(empty_body())
                                .unwrap(),
                        )
                    })
                }
            }
        }
    }
    impl<T: AstroCcdService> Clone for AstroCcdServiceServer<T> {
        fn clone(&self) -> Self {
            let inner = self.inner.clone();
            Self {
                inner,
                accept_compression_encodings: self.accept_compression_encodings,
                send_compression_encodings: self.send_compression_encodings,
            }
        }
    }
    impl<T: AstroCcdService> Clone for _Inner<T> {
        fn clone(&self) -> Self {
            Self(self.0.clone())
        }
    }
    impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
            write!(f, "{:?}", self.0)
        }
    }
    impl<T: AstroCcdService> tonic::transport::NamedService
    for AstroCcdServiceServer<T> {
        const NAME: &'static str = "lightspeed.service.AstroCcdService";
    }
}
/// Generated server implementations.
pub mod astro_efw_service_server {
    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
    use tonic::codegen::*;
    ///Generated trait containing gRPC methods that should be implemented for use with AstroEfwServiceServer.
    #[async_trait]
    pub trait AstroEfwService: Send + Sync + 'static {
        async fn get_devices(
            &self,
            request: tonic::Request<super::super::request::GetDevicesRequest>,
        ) -> Result<
            tonic::Response<super::super::response::GetDevicesResponse>,
            tonic::Status,
        >;
        async fn set_property(
            &self,
            request: tonic::Request<super::super::request::SetPropertyRequest>,
        ) -> Result<
            tonic::Response<super::super::response::SetPropertyResponse>,
            tonic::Status,
        >;
        async fn calibrate(
            &self,
            request: tonic::Request<super::super::request::EfwCalibrationRequest>,
        ) -> Result<
            tonic::Response<super::super::response::EfwCalibrationResponse>,
            tonic::Status,
        >;
    }
    #[derive(Debug)]
    pub struct AstroEfwServiceServer<T: AstroEfwService> {
        inner: _Inner<T>,
        accept_compression_encodings: (),
        send_compression_encodings: (),
    }
    struct _Inner<T>(Arc<T>);
    impl<T: AstroEfwService> AstroEfwServiceServer<T> {
        pub fn new(inner: T) -> Self {
            Self::from_arc(Arc::new(inner))
        }
        pub fn from_arc(inner: Arc<T>) -> Self {
            let inner = _Inner(inner);
            Self {
                inner,
                accept_compression_encodings: Default::default(),
                send_compression_encodings: Default::default(),
            }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> InterceptedService<Self, F>
        where
            F: tonic::service::Interceptor,
        {
            InterceptedService::new(Self::new(inner), interceptor)
        }
    }
    impl<T, B> tonic::codegen::Service<http::Request<B>> for AstroEfwServiceServer<T>
    where
        T: AstroEfwService,
        B: Body + Send + 'static,
        B::Error: Into<StdError> + Send + 'static,
    {
        type Response = http::Response<tonic::body::BoxBody>;
        type Error = std::convert::Infallible;
        type Future = BoxFuture<Self::Response, Self::Error>;
        fn poll_ready(
            &mut self,
            _cx: &mut Context<'_>,
        ) -> Poll<Result<(), Self::Error>> {
            Poll::Ready(Ok(()))
        }
        fn call(&mut self, req: http::Request<B>) -> Self::Future {
            let inner = self.inner.clone();
            match req.uri().path() {
                "/lightspeed.service.AstroEfwService/GetDevices" => {
                    #[allow(non_camel_case_types)]
                    struct GetDevicesSvc<T: AstroEfwService>(pub Arc<T>);
                    impl<
                        T: AstroEfwService,
                    > tonic::server::UnaryService<
                        super::super::request::GetDevicesRequest,
                    > for GetDevicesSvc<T> {
                        type Response = super::super::response::GetDevicesResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<
                                super::super::request::GetDevicesRequest,
                            >,
                        ) -> Self::Future {
                            let inner = self.0.clone();
                            let fut = async move { (*inner).get_devices(request).await };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let inner = inner.0;
                        let method = GetDevicesSvc(inner);
                        let codec = tonic::codec::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            );
                        let res = grpc.unary(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                "/lightspeed.service.AstroEfwService/SetProperty" => {
                    #[allow(non_camel_case_types)]
                    struct SetPropertySvc<T: AstroEfwService>(pub Arc<T>);
                    impl<
                        T: AstroEfwService,
                    > tonic::server::UnaryService<
                        super::super::request::SetPropertyRequest,
                    > for SetPropertySvc<T> {
                        type Response = super::super::response::SetPropertyResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<
                                super::super::request::SetPropertyRequest,
                            >,
                        ) -> Self::Future {
                            let inner = self.0.clone();
                            let fut = async move {
                                (*inner).set_property(request).await
                            };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let inner = inner.0;
                        let method = SetPropertySvc(inner);
                        let codec = tonic::codec::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            );
                        let res = grpc.unary(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                "/lightspeed.service.AstroEfwService/Calibrate" => {
                    #[allow(non_camel_case_types)]
                    struct CalibrateSvc<T: AstroEfwService>(pub Arc<T>);
                    impl<
                        T: AstroEfwService,
                    > tonic::server::UnaryService<
                        super::super::request::EfwCalibrationRequest,
                    > for CalibrateSvc<T> {
                        type Response = super::super::response::EfwCalibrationResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<
                                super::super::request::EfwCalibrationRequest,
                            >,
                        ) -> Self::Future {
                            let inner = self.0.clone();
                            let fut = async move { (*inner).calibrate(request).await };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let inner = inner.0;
                        let method = CalibrateSvc(inner);
                        let codec = tonic::codec::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            );
                        let res = grpc.unary(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                _ => {
                    Box::pin(async move {
                        Ok(
                            http::Response::builder()
                                .status(200)
                                .header("grpc-status", "12")
                                .header("content-type", "application/grpc")
                                .body(empty_body())
                                .unwrap(),
                        )
                    })
                }
            }
        }
    }
    impl<T: AstroEfwService> Clone for AstroEfwServiceServer<T> {
        fn clone(&self) -> Self {
            let inner = self.inner.clone();
            Self {
                inner,
                accept_compression_encodings: self.accept_compression_encodings,
                send_compression_encodings: self.send_compression_encodings,
            }
        }
    }
    impl<T: AstroEfwService> Clone for _Inner<T> {
        fn clone(&self) -> Self {
            Self(self.0.clone())
        }
    }
    impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
            write!(f, "{:?}", self.0)
        }
    }
    impl<T: AstroEfwService> tonic::transport::NamedService
    for AstroEfwServiceServer<T> {
        const NAME: &'static str = "lightspeed.service.AstroEfwService";
    }
}