dyn-provider

Registers external types for dependency injection in Rust applications.

Updated May 10, 2026
One-click install
npx skills add https://github.com/jymchng/injectable --skill dyn-provider
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dyn-provider
Source: https://github.com/jymchng/injectable/tree/main/skills/dyn-provider
Command: npx skills add https://github.com/jymchng/injectable --skill dyn-provider

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires injectable, and includes scripts (resource) components.

What problem does it solve?

DynProvider Skill simplifies the registration and management of external types within the dependency injection framework, allowing for more flexible and dynamic dependencies.

Core Features & Use Cases

  • External Type Registration: Dynamically register external types (sync, async, with-context, from-value) using a token string for each registration.
  • Token-Based Providers: Differentiate between multiple providers of the same type using distinct tokens (e.g., "primary"/"replica" pools).
  • Use Case: In a microservices architecture, use DynProvider to register different database pools for primary and replica services, managing their lifecycles and configurations separately.

Quick Start

Register a sync DynProvider with a default token:

use injectable::prelude::*;

Container::builder()
    .register("", DynProvider::sync(|| {
        Ok(reqwest::Client::new())
    }))
    .build().await?;

Frequently Asked Questions about dyn-provider

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I register external types for dependency injection in Rust?

External type registration for dependency injection in Rust is handled by dynamically registering types using a token string. This supports sync, async, and contextual registration to manage flexible dependencies within your application.

How does token-based management work for dependency injection providers?

Token-based management differentiates between multiple providers of the same external type using distinct token strings. For example, you can assign "primary" and "replica" tokens to manage separate database pools within a microservices architecture.

Do I need the injectable library to use DynProvider?

Yes, the injectable library is required for operation. You must use the injectable prelude within your Rust application to build the container and register your DynProvider instances successfully.

Can I register asynchronous external types for dependency injection?

Yes, asynchronous external type registration is fully supported. The DynProvider Skill allows you to register sync, async, with-context, and from-value external types for dependency injection using the injectable framework.

What is the best way to manage separate database pools in a Rust microservices architecture?

Using token-based providers is the best way to manage separate database pools in a Rust microservices architecture. You can register different external types for primary and replica services, managing their configurations and lifecycles independently.

Why does my dependency injection container fail to register external types?

Registration of external types fails if the injectable library is not included. Ensure you import the injectable prelude and pass a valid token string when registering your DynProvider within the container builder.