Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A simple, idiomatic, and lightweight dependency injection framework for Rust.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
NotificationsYou must be signed in to change notification settings

Leandros/ferrunix

Repository files navigation

A simple, idiomatic, and lightweightdependency injection framework for Rust.

Build StatusCrates.ioAPI referenceMSRVLicense

[dependencies]ferrunix ="0.3"

Compiler support: requires rustc 1.67.1+

Check out theUser Guide.

Documentation

Due to how the various features affect the public API of the library, thedocumentation is provided for each major feature separately.

Feature FlagsLink to Documentation
nonelink to docs
multithreadlink to docs
tokiolink to docs

Features

  • Can register and inject any type (incl. generics, types must beSend if themultithread feature is enabled, andSend + Sync iftokio is enabled).
  • Simple and elegant Rust API; making the derive macro purely optional.
  • Different dependency lifetimes:
    • Singleton: Only a single instance of the object is created.
    • Transient: A new instance is created for every request.
  • Dependency resolution happens at run time, making it possible to dynamicallyregister types.
  • Injection of concrete value types (T),Box<T>,Rc<T>, andArc<T>.
  • Derive macro (#[derive(Inject)]) to simplify registration.
  • Automatic registration of types, thanks toinventory.
  • One global registry; with support for multiple sub-registries.

Cargo Feature Flags

Ferrunix has the following features to enable further functionality.Features enabled by default are marked with*.

  • multithread: Enables support for accessing the registry from multiplethreads. This adds a bound that all registered types must beSend.
  • derive (*): Enables support for the#[derive(Inject)] macro.
  • tokio: Enables support forasync constructors. Bumps the MSRV up to1.75.0 because some of the internal traits requireRPITIT.
  • tracing: Enables support fortracing and annotates all public functions withtracing::instrument.

Support

Development of ferrunix is sponsored byRagnarLab. RagnarLab is a Rust consultancy based in Stuttgart, Germany. We provide Rust development from prototype to product, helping you write safer software.Interested in Rust? Get in touch with us.

License

Licensed under either ofApache License, Version2.0 orMIT license at your option.
By contributing to this project (for example, through submitting a pullrequest) you agree with theindividualcontributor license agreement. Make sure to read and understand it.

About

A simple, idiomatic, and lightweight dependency injection framework for Rust.

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Languages


[8]ページ先頭

©2009-2025 Movatter.jp