diff --git a/crates/fj-core/src/layers/objects.rs b/crates/fj-core/src/layers/objects.rs index d4e6badc0..121d60dc2 100644 --- a/crates/fj-core/src/layers/objects.rs +++ b/crates/fj-core/src/layers/objects.rs @@ -15,7 +15,7 @@ impl Layer { validation: &mut Layer, ) { let mut events = Vec::new(); - self.process(ObjectsCommand::InsertObject { object }, &mut events); + self.process(InsertObject { object }, &mut events); for event in events { validation.process(event, &mut Vec::new()); @@ -23,28 +23,6 @@ impl Layer { } } -/// Command for `Layer` -#[derive(Debug)] -pub enum ObjectsCommand { - /// Insert an object into the stores - /// - /// This is the one primitive operation that all other operations are built - /// upon. - InsertObject { - /// The object to insert - object: AnyObject, - }, -} - -impl Command for ObjectsCommand { - type Event = InsertObject; - - fn decide(self, _: &Objects, events: &mut Vec) { - let ObjectsCommand::InsertObject { object } = self; - events.push(InsertObject { object }); - } -} - /// Insert an object into the stores /// /// Event produced by `Layer`. @@ -54,6 +32,14 @@ pub struct InsertObject { pub object: AnyObject, } +impl Command for InsertObject { + type Event = InsertObject; + + fn decide(self, _: &Objects, events: &mut Vec) { + events.push(self); + } +} + impl Event for InsertObject { fn evolve(&self, state: &mut Objects) { self.object.clone().insert(state);