Module design_pattern_examples_rust::facade
source · Expand description
The Facade design pattern example module
The Facade pattern is used when a simplified version of an interface on a complicated sub-system is needed in situations where the whole complicated sub-system does not need to be exposed.
In this example, the complicated subsystem is a representation of a device network complete with scan chains, device idcodes, and device devices that can be selected and deselected. The Facade exposed by this complex network exposes only the scan chain, getting device idcodes based on an index into those scan chains, resetting the scan chains and selecting a device to appear in the scan chain.
Accessed through the facade_exercise() function.
Modules
- Contains the implementation of the complicated facade sub-system.
- Contains the DeviceNetworkHighLevel struct that wraps the low-level complicated facade sub-system and which is exposed by the IDeviceNetworkHighLevel trait.
- Contains the IDeviceNetworkHighLevel trait that represents a simplified view of a complicated facade sub-system.
- Contains the IDeviceNetworkLowLevel trait that represents the complicated facade sub-system.
Functions
- Helper function to present a formatted list of idcodes for a particular device chain. The output is on a single line.
- Example of using the “Facade” pattern.