Expand description
A framework for composable network services.
ntex provides a single-threaded service framework, HTTP client and server implementations, a web application framework, and WebSocket support.
The most commonly used entry points are:
webfor HTTP applications and serversclientfor outgoing HTTP requestshttpfor lower-level HTTP services and message typesservicefor composing services and middlewarewsfor WebSocket protocol support (enabled by thewsfeature)
The framework guide explains these pieces in depth.
Rules and templates for LLM-generated code are in
llms.txt.
§Runtime selection
ntex uses its native Neon runtime by default. Enable tokio or compio to
use the corresponding runtime backend. The neon-polling and neon-uring
features select a specific native I/O reactor, Windows always uses IOCP.
§Crate features
tokioselects the Tokio runtime backend.compioselects the Compio runtime backend.neon-pollingandneon-uringselect the Neon runtime with the polling reactor on Unix or the io-uring reactor on Linux.ws(default) enables WebSocket support.opensslenables TLS support through OpenSSL.rustlsenables TLS support through rustls.compressenables HTTP content compression and decompression (gzip, deflate and zstd).cookieenables HTTP cookie support.no-test-loggingdisables automatic logging configuration intest.traceenables additional trace-level logging.
Re-exports§
pub use urly as url;
Modules§
- channel
- Asynchronous communication primitives.
- client
- HTTP client.
- codec
- Utilities for encoding and decoding frames.
- connect
- TCP connector services.
- error
- Error types and helpers.
- http
- HTTP protocol support.
- io
- IO streaming utilities.
- router
- Resource path matching library.
- rt
- Runtime APIs for running tasks on the current thread.
- server
- General-purpose TCP server APIs.
- service
- Service, service factory, and middleware abstractions.
- task
- Task wake-up and scheduling utilities.
- testing
- IO testing utilities.
- time
- Utilities for tracking time.
- tls
- TLS support for ntex ecosystem.
- util
- Common byte, collection, future, and service utilities.
- web
- Web application framework.
- ws
- WebSocket protocol support.
Macros§
- forward
- Forwards
crate::Service::bind,crate::Service::ready, andcrate::Service::shutdownto inner service fields.
Structs§
- BindCtx
- Initialization-only access to a service’s readiness dependencies.
- Cfg
- A typed handle to a value in a
SharedCfg. - Ctx
- Context provided to
Servicelifecycle methods. - Error
- An error container.
- Pipeline
- Execution container for a service and its state.
- Pipeline
Binding - An independently registered handle to a
Pipeline. - Pipeline
Factory - Factory for a service pipeline.
- Shared
Cfg - An immutable collection of typed configuration values.
Traits§
- Into
Service - Conversion into a
Service. - Into
Service Factory - Conversion into a
ServiceFactory. - Middleware
- Wraps an inner service during service construction.
- Service
- An asynchronous operation from a request to a response.
- Service
Factory - A factory for asynchronously creating
Servicevalues.
Functions§
- factory
- Starts a
ServiceChainFactorywith one service factory. - fn_
service - Converts an asynchronous function into a
Service. - service
- Starts a
ServiceChainwith one service.