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.
Sourcepub fn add_route<F, Fut>(
&mut self,
method: HttpMethod,
path: &'static str,
handler: F,
)
pub fn add_route<F, Fut>( &mut self, method: HttpMethod, path: &'static str, 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.
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: &'static str) -> Result<String, PluginError>
pub fn require_env(&self, key: &'static 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 route registered via the macros. Plugin routes opt in separately if they want it.
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> 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> 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> 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::Request