cgp
OfficialWiring CGP components for Rust contexts.
System Documentation
What problem does it solve?
CGP provides a structured approach to dependency injection in Rust by moving interface constraints into impl blocks and using type-level tables to map components to providers per context. This enables multiple provider implementations for the same interface and allows swapping behavior by context without changing the consumer code.
Core Features & Use Cases
- Type-level components and providers enable modular wiring that adapts to different contexts.
- DelegateComponent tables map a provider to a concrete implementation for a given context, enabling pluggable behavior.
- Blanket trait delegation and impl-side dependencies hide the wiring complexity behind clean trait interfaces.
- Typical use cases include building context-specific plug-ins, testing with mock providers, and composing complex behavior across modules.
Quick Start
Define a CGP component with #[cgp_component], supply a provider with #[cgp_provider], and wire it to a context using delegate_components! or a DelegateComponent table. Then instantiate a concrete context and call the consumer method to observe the delegated provider in action.
Dependency Matrix
Required Modules
None requiredComponents
💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: cgp Download link: https://github.com/contextgeneric/cgp-skills/archive/main.zip#cgp Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.