{"id":28547596,"url":"https://github.com/rust-bakery/nom-bufreader","last_synced_at":"2025-07-24T14:10:48.490Z","repository":{"id":45475752,"uuid":"392780788","full_name":"rust-bakery/nom-bufreader","owner":"rust-bakery","description":"BufReader adapter for nom parsers","archived":false,"fork":false,"pushed_at":"2023-03-19T11:15:16.000Z","size":32,"stargazers_count":11,"open_issues_count":8,"forks_count":6,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-07-08T02:14:18.968Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/rust-bakery.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-08-04T17:49:17.000Z","updated_at":"2025-01-28T01:05:46.000Z","dependencies_parsed_at":"2025-07-08T01:32:16.700Z","dependency_job_id":"d61fbced-7fe6-4d8d-a653-5fe207d51714","html_url":"https://github.com/rust-bakery/nom-bufreader","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/rust-bakery/nom-bufreader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-bakery%2Fnom-bufreader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-bakery%2Fnom-bufreader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-bakery%2Fnom-bufreader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-bakery%2Fnom-bufreader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rust-bakery","download_url":"https://codeload.github.com/rust-bakery/nom-bufreader/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-bakery%2Fnom-bufreader/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265452825,"owners_count":23768020,"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":[],"created_at":"2025-06-10T00:37:25.515Z","updated_at":"2025-07-15T19:06:31.385Z","avatar_url":"https://github.com/rust-bakery.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nom-bufreader, adapters for BufReader around nom\n\n**/!\\Work in progress, if you put it in production, you fix it/!\\**\n\nWith this crate, you can assemble a nom parser with a `BufReader` alternative, synchronous or asynchronous.\nDue to incompatible buffering strategies, [std::io::BufReader](https://doc.rust-lang.org/stable/std/io/struct.BufReader.html)\nand [futures::io::BufReader](https://docs.rs/futures/0.3.16/futures/io/struct.BufReader.html)\ncannot be used directly. This crate proovide compatible forks instead, in the\n`bufreader` and `async_bufreader` modules.\n\nIt will hide for you the [Incomplete](https://docs.rs/nom/7.0.0/nom/enum.Err.html#variant.Incomplete) handling in nom for streaming parsers, retrying and refilling buffers automatically.\n\n## Examples\n\n### sync\n\n```rust\nuse nom_bufreader::bufreader::BufReader;\nuse nom_bufreader::{Error, Parse};\nuse std::{net::TcpListener, str::from_utf8};\n\nfn main() -\u003e Result\u003c(), Error\u003c()\u003e\u003e {\n    let listener = TcpListener::bind(\"127.0.0.1:8080\")?;\n    let mut i = BufReader::new(listener.incoming().next().unwrap()?);\n\n    // method, space and path are nom parsers\n    let m = i.parse(method)?;\n    let _ = i.parse(space)?;\n    let p = i.parse(path)?;\n    println!(\"got method {}, path {}\", m, p);\n    Ok(())\n}\n```\n\n### async\n\n#### tokio\n\n```rust\nuse nom_bufreader::async_bufreader::BufReader;\nuse nom_bufreader::{AsyncParse, Error};\nuse std::str::from_utf8;\nuse tokio_util::compat::TokioAsyncReadCompatExt;\nuse tokio::net::TcpListener;\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Error\u003c()\u003e\u003e {\n    let listener = TcpListener::bind(\"127.0.0.1:8080\").await?;\n    let mut i = BufReader::new(listener.accept().await?.0.compat());\n\n    let m = i.parse(method).await?;\n    let _ = i.parse(space).await?;\n    let p = i.parse(path).await?;\n    println!(\"got method {}, path {}\", m, p);\n    Ok(())\n}\n```\n\n#### async-std\n\n```rust\nuse nom_bufreader::async_bufreader::BufReader;\nuse nom_bufreader::{AsyncParse, Error};\nuse std::str::from_utf8;\nuse async_std::net::TcpListener;\n\n#[async_std::main]\nasync fn main() -\u003e Result\u003c(), Error\u003c()\u003e\u003e {\n    let listener = TcpListener::bind(\"127.0.0.1:8080\").await?;\n    let mut i = BufReader::new(listener.accept().await?.0);\n\n    let m = i.parse(method).await?;\n    let _ = i.parse(space).await?;\n    let p = i.parse(path).await?;\n    println!(\"got method {}, path {}\", m, p);\n    Ok(())\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-bakery%2Fnom-bufreader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frust-bakery%2Fnom-bufreader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-bakery%2Fnom-bufreader/lists"}