Skip to main content

Module plugins

Module plugins 

Source
Expand description

Third-party plugin ecosystem.

A plugin owns a corner of the framework’s behaviour without forking the core crate: register global routes, mutate the OpenAPI spec, attach global interceptors, spawn background tasks under graceful shutdown.

§Object safety

ArclyPlugin uses the erased-type pattern: each lifecycle hook returns a BoxFuture instead of async fn, so the trait stays object-safe and we can hold Vec<Box<dyn ArclyPlugin>>.

§Opaque context

ArclyPluginContext exposes a small, framework-typed API for the things plugins legitimately need to do. Axum / Tower types are private; the public methods all speak in arcly types (RequestContext, Response).

§Deferred construction

Plugins register handler factories rather than routes directly. At launch time, once the frozen DI container exists, App::launch invokes each factory with the real &'static FrozenDiContainer and mounts the resulting axum route. This sidesteps any unsoundness from materialising the container before it’s built.

Structs§

ArclyPluginContext
PluginError

Enums§

PluginStage

Traits§

ArclyPlugin
Plugin lifecycle.

Type Aliases§

PluginHandler
A typed handler usable from plugin-registered routes. Takes a RequestContext, returns a Response.