lxy 0.1.1

A convenient async http and RPC framework in Rust
Documentation
mod error;
mod factory;
mod raw;
mod resolver;

use std::sync::Arc;

use crate::error::Result;
pub use error::*;
pub use factory::{BoxedFactory, Factory, Value, ValueFactory};
pub use raw::*;
pub use resolver::{BoxedResolver, Resolver};

/// A container trait for type registration and resolution.
pub trait Container {
  /// Registers a factory for creating instances of type `T`.
  fn add<F, T, Deps>(&mut self, factory: F)
  where
    F: Factory<T, Deps>,
    T: 'static,
    Deps: 'static;

  fn bind<T>(&mut self, instance: T)
  where
    T: 'static;

  /// Resolves an instance of type `T` from the container.
  fn get<T>(&self) -> Result<Arc<T>>
  where
    T: 'static;

  /// Drops the instance of type `T` from the container.
  fn drop<T>(&mut self)
  where
    T: 'static;
}