2025-07-03 21:53:34 -04:00
|
|
|
pub type UserData = crate::user::User;
|
2025-07-01 20:04:11 -04:00
|
|
|
pub type PacketData = crate::handler::EventData;
|
|
|
|
|
|
|
|
|
|
#[async_trait::async_trait]
|
|
|
|
|
pub trait EventCodeHandler: Send + Sync {
|
2025-07-06 17:36:52 -04:00
|
|
|
async fn handle(&self, data: &bytes::Bytes, peer: &std::sync::Arc<literustlib_server::Connection<PacketData>>, user: &UserData, sender: &std::sync::Arc<literustlib_server::DataSender<PacketData>>);
|
2025-07-01 20:04:11 -04:00
|
|
|
}
|
2025-07-03 21:53:34 -04:00
|
|
|
|
|
|
|
|
pub trait EventCode: EventCodeHandler {
|
|
|
|
|
const CODE: i16;
|
|
|
|
|
}
|
2025-07-06 17:36:52 -04:00
|
|
|
|
|
|
|
|
#[async_trait::async_trait]
|
|
|
|
|
pub trait RobotMotionHandler: Send + Sync {
|
|
|
|
|
async fn handle(&self, data: &bytes::Bytes, user: &UserData);
|
|
|
|
|
}
|
2025-07-21 22:33:12 -04:00
|
|
|
|
|
|
|
|
pub trait Broadcastable: byteserde::ser_heap::ByteSerializeHeap + core::any::Any + Send + Sync + 'static {}
|