{"id":15994809,"url":"https://github.com/jamesmunns/bbqueue","last_synced_at":"2025-05-15T21:07:32.544Z","repository":{"id":45388750,"uuid":"163627223","full_name":"jamesmunns/bbqueue","owner":"jamesmunns","description":"A SPSC, lockless, no_std, thread safe, queue, based on BipBuffers","archived":false,"fork":false,"pushed_at":"2024-12-10T10:11:50.000Z","size":218,"stargazers_count":458,"open_issues_count":27,"forks_count":55,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-05-09T03:44:23.185Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jamesmunns.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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}},"created_at":"2018-12-31T00:26:47.000Z","updated_at":"2025-05-09T03:26:37.000Z","dependencies_parsed_at":"2024-06-18T22:53:15.405Z","dependency_job_id":"19ff2648-b61b-4bd6-aa09-2c1b215a5fa4","html_url":"https://github.com/jamesmunns/bbqueue","commit_stats":{"total_commits":122,"total_committers":11,"mean_commits":"11.090909090909092","dds":"0.10655737704918034","last_synced_commit":"f73423c0b1c5fe04723e5b5bd57d1a44ff106473"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesmunns%2Fbbqueue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesmunns%2Fbbqueue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesmunns%2Fbbqueue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesmunns%2Fbbqueue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamesmunns","download_url":"https://codeload.github.com/jamesmunns/bbqueue/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254422764,"owners_count":22068678,"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":"2024-10-08T07:10:21.490Z","updated_at":"2025-05-15T21:07:32.524Z","avatar_url":"https://github.com/jamesmunns.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# BBQueue\n\n[![Documentation](https://docs.rs/bbqueue/badge.svg)](https://docs.rs/bbqueue)\n\nBBQueue, short for \"BipBuffer Queue\", is a Single Producer Single Consumer,\nlockless, no_std, thread safe, queue, based on [BipBuffers]. For more info on\nthe design of the lock-free algorithm used by bbqueue, see [this blog post].\n\nFor a 90 minute guided tour of BBQueue, you can also view this [guide on YouTube].\n\n[guide on YouTube]: https://www.youtube.com/watch?v=ngTCf2cnGkY\n[BipBuffers]: https://www.codeproject.com/Articles/3479/%2FArticles%2F3479%2FThe-Bip-Buffer-The-Circular-Buffer-with-a-Twist\n[this blog post]: https://ferrous-systems.com/blog/lock-free-ring-buffer/\n\nBBQueue is designed (primarily) to be a First-In, First-Out queue for use with DMA on embedded\nsystems.\n\nWhile Circular/Ring Buffers allow you to send data between two threads (or from an interrupt to\nmain code), you must push the data one piece at a time. With BBQueue, you instead are granted a\nblock of contiguous memory, which can be filled (or emptied) by a DMA engine.\n\n## Local usage\n\n```rust\n// Create a buffer with six elements\nlet bb: BBBuffer\u003c6\u003e = BBBuffer::new();\nlet (mut prod, mut cons) = bb.try_split().unwrap();\n\n// Request space for one byte\nlet mut wgr = prod.grant_exact(1).unwrap();\n\n// Set the data\nwgr[0] = 123;\n\nassert_eq!(wgr.len(), 1);\n\n// Make the data ready for consuming\nwgr.commit(1);\n\n// Read all available bytes\nlet rgr = cons.read().unwrap();\n\nassert_eq!(rgr[0], 123);\n\n// Release the space for later writes\nrgr.release(1);\n```\n\n## Static usage\n\n```rust, no_run\nuse bbqueue::BBBuffer;\n\n// Create a buffer with six elements\nstatic BB: BBBuffer\u003c6\u003e = BBBuffer::new();\n\nfn main() {\n    // Split the bbqueue into producer and consumer halves.\n    // These halves can be sent to different threads or to\n    // an interrupt handler for thread safe SPSC usage\n    let (mut prod, mut cons) = BB.try_split().unwrap();\n\n    // Request space for one byte\n    let mut wgr = prod.grant_exact(1).unwrap();\n\n    // Set the data\n    wgr[0] = 123;\n\n    assert_eq!(wgr.len(), 1);\n\n    // Make the data ready for consuming\n    wgr.commit(1);\n\n    // Read all available bytes\n    let rgr = cons.read().unwrap();\n\n    assert_eq!(rgr[0], 123);\n\n    // Release the space for later writes\n    rgr.release(1);\n\n    // The buffer cannot be split twice\n    assert!(BB.try_split().is_err());\n}\n```\n\nThe `bbqueue` crate is located in `core/`, and tests are located in `bbqtest/`.\n\n## Features\n\nBy default BBQueue uses atomic operations which are available on most platforms. However on some\n(mostly embedded) platforms atomic support is limited and with the default features you will get\na compiler error about missing atomic methods.\n\n\n# License\n\nLicensed under either of\n\n- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or\n  http://www.apache.org/licenses/LICENSE-2.0)\n\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesmunns%2Fbbqueue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamesmunns%2Fbbqueue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesmunns%2Fbbqueue/lists"}