Skip to content

Glossary: Software Design Patterns in Rust

Constructor injection

Passing a struct the dependencies it needs through its `new` function, so it keeps them instead of creating them. OrderLog::new takes a repo, clock and notifier.

Where the book teaches it

Related terms

Dependency injection