rustapi-core

Crates.iorustapi-core
lib.rsrustapi-core
version0.1.207
created_at2025-12-30 14:50:29.569871+00
updated_at2026-01-26 00:02:28.91734+00
descriptionThe core engine of the RustAPI framework. Provides the hyper-based HTTP server, router, extraction logic, and foundational traits.
homepagehttps://github.com/Tuntii/RustAPI
repositoryhttps://github.com/Tuntii/RustAPI
max_upload_size
id2012762
size773,350
Tunay (Tuntii)

documentation

https://docs.rs/rustapi-core

README

RustAPI Core

The internal engine of the RustAPI framework.

⚠️ Warning: Most users should depend on rustapi-rs instead of using this crate directly. This crate's API is subject to change to support the higher-level facade.

Overview

rustapi-core handles the low-level HTTP mechanics, leveraging the best-in-class Rust async ecosystem:

  • Hyper 1.0: For robust, correct HTTP/1 and HTTP/2 implementation.
  • Matchit: For extremely fast URL routing (radix tree based).
  • Tower: For middleware composition (Service, Layer).
  • Tokio: For the async runtime.

Key Concepts

The RustApi Builder

Responsible for assembling routes, middleware, and starting the Hyper server.

The Handler Trait

The magic that allows functions with arbitrary arguments (extractors) to be used as request handlers.

// This function...
async fn my_handler(Json(body): Json<MyData>) -> impl Responder { ... }

// ...is converted into a Tower Service via the Handler trait.

Extractors

FromRequest and FromRequestParts traits are defined here. They allow type-safe extraction of data from HTTP requests.

  • Json<T>
  • Query<T>
  • Path<T>
  • State<T>
Commit count: 208

cargo fmt