Module advanced_binding_examples

Module advanced_binding_examples 

Source
Expand description

Advanced Binding Examples for IOC Phase 4

This module demonstrates the advanced binding features including:

  • Interface-to-implementation mapping
  • Named services and tagging
  • Conditional binding (environment, features, profiles)
  • Factory patterns and lazy initialization
  • Generic type support
  • Collection resolution

Structs§

HybridCache
Hybrid cache that uses both Redis and Memory
LocalStorage
Local file storage
MemoryCache
In-memory cache implementation
RedisCache
Redis cache implementation
S3Storage
S3 cloud storage
SendGridEmailService
SendGrid email service
SmtpEmailService
SMTP email service

Traits§

Cache
Cache interface for different storage backends
EmailService
Email service interface
Storage
Storage interface

Functions§

demonstrate_advanced_binding_features
Example usage demonstration
example_collection_binding
Example 6: Collection bindings for plugin architecture
example_complex_conditions
Example 7: Complex multi-condition binding
example_custom_condition_binding
Example 4: Custom condition binding
example_environment_based_binding
Example 1: Multiple implementations with environment-based selection
example_factory_patterns
Example 5: Factory patterns and lazy initialization
example_feature_flag_binding
Example 2: Feature flag based service selection
example_profile_based_binding
Example 3: Profile-based configuration