Next
mach::Next
Description
Section titled “Description”Invokes the next middleware in the pipeline.
Header
Section titled “Header”#include <mach/middleware/Next.hpp>Syntax
Section titled “Syntax”class Next {
public: explicit Next(std::function<void()> next);
Next(const Next&) = delete; Next& operator=(const Next&) = delete;
void operator()();};Operators
Section titled “Operators”| Name | Description |
|---|---|
operator() |
Invokes the next step in the middleware pipeline. |
Thread Safety
Section titled “Thread Safety”Not thread-safe. Concurrent access to the same Next instance must be synchronized externally.
Remarks
Section titled “Remarks”Nextinstances are provided by Mach during middleware execution.- A
Nextinstance is valid only for the duration of the current middleware invocation. - Each
Nextinstance may be invoked at most once.
Example
Section titled “Example”class LoggingMiddleware {
public: void invoke(mach::Context& context, mach::Next& next) { logger.info("Handling request.");
next();
logger.info("Request completed."); }};See Also
Section titled “See Also”| Name | Description |
|---|---|
Context |
Provides access to the current HTTP request and response. |