Function design_pattern_examples_rust::mediator::mediator_exercise
source · pub fn mediator_exercise() -> Result<(), String>
Expand description
Example of using the “Mediator” design pattern.
A mediator is instantiated then populated with users and groups. Users are added to some of the groups. The users handler and the groups handler are completely separate from each other; the mediator only makes it look like they are working on together.
A series of operations are then performed through the mediator. The output shows the results of each operation. Note that all operations are done using user and group names, with no knowledge of the actual lists of users and groups. The mediator hides all the details.