polariton_server 0.6.0

Server functionality for the Photon packet system
Documentation
pub struct Ack<const CODE: u8, U: Send + Sync> {
    _user_ty: std::marker::PhantomData<U>,
}

#[cfg_attr(feature = "async", async_trait::async_trait)]
impl <C: Send + Sync + 'static, const CODE: u8, U: Send + Sync> super::Operation<C> for Ack<CODE, U> {
    type User = U;

    fn handle(&self, _: polariton::operation::ParameterTable<C>, _: &Self::User) -> polariton::operation::OperationResponse<C> {
        polariton::operation::OperationResponse {
            code: CODE,
            return_code: 0,
            message: polariton::operation::Typed::Null,
            params: std::collections::HashMap::default().into(),
        }
    }

    #[cfg(feature = "async")]
    async fn handle_async(&self, p: polariton::operation::ParameterTable<C>, u: &Self::User) -> polariton::operation::OperationResponse<C> {
        self.handle(p, u)
    }
}

impl <const CODE: u8, U: Send + Sync> super::OperationCode for Ack<CODE, U> {
    fn op_code() -> u8 {
        CODE
    }
}

impl <const CODE: u8, U: Send + Sync> std::default::Default for Ack<CODE, U> {
    fn default() -> Self {
        Self {
            _user_ty: Default::default(),
        }
    }
}