ntex provides a strongly typed component for building asynchronous network applications. It includes HTTP/1, HTTP/2, WebSocket, Mqtt3/5, Amqp1.0, TLS, and runtime-independent I/O support.
Build status
| Platform | Status |
|---|---|
| Linux | |
| macOS | |
| Windows |
Usage
Add ntex to your project:
[]
= "4"
A minimal web server looks like this:
use ;
async
async
Runtime selection
Without an explicit runtime feature, ntex uses its native single-threaded runtime and automatically selects a platform I/O reactor:
- Linux tries
io_uringand falls back to polling. - Other Unix platforms use polling.
- Windows uses IOCP.
Alternative runtimes and native reactors can be selected with Cargo features:
| Feature | Runtime or reactor |
|---|---|
tokio |
Tokio local runtime and I/O driver |
compio |
Compio runtime and completion-based I/O |
neon-polling |
Native runtime with the polling reactor |
neon-uring |
Native runtime with io_uring on Linux |
neon-iocp |
Native runtime with IOCP on Windows |
Enable at most one runtime or native-reactor selection feature. For example:
[]
= { = "4", = ["tokio"] }
Optional features
opensslandrustlsenable the corresponding TLS integrations.compressenables HTTP content compression.cookieenables cookie support.urlenables URL parsing support.wsenables WebSocket APIs and is enabled by default.
Documentation and community
- Framework guide
- Web framework documentation
- API documentation
- Examples
- Release changes
- Minimum supported Rust version: 1.97
License
This project is licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)