Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
maybe-once
What is this?
maybe-once offers a variation of OnceLock that keeps track of the number of references to the internal data
and drops it every time the references counter goes to 0.
Why is this useful?
In Rust static variables are not dropped when the program terminates. This is a problem when you need to initialize a shared resource that must be dropped when it is no longer used or when the process terminates. This happens, for example, when you a have a common resource to be used by a set of integration tests, and you want it to be dropped when the tests terminates.
Check the examples to see how to use it with docker and testcontainers.
Usage examples
Usage with tokio
The tokio feature of this crate allows you to use the optional MaybeOnceAsync object to initialize a shared resource using an async function.
Why #[tokio_shared::test] instead of #[tokio::test]?
#[tokio::test] spins up a brand-new runtime for every test. This causes issues that when you have multiple tests that need to access the same resource, the resource is dropped and recreated multiple times.
The #[tokio_shared::test] attribute (enabled by the tokio feature) fixes this by running all tests on a single, process-wide multi-threaded tokio runtime shared by every annotated test.