hyperlane-core 23.3.0

A lightweight, high-performance, and cross-platform Rust HTTP server library built on Tokio. It simplifies modern web service development by providing built-in support for middleware, WebSocket, Server-Sent Events (SSE), and raw TCP communication. With a unified and ergonomic API across Windows, Linux, and MacOS, it enables developers to build robust, scalable, and event-driven network applications with minimal overhead and maximum flexibility.
Documentation
use super::*;

/// State machine for a single inline-or-boxed [`ServerHook`] invocation.
pub(crate) enum InlinePollState {
    /// The concrete future has not yet been constructed in pinned storage.
    Uninit,
    /// The concrete future lives directly in `InlineHookCall::storage`.
    Inline {
        /// Polls the in-place future stored at the storage base address.
        poll_fn: InlinePollFn,
        /// Drops the in-place future stored at the storage base address.
        drop_fn: unsafe fn(*mut u8),
    },
    /// The concrete future exceeded the inline slot size and was boxed.
    Boxed(FutureBox<Status>),
    /// The future completed or was dropped.
    Done,
}

/// Result of fused construction and first poll of an inline [`ServerHook`] future.
pub(crate) enum InlineStartOutcome {
    /// The future completed synchronously on its first poll and has already been dropped.
    Ready(Status),
    /// The future returned `Poll::Pending` and remains pinned in caller inline storage.
    PendingInline {
        /// Polls the in-place future stored at the storage base address.
        poll_fn: InlinePollFn,
        /// Drops the in-place future stored at the storage base address.
        drop_fn: unsafe fn(*mut u8),
    },
    /// The future exceeded inline storage capacity and returned `Poll::Pending` while boxed.
    PendingBoxed(FutureBox<Status>),
}

/// Dispatch representation of a registered hook resolved once at server startup.
#[derive(Clone)]
pub(crate) enum CompiledHook {
    /// Hook created via [`Hook::factory`] that can be started inline without `Box::pin`.
    Inline(InlineStartFn),
    /// Arbitrary user-supplied [`ServerHookHandler`] closure.
    Dynamic(ServerHookHandler),
}