{"id":13440264,"url":"https://github.com/oltdaniel/zap","last_synced_at":"2025-03-20T09:32:43.655Z","repository":{"id":57672794,"uuid":"105514989","full_name":"oltdaniel/zap","owner":"oltdaniel","description":":zap: fast http framework for rust","archived":true,"fork":false,"pushed_at":"2018-04-13T14:54:57.000Z","size":39,"stargazers_count":51,"open_issues_count":1,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-14T17:02:33.782Z","etag":null,"topics":["efficiency","http","rust","web-framework"],"latest_commit_sha":null,"homepage":"https://docs.rs/zap","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oltdaniel.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-02T08:54:05.000Z","updated_at":"2023-01-28T17:39:49.000Z","dependencies_parsed_at":"2022-08-31T11:14:25.217Z","dependency_job_id":null,"html_url":"https://github.com/oltdaniel/zap","commit_stats":null,"previous_names":["oldaniel/zap"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oltdaniel%2Fzap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oltdaniel%2Fzap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oltdaniel%2Fzap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oltdaniel%2Fzap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oltdaniel","download_url":"https://codeload.github.com/oltdaniel/zap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244585959,"owners_count":20476849,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["efficiency","http","rust","web-framework"],"created_at":"2024-07-31T03:01:21.171Z","updated_at":"2025-03-20T09:32:43.361Z","avatar_url":"https://github.com/oltdaniel.png","language":"Rust","readme":"# `zap` :zap:\n\n[![GitHub issues](https://img.shields.io/github/issues/oltdaniel/zap.svg)](https://github.com/oltdaniel/zap/issues)\n[![Travis](https://img.shields.io/travis/oltdaniel/zap.svg)](https://travis-ci.org/oltdaniel/zap)\n[![GitHub stars](https://img.shields.io/github/stars/oltdaniel/zap.svg?style=social\u0026label=Stars)](https://github.com/oltdaniel/zap)\n[![Crates.io](https://img.shields.io/crates/d/zap.svg)](https://crates.io/crates/zap)\n[![Crates.io](https://img.shields.io/crates/v/zap.svg)](https://crates.io/crates/zap)\n\nThe mission of `zap` is, to deliver a basic, but fast rust web server library.\n\n[Documentation](https://docs.rs/zap/)\n\n## About\n\n**This code is based on tokio's minihttp project, so a big thanks to them.** ([source](https://github.com/tokio-rs/tokio-minihttp))\n\n\nThe goal of this project is, to show how fast Rust can be. It isn't made for huge complex applications, just a test project for benchmark reasons.\n\n## How to use\n\nAdd the following to your `Cargo.toml`:\n```toml\n[dependencies]\nzap = \"0.0.4\"\n```\n\n## Speed\n\nSo `zap` is not only fast, it is wapping **2.96** times faster than [iron](https://github.com/iron/iron), which is based on [hyper](https://github.com/hyperium/hyper). Benchmarks below:\n\n### Benchmark Code\n\n**Iron**\n\nThis code had been taken from the [ironframework.io](http://ironframework.io) webpage.\n\n```rust\nextern crate iron;\n\nuse iron::prelude::*;\nuse iron::status;\n\nfn main() {\n    fn hello_world(_: \u0026mut Request) -\u003e IronResult\u003cResponse\u003e {\n        Ok(Response::with((status::Ok, \"Hello World!\")))\n    }\n\n    Iron::new(hello_world).http(\"localhost:3000\").unwrap();\n}\n```\n\n**Zap**\n\nThis example can be run, by:\n\n```\n$ git clone https://github.com/oltdaniel/zap \u0026\u0026 cd zap\n$ cargo run --example hello-world --release\n```\n\n```rust\nextern crate zap;\n\nuse std::io::Error as ZapError;\nuse zap::prelude::*;\n\nstruct HelloWorld;\n\nimpl Handler for HelloWorld {\n    type Request = Request;\n    type Response = Response;\n    type Error = ZapError;\n    type Future = ZapResult;\n\n    fn call(\u0026self, _: Request) -\u003e ZapResult {\n        let mut resp = Response::new();\n\n        resp.body(\"Hello World!\");\n\n        resp.ok()\n    }\n}\n\nfn main() {\n    let addr = \"0.0.0.0:8080\".parse().unwrap();\n    let mut server = Server::new(Http, addr);\n    server.threads(8);\n    server.serve(|| Ok(HelloWorld));\n}\n```\n\n### Benchmark Results\n\nThe benchmark results have been computed with this command: `wrk -t16 -c500 -d10s http://127.0.0.1:8080 --latency`\n\nTechnical details about the server:\n\n- Intel Core I7-6700K, hyper-threaded\n- 16GB RAM, 2400MHZ\n\nDetailed results: [in the wiki](https://github.com/oltdaniel/zap/wiki/Benchmarks).\n\n**Iron**\n\n```\n[...]\nRequests/sec: 307581.17\nTransfer/sec:     33.44MB\n```\n\n**Zap**\n\n```\n[...]\nRequests/sec: 912832.31\nTransfer/sec:     40.90MB\n```\n\n## Credits \u0026 License\n\n[Daniel Oltmanns](https://github.com/oltdaniel) \u0026 [others](https://github.com/oltdaniel/zap/graphs/contributors)\n\n_Basically do what you'd like to._\n\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/oltdaniel/zap/blob/master/LICENSE)\n","funding_links":[],"categories":["Libraries","库 Libraries"],"sub_categories":["Web programming","web编程 Web programming"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foltdaniel%2Fzap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foltdaniel%2Fzap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foltdaniel%2Fzap/lists"}