Skip to main content

Crate nestrs_core

Crate nestrs_core 

Source

Re-exports§

pub use als::AlsContext;
pub use als::AlsError;
pub use client_ip::best_effort_client_ip;
pub use client_ip::rate_limit_key_ip_or_unknown;
pub use client_ip::trusted_hops_from_parts;
pub use client_ip::RateLimitKey;
pub use client_ip::TrustedProxyHops;
pub use client_ip::X_FORWARDED_FOR;
pub use client_ip::X_REAL_IP;

Modules§

als
Async-local-storage runtime support for the #[als] proc-macro.
client_ip
Client IP resolution shared by the rate limiter and the throttler.

Structs§

AdminSnapshot
A snapshot of the live registries at a point in time. Cloned cheaply via Arc so the admin handler can serve many requests without re-reading the route registry under lock each time.
AuthError
Error produced by AuthStrategy::validate.
AxumHttpEngine
Default engine: Axum Router.
ConfigurableModuleBuilder
Convenience builder for NestJS-like configurable modules (for_root, for_root_async).
DiscoveryService
NestJS DiscoveryService analogue: introspect registered providers and compiled HTTP routes.
DynamicModule
Runtime-composed module unit for conditional imports (feature flags, env switches, plugins).
DynamicModuleBuilder
Builds a DynamicModule from a static module graph, optionally applying provider overrides before controllers are registered (useful for configurable modules and testing-like setups).
ExecutionContext
Cross-cutting context similar to NestJS ExecutionContext / ArgumentsHost for HTTP handlers (RPC/WS can set HostType when wired manually).
HandlerKey
Per-request handle identifying the matched handler (used for metadata lookups).
HttpExecutionArguments
NestJS switchToHttp().getRequest()-style view without storing the full Axum request type.
MetadataRegistry
Global metadata helpers (handler key + metadata key/value).
ModuleOptions
Typed runtime options token for configurable modules.
ModuleRef
NestJS ModuleRef analogue: typed access to the root ProviderRegistry after the application graph is built.
OpenApiResponseDesc
One HTTP response line for OpenAPI generation (per route).
OpenApiRouteSpec
Optional per-route OpenAPI metadata (from #[openapi(...)] / impl_routes! openapi clause).
ProviderRegistry
ProviderSummary
A lightweight (name, scope) view of a registered provider, suitable for serialization. Returned by ProviderRegistry::provider_summaries.
RouteInfo
RouteRegistry
Global route registry (used by OpenAPI generation and diagnostics).
TraceContext
Parsed W3C trace context (traceparent + optional tracestate).

Enums§

GuardError
Failure returned from CanActivate::can_activate; becomes a JSON error body (401 / 403 / 429).
HostType
Active host kind (NestJS ArgumentsHost#getType).
ProviderScope
Provider lifetime semantics (NestJS Scope.DEFAULT / Scope.TRANSIENT / Scope.REQUEST analogues).

Traits§

AuthStrategy
Auth strategy contract similar to Nest’s Passport strategy adapters.
CanActivate
Authorize the request before the handler runs. Declare per-route guard types in the impl_routes! macro: GET "/x" with (A, B) => MyController::handler, — use with () when there are no route guards. For a guard on all routes of a controller, use controller_guards (G) on impl_routes! (see the nestrs crate); that runs outside route-level guards.
Controller
DatabasePing
Minimal health / connectivity check shared by SQL, Prisma, Mongo, and custom drivers.
HttpPipeTransform
Marker trait for pipe types usable in HTTP #[use_pipes]. Adds the Default bound the macro needs to instantiate each pipe at extraction time without going through DI, and constrains Error to std::error::Error so the per-arity extractors can box pipe errors and downcast to HttpException (preserving the per-pipe status code).
HttpServerEngine
Pluggable HTTP engine (NestJS “platform agnostic” idea). Only AxumHttpEngine is implemented today.
Injectable
Application service or provider type constructed through the DI container.
Module
ModuleGraph
Testing-oriented module traversal API.
PipeTransform
Transform one value into another, possibly failing (validation / coercion).
ProviderLifecycle
Lifecycle hooks for value / factory providers — the NestJS pattern of a useValue/useFactory object implementing OnModuleInit & friends.

Functions§

current_ability_erased
Read the type-erased ability for the current task, if one was installed via with_ability_erased (or via nestrs::policies::with_ability, which writes to the same slot). Returns None outside of a scope.
current_principal_erased
Read the type-erased principal for the current task, if one was installed via with_principal_erased (or via nestrs::policies::with_principal, which writes to the same slot). Returns None outside of a scope.
current_trace_context
Read the ambient trace context for the current task, if one was installed via with_trace_context (or by the HTTP middleware).
parse_traceparent
Parse a traceparent header value per the W3C Trace Context spec.
request_scope_get
Look up a value previously inserted into the request scope via request_scope_insert or by the RequestScoped<T> provider. Returns None outside of a request scope.
request_scope_insert
Insert a value into the request scope. Must be called from inside a with_request_scope future; otherwise it’s a no-op.
spawn_with_request_scope
Spawns future on the ambient tokio runtime with the request scope carried over — the supported way to run background work that resolves Request-scoped providers.
with_ability_erased
Run future with the given type-erased ability installed in the per-task ability slot. The caller is responsible for passing an Arc<Ability> (or any other type they want to read back via current_ability_erased).
with_principal_erased
Run future with the given type-erased principal installed in the per-task principal slot. The caller is responsible for passing an Arc<policies::Principal> (or any other type they want to read back via current_principal_erased).
with_request_scope
Runs future inside the request-scoped provider cache (used by request middleware and the transport scope installers).
with_trace_context
Run future with the given trace context installed in the per-task trace slot. Non-HTTP transports (WS gateways, message consumers, MCP hosts) call this directly; the HTTP middleware does it per request.