Skip to content

Commit

Permalink
comments and renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
k88hudson-cfa committed Oct 22, 2024
1 parent c334e9a commit db2920d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/people.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,12 @@ pub trait PersonProperty: Copy {

type ContextCallback = dyn FnOnce(&mut Context);

// The purpose of this trait is to allow us to store a vector of different PersonProperties
// in an object safe way, and use them to emit change events.
pub trait PersonPropertyHolder {
fn register_event_callback(
// Given a context, person, and a Vec, a callback is added to that Vec which
// can later be called with a new context to emit a change event
fn add_event_callback(
&self,
context: &mut Context,
person: PersonId,
Expand All @@ -78,7 +82,7 @@ impl<T> PersonPropertyHolder for T
where
T: PersonProperty + 'static,
{
fn register_event_callback(
fn add_event_callback(
&self,
context: &mut Context,
person: PersonId,
Expand Down Expand Up @@ -387,7 +391,7 @@ impl ContextPeopleExt for Context {
let mut event_callbacks = Vec::new();
if let Some(mut deps) = deps_temp {
for dep in &mut deps {
dep.register_event_callback(self, person_id, &mut event_callbacks);
dep.add_event_callback(self, person_id, &mut event_callbacks);
}

// Put them back in
Expand Down

0 comments on commit db2920d

Please sign in to comment.