Rename the message system's 'data' argument to 'context' (#2872)

This commit is contained in:
Keavon Chambers
2025-07-12 22:50:59 -07:00
committed by GitHub
parent 4c75ddf936
commit 765092fbe9
68 changed files with 674 additions and 615 deletions
+4 -5
View File
@@ -2,15 +2,14 @@ pub use crate::dispatcher::*;
use crate::messages::prelude::*;
/// Implements a message handler struct for a separate message struct.
/// - The first generic argument (`M`) is that message struct type, representing a message enum variant to be matched and handled in `process_message()`.
/// - The second generic argument (`D`) is the type of data that can be passed along by the caller to `process_message()`.
pub trait MessageHandler<M: ToDiscriminant, D>
/// - The first type argument (`M`) is that message struct type, representing a message enum variant to be matched and handled in `process_message()`.
/// - The second type argument (`C`) is the type of the context struct that can be passed along by the caller to `process_message()`.
pub trait MessageHandler<M: ToDiscriminant, C>
where
M::Discriminant: AsMessage,
<M::Discriminant as TransitiveChild>::TopParent: TransitiveChild<Parent = <M::Discriminant as TransitiveChild>::TopParent, TopParent = <M::Discriminant as TransitiveChild>::TopParent> + AsMessage,
{
/// Return true if the Action is consumed.
fn process_message(&mut self, message: M, responses: &mut VecDeque<Message>, data: D);
fn process_message(&mut self, message: M, responses: &mut VecDeque<Message>, context: C);
fn actions(&self) -> ActionList;
}