Skip to content

v1.1.0

Latest

Choose a tag to compare

@nehcuh nehcuh released this 08 Sep 06:17

What's changed

Adopt v2 DI container as the default implementation and remove legacy v1. Align code, tests, and docs accordingly.

Highlights

  • DI v2 lifecycles: Singleton / Transient / Scoped
  • Minimal scope management with per-scope caches
  • Simplified registration APIs (register_*_simple)
  • Synchronous statistics (ContainerStats: total/hit_rate/cache_hits/cache_misses)
  • Remove legacy v1 module; container/mod.rs re-exports v2 + ServiceLifetime

Code & Tests

  • Migrate tests/examples to v2 APIs; remove ServiceProvider usage in tests
  • Relax one perf threshold to <= 2µs to reduce environment flakiness
  • Update provider.rs to use v2 registration and unify errors to CreationFailed

Docs

  • ARCHITECTURE: add new section “依赖注入容器(v2)”
  • README: add DI v2 quick usage example; fix Tree-sitter troubleshooting
  • IMPLEMENTATION_STATUS: mark DI v2 as completed

Breaking changes

  • Public DI re-exports now point to v2 (ServiceContainer, ContainerError). Some v1-only APIs (e.g., async stats, performance summary) were simplified/removed.

Quality gates

  • cargo fmt — clean
  • cargo clippy --workspace --all-targets --all-features -- -D warnings — clean
  • cargo test --all-features — all tests pass

Migration notes

  • Prefer simplified registration APIs or closures that accept &ServiceContainer returning Result<T, Box<dyn Error + Send + Sync>>.
  • Scoped behavior validated by value equality; if strict pointer-equality is needed, open an issue for a follow-up tweak to the scope cache.