tcplane 8.1.0

tcplane is a lightweight and high-performance Rust TCP server library designed to simplify network service development. It supports TCP communication, data stream management, and connection handling, focusing on providing efficient low-level network connections and data transmission capabilities, making it ideal for building modern network services.
Documentation
use crate::*;

/// Implementation of server hook handler factory functions.
/// Creates a server hook handler factory from a type implementing `ServerHook`.
///
/// # Arguments
///
/// - `ServerHook` - The hook type that implements `ServerHook`.
///
/// # Returns
///
/// - `ServerHookHandler` - A boxed handler function.
pub fn server_hook_factory<H>() -> ServerHookHandler
where
    H: ServerHook,
{
    Arc::new(|ctx: Context| {
        Box::pin(async move {
            let hook: H = H::new(&ctx).await;
            hook.handle(&ctx).await;
        })
    })
}