Skip to content

Commit

Permalink
Prepare for 1.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Diggsey committed Jul 5, 2024
1 parent 718b8e9 commit 1f45b34
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aerosol"
version = "1.0.0-alpha.9"
version = "1.0.0"
authors = ["Diggory Blake <diggsey@googlemail.com>"]
edition = "2018"
description = "Simple dependency injection for Rust"
Expand All @@ -18,7 +18,7 @@ axum-extra = ["axum", "dep:axum-extra"]

[dependencies]
parking_lot = "0.12.1"
anymap = { version = "1.0.0-beta.2", features = ["hashbrown"] }
anymap = { package = "anymap3", version = "1.0.0", features = ["hashbrown"] }
async-trait = { version = "0.1", optional = true }
axum = { version = "0.7.5", optional = true }
axum-extra = { version = "0.9.3", optional = true, features = [
Expand Down
2 changes: 1 addition & 1 deletion src/async_constructible.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ macro_rules! impl_async_constructible {

async fn construct_async(aero: &Aero) -> Result<Self, Self::Error> {
let res = $y($t::construct_async(aero).await?);
<$t as IndirectlyAsyncConstructible>::after_construction_async(&res, aero).await?;
<$t as IndirectlyAsyncConstructible>::after_construction_async(&res as &(dyn Any + Send + Sync), aero).await?;
Ok(res)
}

Expand Down
28 changes: 28 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
//! a resource is required it can be accessed infallibly. The `Aero![...]` macro exists to
//! easily name an `Aero` with a specific set of required resources.
//!
//! Cloning or type casting an `Aero` type is cheap (equivalent to cloning an `Arc`).
//!
//! ## Optional features
//!
//! ### `async`
Expand Down Expand Up @@ -122,6 +124,32 @@
//! }
//! }
//! ```
//!
//! ## Implementation details
//!
//! The `Aero` type manages shared ownership of a map from resource types to "slots".
//! For a given resource type, the corresponding "slot" can be in one of three state:
//! 1) Absent.
//! No instance of this resource is present in the map.
//! 2) Present.
//! An instance of this resource exists in the map and can be accessed immediately.
//! 3) Under construction.
//! An instance of this resource is currently under construction, and may be accessed
//! once construction has finished.
//! The slot maintains a list of threads or tasks waiting for this resource to be
//! constructed, and will wake them when the resource becomes available.
//!
//! Resources can be constructed synchronously, or (when the feature is enabled) asynchronously.
//!
//! If a resource is accessed whilst under construction, the caller will wait for construction
//! to complete. The caller determines whether the wait occurs synchronously or asynchronously,
//! depending on whether `obtain()` or `obtain_async()` is used.
//!
//! It is possible (and allowed) for a thread to synchronously wait on a resource being constructed
//! asynchronously in a task, or for a task to asynchronously wait on a resource being synchronously
//! constructed on a thread.
//!
pub use frunk;

#[cfg(feature = "async")]
Expand Down

0 comments on commit 1f45b34

Please sign in to comment.