refactor: enhance handler traits to support dynamic sizing and improve cancellation handling

This commit is contained in:
GW_MC
2026-06-01 10:04:09 +00:00
parent 9991b20b28
commit d6a829c529
4 changed files with 118 additions and 55 deletions

View File

@@ -17,14 +17,14 @@ pub trait OnConfigUpdateHandler: Send + Sync + 'static {
pub struct HandlerImpl<OCH>
where
OCH: OnConfigUpdateHandler,
OCH: OnConfigUpdateHandler + ?Sized,
{
on_config_update_handler: Arc<OCH>,
}
impl<OCH> HandlerImpl<OCH>
where
OCH: OnConfigUpdateHandler,
OCH: OnConfigUpdateHandler + ?Sized,
{
pub fn new(on_config_update_handler: Arc<OCH>) -> Self {
Self {
@@ -36,7 +36,7 @@ where
#[async_trait::async_trait]
impl<OCH> MasterMessageHandler for HandlerImpl<OCH>
where
OCH: OnConfigUpdateHandler,
OCH: OnConfigUpdateHandler + ?Sized,
{
async fn handle_master_message(&self, message: MasterMessage) -> MessageResult<()> {
match message.payload {