#actix-web #helper #building #service #macro #derive #serwus

macro serwus-derive

Helpers for building actix-web/diesel based services - macros

5 releases

new 0.2.1 Feb 4, 2025
0.2.0 Apr 22, 2024
0.1.2 Jan 9, 2024
0.1.1 Dec 21, 2023
0.1.0 Sep 26, 2023

#49 in #helpers

Download history 10/week @ 2024-10-15 2/week @ 2024-10-22 7/week @ 2024-10-29 19/week @ 2024-11-05 4/week @ 2024-11-12 17/week @ 2024-11-19 30/week @ 2024-11-26 24/week @ 2024-12-03 32/week @ 2024-12-10 31/week @ 2024-12-17 16/week @ 2025-01-07 13/week @ 2025-01-14 13/week @ 2025-01-21 13/week @ 2025-01-28

55 downloads per month
Used in serwus

MIT/Apache

4KB
57 lines

Serwus

Helpers for building actix-web/diesel based services.

crates.io Documentation MIT or Apache 2.0 licensed Dependency Status CI downloads

Features

  • MultiPool - Master/replica-aware wrapper for r2d2
  • StatsPresenter - Framework for readiness and statistics reporting
  • JsonError - Middleware that makes actix-web return errors as JSONs

Example

use actix_web::web;
use serwus::{
    server::{Serwus, default_cors},
    EmptyStats
};

#[derive(Clone, EmptyStats)]
pub struct AppData;

async fn hello() -> &'static str {
    "Hello world\n"
}

#[actix_web::main]
async fn main() -> std::io::Result<()> {
    let prepare_app_data = || AppData;

    Serwus::default()
        .start(
            prepare_app_data,
            |app| {
                app.route("/", web::get().to(hello));
            },
            default_cors,
        )
        .await
}

Dependencies

~210–650KB
~15K SLoC