Skip to content
This repository was archived by the owner on Jan 4, 2026. It is now read-only.

Commit d4c2706

Browse files
authored
Lots of docs, API cleanup (#4)
This adds: * Accessor functions on the handle to get producer/consumers, which is useful for preserving the `BbqHandle` generic when you're holding a handle * Adds a ton of docs * Adds real error types for grants * Adds CI This is going to be the 0.3 release very shortly.
1 parent bb5cb65 commit d4c2706

19 files changed

Lines changed: 636 additions & 316 deletions

File tree

.github/workflows/build.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Build and Test
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
workflow_dispatch:
9+
10+
jobs:
11+
miri:
12+
name: "Build all crates"
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Install embedded target
17+
# Note: once https://github.com/hawkw/mycelium/pull/538 lands we can test on
18+
# thumbv6m-none-eabi
19+
run: rustup target add thumbv7em-none-eabi
20+
#
21+
# BUILD + TEST
22+
#
23+
# no features, on std
24+
- name: Check bbq2 (no features, on host)
25+
run: cargo build --no-default-features
26+
# default features, on std
27+
- name: Check bbq2 (default features, on host)
28+
run: cargo build
29+
# std features, on std
30+
- name: Check bbq2 (std features, on host)
31+
run: cargo build --features=std
32+
# std features, on std, test
33+
- name: Test bbq2 (std features, on host)
34+
run: cargo test --features=std
35+
36+
# no features, on mcu
37+
- name: Check bbq2 (no features, on mcu)
38+
run: cargo build --no-default-features --target=thumbv7em-none-eabi
39+
# default features, on mcu
40+
- name: Check bbq2 (no features, on mcu)
41+
run: cargo build --target=thumbv7em-none-eabi
42+

.github/workflows/miri.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Run miri tests
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
workflow_dispatch:
9+
10+
jobs:
11+
miri:
12+
name: "miri all the things"
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Install miri component
17+
run: rustup component add --toolchain nightly-x86_64-unknown-linux-gnu miri
18+
#
19+
# crate
20+
#
21+
- name: Miri test bbq2
22+
run: ./miri.sh

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ categories = [
1515
license = "MIT OR Apache-2.0"
1616

1717
[dependencies]
18+
const-init = "1.0.0"
1819

1920
[dependencies.maitake-sync]
2021
version = "0.2"
@@ -33,19 +34,18 @@ features = ["macros", "rt", "time"]
3334
[features]
3435
default = [
3536
"cas-atomics",
36-
"std",
3737
"maitake-sync-0_2",
3838
"critical-section",
39-
# "tokio-sync",
4039
]
40+
4141
cas-atomics = []
4242
critical-section = [
4343
"dep:critical-section",
4444
]
45+
disable-cache-padding = [
46+
"maitake-sync?/no-cache-pad",
47+
]
4548
std = []
46-
# tokio-sync = [
47-
# "dep:tokio",
48-
# ]
4949
maitake-sync-0_2 = [
5050
"dep:maitake-sync",
5151
]

miri.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
# We disable isolation because we use tokio sleep
4+
# We disable leaks because ???
5+
#
6+
# TODO: Can we eliminate some of these limitations for testing?
7+
MIRIFLAGS="-Zmiri-disable-isolation -Zmiri-ignore-leaks" \
8+
cargo +nightly miri test \
9+
--target x86_64-unknown-linux-gnu \
10+
--features=std

src/lib.rs

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,32 @@
1-
#![allow(clippy::result_unit_err)]
1+
//! bbq2
2+
//!
3+
//! A new and improved bipbuffer queue.
4+
25
#![cfg_attr(not(any(test, feature = "std")), no_std)]
36

7+
/// Type aliases for different generic configurations
8+
///
49
pub mod nicknames;
10+
11+
/// Producer and consumer interfaces
12+
///
513
pub mod prod_cons;
14+
15+
/// Queue storage
16+
///
617
pub mod queue;
18+
19+
/// Generic traits
20+
///
721
pub mod traits;
822

9-
#[cfg(test)]
23+
/// Re-export of external types/traits
24+
///
25+
pub mod export {
26+
pub use const_init::ConstInit;
27+
}
28+
29+
#[cfg(all(test, feature = "std"))]
1030
mod test {
1131
use core::{ops::Deref, time::Duration};
1232

@@ -212,5 +232,7 @@ mod test {
212232
// todo: timeouts
213233
rxfut.await.unwrap();
214234
txfut.await.unwrap();
235+
236+
drop(bbq);
215237
}
216238
}

src/nicknames.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
//! | Heap | Atomic | Async | No | Tandoori | India |
2020
//! | Heap | Atomic | Async | Yes | Lechon | Philippines |
2121
22+
#![allow(unused_imports)]
23+
2224
#[cfg(feature = "std")]
2325
use crate::queue::ArcBBQueue;
2426
#[cfg(feature = "cas-atomics")]

0 commit comments

Comments
 (0)