field-injection

Community

Streamline struct dependency injection in Rust.

Authorjymchng
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill addresses the challenge of manually wiring dependencies into Rust structs, providing a structured approach to dependency injection that simplifies the process and reduces errors.

Core Features & Use Cases

  • Automatic Dependency Injection: Automatically inject dependencies into struct fields with #[injectable] attribute.
  • Arc Support: Allows the use of Arc<T> fields with explicit annotation, enabling shared ownership.
  • Constructor Injection: Offers a way to handle non-injectable fields using constructor functions.
  • Use Case: When developing a Rust application with complex dependencies, this Skill can automatically wire up services like databases and caches, reducing boilerplate code and potential errors.

Quick Start

Add the #[injectable] attribute to your struct fields and use the Container::builder().build().await? to resolve dependencies.

Dependency Matrix

Required Modules

None required

Components

scriptsreferences

💻 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: field-injection
Download link: https://github.com/jymchng/injectable/archive/main.zip#field-injection

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 620,000+ vetted skills library on demand.