Skip to main content

Module container

Module container 

Source
Expand description

The service container. Two layers:

  • Typed fields on Container (pool, mailer, cache, queue) — primary mechanism.
  • Typemap for user-registered bindings.

Also exposes a task-local context for facade-style access (cache::get(...)).

Structs§

ConnectionManager
Resolves named connections — the centerpiece of Cast’s multi-database support.
Container
ContainerBuilder
ContainerInner

Traits§

FromContainer
Trait for types that can be resolved from a Container reference.

Functions§

current
Access the current request’s container from anywhere on the request task. Panics if called outside a with_container scope.
try_current
with_container
Run a future with a container installed in task-local context. Used by the per-request middleware so facade-style functions can find the container.

Type Aliases§

Pool
Backward-compat alias: the default Container pool is still sqlx::PgPool. For multi-driver access, use c.driver_pool() (returns cast_core::Pool enum).