https://github.com/ohmycloud/rust-design-pattern
rust design pattern
https://github.com/ohmycloud/rust-design-pattern
design-patterns
Last synced: 11 months ago
JSON representation
rust design pattern
- Host: GitHub
- URL: https://github.com/ohmycloud/rust-design-pattern
- Owner: ohmycloud
- Created: 2024-11-23T08:25:51.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-23T08:48:02.000Z (over 1 year ago)
- Last Synced: 2025-07-27T04:13:53.130Z (11 months ago)
- Topics: design-patterns
- Language: Rust
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Design Patterns in Rust
https://siddharthqs.com/design-patterns-in-rust
## Strategy pattern Class Diagram
```markdown
+-----------------------------------------------------------------+
| <> |
| ExecutionStrategy |
|-----------------------------------------------------------------|
| + execute_order(...) |
+-----------------------------------------------------------------+
/|\ /|\ /|\
| | |
| | |
+---------------+ +--------------+ +--------------+
| TwapStrategy | | VwapStrategy | | PovStrategy |
|---------------| |--------------| |--------------|
| | | | | - participation_rate: f64 |
|---------------| |--------------| |--------------|
| + execute_order(...)|+ execute_order(...) |+ execute_order(...)|
+---------------+ +--------------+ +--------------+
+-----------------------------+
| OrderExecutor |
|-----------------------------|
| - strategy: ExecutionStrategy |
|-----------------------------|
| + new(strategy) |
| + set_strategy(strategy) |
| + execute(order_id, quantity) |
+-----------------------------+
```