Skip to main content

Crate ntex

Crate ntex 

Source
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:

  • web for HTTP applications and servers
  • client for outgoing HTTP requests
  • http for lower-level HTTP services and message types
  • service for composing services and middleware
  • ws for WebSocket protocol support (enabled by the ws feature)

§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

  • tokio selects the Tokio runtime backend.
  • compio selects the Compio runtime backend.
  • neon-polling and neon-uring select the Neon runtime with the polling reactor on Unix or the io-uring reactor on Linux.
  • ws (default) enables WebSocket support.
  • openssl enables TLS support through OpenSSL.
  • rustls enables TLS support through rustls.
  • compress enables HTTP content compression and decompression (gzip, deflate and zstd).
  • cookie enables HTTP cookie support.
  • no-test-logging disables automatic logging configuration in test.
  • trace enables 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_ready
An implementation of crate::Service::ready that forwards readiness checks to a field.
forward_shutdown
An implementation of crate::Service::shutdown that forwards shutdown checks to a field.

Structs§

Cfg
A typed handle to a value in a SharedCfg.
Ctx
Context provided to Service lifecycle methods.
Error
An error container.
Pipeline
Execution container for a service and its state.
PipelineBinding
An independently registered handle to a Pipeline.
PipelineFactory
Factory for a service pipeline.
SharedCfg
An immutable collection of typed configuration values.

Traits§

IntoService
Conversion into a Service.
IntoServiceFactory
Conversion into a ServiceFactory.
Middleware
Wraps an inner service during service construction.
Service
An asynchronous operation from a request to a response.
ServiceFactory
A factory for asynchronously creating Service values.

Functions§

factory
Starts a ServiceChainFactory with one service factory.
fn_service
Converts an asynchronous function into a Service.
service
Starts a ServiceChain with one service.

Attribute Macros§

main
Runs an async function on the ntex runtime.
test
Runs an async test on the ntex runtime.