#![deny(clippy::all)] #![deny(clippy::pedantic)] #![allow(clippy::disallowed_names)] use std::error::Error; use syrette::di_container::blocking::prelude::*; use syrette::injectable; use syrette::ptr::TransientPtr; struct Foo { bar: TransientPtr, } #[injectable] impl Foo { fn new(bar: TransientPtr) -> Self { Self { bar } } } struct Bar { foo: TransientPtr, } #[injectable] impl Bar { fn new(foo: TransientPtr) -> Self { Self { foo } } } fn main() -> Result<(), anyhow::Error> { let mut di_container = DIContainer::new(); di_container.bind::().to::()?; di_container.bind::().to::()?; let foo = di_container.get::()?.transient()?; Ok(()) }