pub struct ArclyPluginContext { /* private fields */ }Implementations§
Source§impl ArclyPluginContext
impl ArclyPluginContext
Sourcepub fn provide<T: Send + Sync + 'static>(&mut self, value: T)
pub fn provide<T: Send + Sync + 'static>(&mut self, value: T)
Inject a singleton of type T into the DI container. Resolves later
via Inject<T> in any controller / service / interceptor.
Order: every plugin’s on_init runs first, then all provide<T>
closures are applied in declaration order, then the container
freezes. So one plugin can read another’s provision in on_start
but not in on_init.
If T already has an #[Injectable] provider, launch fails loudly —
use override_provider to replace it
intentionally.
Sourcepub fn override_provider<T: Send + Sync + 'static>(&mut self, value: T)
pub fn override_provider<T: Send + Sync + 'static>(&mut self, value: T)
Replace a core #[Injectable] provider with this instance. The
descriptor is discarded; every Inject<T> in the app resolves to the
plugin’s value. Happens before the container freezes, so the swap is
race-free and the hot path stays lock-free.
Sourcepub fn add_interceptor(&mut self, ic: impl Interceptor)
pub fn add_interceptor(&mut self, ic: impl Interceptor)
Attach a boundary filter that runs on every request before the
body is read — the cheap early-reject point for signature checks,
IP allowlists, and rate limits. Returning Break(resp) short-circuits
without paying for body buffering or context assembly.
Ergonomic twin of Self::register_global_interceptor: takes ownership
and leaks internally (interceptors are process-lifetime objects) —
no Box::leak ceremony in plugin code.
Sourcepub fn add_boundary_filter(&mut self, f: impl BoundaryFilter)
pub fn add_boundary_filter(&mut self, f: impl BoundaryFilter)
Ergonomic twin of Self::register_boundary_filter: takes ownership and
leaks internally.
pub fn register_boundary_filter(&mut self, f: &'static dyn BoundaryFilter)
Sourcepub fn add_route<F, Fut>(
&mut self,
method: HttpMethod,
path: impl Into<String>,
handler: F,
)
pub fn add_route<F, Fut>( &mut self, method: HttpMethod, path: impl Into<String>, handler: F, )
Register a route. The handler receives a fully-built RequestContext
— including DI access via ctx.inject::<T>() — and returns a
Response. The path is mounted verbatim under the application root.
The path may be built at runtime (e.g. a config-driven prefix); it is
leaked to &'static str, which is fine because routes live for the
whole process anyway.
Sourcepub fn add_get<F, Fut>(&mut self, path: impl Into<String>, handler: F)
pub fn add_get<F, Fut>(&mut self, path: impl Into<String>, handler: F)
Shortcut: register a GET.
Sourcepub fn modify_openapi<F>(&mut self, f: F)
pub fn modify_openapi<F>(&mut self, f: F)
Mutate the assembled OpenAPI document at launch time.
Sourcepub fn require_env(&self, key: &str) -> Result<String, PluginError>
pub fn require_env(&self, key: &str) -> Result<String, PluginError>
Read a required environment variable.
Returns Err(PluginError) with stage Init if the variable is absent
or contains non-UTF-8 bytes, so callers can propagate it cleanly with ?.
Sourcepub fn env_or(&self, key: &str, default: impl Into<String>) -> String
pub fn env_or(&self, key: &str, default: impl Into<String>) -> String
Read an environment variable with a fallback default.
Sourcepub fn register_global_interceptor(&mut self, ic: &'static dyn Interceptor)
pub fn register_global_interceptor(&mut self, ic: &'static dyn Interceptor)
Attach an interceptor that fires on every mounted route — macro
routes and plugin-registered routes alike. Global interceptors compose
as the outermost layers, in registration order (first registered =
outermost), around any per-route #[UseInterceptors] chain.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ArclyPluginContext
impl !Sync for ArclyPluginContext
impl !UnwindSafe for ArclyPluginContext
impl Freeze for ArclyPluginContext
impl Send for ArclyPluginContext
impl Unpin for ArclyPluginContext
impl UnsafeUnpin for ArclyPluginContext
Blanket Implementations§
Source§impl<T> AggregateExpressionMethods for T
impl<T> AggregateExpressionMethods for T
Source§fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
DISTINCT modifier for aggregate functions Read moreSource§fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
ALL modifier for aggregate functions Read moreSource§fn aggregate_filter<P>(self, f: P) -> Self::Output
fn aggregate_filter<P>(self, f: P) -> Self::Output
Source§fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
self to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
&self to an expression for Diesel’s query builder. Read more