Merge pull request #587 from sgued/fix-docs

Fix broken tests and update CI to test more features
This commit is contained in:
Soso 2025-08-18 09:43:10 +00:00 committed by GitHub
commit 331aac897a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 12 additions and 7 deletions

View File

@ -48,7 +48,7 @@ jobs:
components: miri components: miri
- name: Run miri - name: Run miri
run: MIRIFLAGS=-Zmiri-ignore-leaks cargo miri test run: MIRIFLAGS=-Zmiri-ignore-leaks cargo miri test --features="alloc,defmt,mpmc_large,portable-atomic-critical-section,serde,ufmt,bytes"
# Run cargo test # Run cargo test
test: test:
@ -84,7 +84,7 @@ jobs:
toolchain: stable toolchain: stable
- name: Run cargo test - name: Run cargo test
run: cargo test run: cargo test --features="alloc,defmt,mpmc_large,portable-atomic-critical-section,serde,ufmt,bytes"
# Run cargo fmt --check # Run cargo fmt --check
style: style:

View File

@ -61,13 +61,13 @@ mod tests {
#[test] #[test]
#[should_panic] #[should_panic]
fn buf_mut_advance_mut_out_of_bounds_view() { fn buf_mut_advance_mut_out_of_bounds_view() {
let vec: &mut VecView<u8, u8> = &mut Vec::<u8, 8>::new(); let vec: &mut VecView<u8, u8> = &mut Vec::<u8, 8, u8>::new();
unsafe { vec.advance_mut(9) }; unsafe { vec.advance_mut(9) };
} }
#[test] #[test]
fn buf_mut_remaining_mut_view() { fn buf_mut_remaining_mut_view() {
let vec: &mut VecView<u8, u8> = &mut Vec::<u8, 8>::new(); let vec: &mut VecView<u8, u8> = &mut Vec::<u8, 8, u8>::new();
assert_eq!(vec.remaining_mut(), 8); assert_eq!(vec.remaining_mut(), 8);
vec.push(42).unwrap(); vec.push(42).unwrap();
assert_eq!(vec.remaining_mut(), 7); assert_eq!(vec.remaining_mut(), 7);
@ -75,7 +75,7 @@ mod tests {
#[test] #[test]
fn buf_mut_chunk_mut_view() { fn buf_mut_chunk_mut_view() {
let vec: &mut VecView<u8, u8> = &mut Vec::<u8, 8>::new(); let vec: &mut VecView<u8, u8> = &mut Vec::<u8, 8, u8>::new();
assert_eq!(vec.chunk_mut().len(), 8); assert_eq!(vec.chunk_mut().len(), 8);
unsafe { vec.advance_mut(1) }; unsafe { vec.advance_mut(1) };
assert_eq!(vec.chunk_mut().len(), 7); assert_eq!(vec.chunk_mut().len(), 7);

View File

@ -3,6 +3,7 @@
//! # Example usage //! # Example usage
//! //!
//! ``` //! ```
//! use core::ptr::addr_of_mut;
//! use heapless::{arc_pool, pool::arc::{Arc, ArcBlock}}; //! use heapless::{arc_pool, pool::arc::{Arc, ArcBlock}};
//! //!
//! arc_pool!(MyArcPool: u128); //! arc_pool!(MyArcPool: u128);
@ -45,6 +46,7 @@
//! to the `ArcPool`. This requires an intermediate `const` value as shown below: //! to the `ArcPool`. This requires an intermediate `const` value as shown below:
//! //!
//! ``` //! ```
//! use core::ptr::addr_of_mut;
//! use heapless::{arc_pool, pool::arc::ArcBlock}; //! use heapless::{arc_pool, pool::arc::ArcBlock};
//! //!
//! arc_pool!(MyArcPool: u128); //! arc_pool!(MyArcPool: u128);
@ -54,7 +56,7 @@
//! let blocks: &'static mut [ArcBlock<u128>] = { //! let blocks: &'static mut [ArcBlock<u128>] = {
//! const BLOCK: ArcBlock<u128> = ArcBlock::new(); // <= //! const BLOCK: ArcBlock<u128> = ArcBlock::new(); // <=
//! static mut BLOCKS: [ArcBlock<u128>; POOL_CAPACITY] = [BLOCK; POOL_CAPACITY]; //! static mut BLOCKS: [ArcBlock<u128>; POOL_CAPACITY] = [BLOCK; POOL_CAPACITY];
//! unsafe { addr_of_mut!(BLOCK).as_mut().unwrap()S } //! unsafe { addr_of_mut!(BLOCKS).as_mut().unwrap() }
//! }; //! };
//! //!
//! for block in blocks { //! for block in blocks {

View File

@ -61,6 +61,7 @@
//! to the `BoxPool`. This requires an intermediate `const` value as shown below: //! to the `BoxPool`. This requires an intermediate `const` value as shown below:
//! //!
//! ``` //! ```
//! use core::ptr::addr_of_mut;
//! use heapless::{box_pool, pool::boxed::BoxBlock}; //! use heapless::{box_pool, pool::boxed::BoxBlock};
//! //!
//! box_pool!(MyBoxPool: u128); //! box_pool!(MyBoxPool: u128);

View File

@ -3,6 +3,7 @@
//! # Example usage //! # Example usage
//! //!
//! ``` //! ```
//! use core::ptr::addr_of_mut;
//! use heapless::{object_pool, pool::object::{Object, ObjectBlock}}; //! use heapless::{object_pool, pool::object::{Object, ObjectBlock}};
//! //!
//! object_pool!(MyObjectPool: [u8; 128]); //! object_pool!(MyObjectPool: [u8; 128]);
@ -46,6 +47,7 @@
//! to the `ObjectPool`. This requires an intermediate `const` value as shown below: //! to the `ObjectPool`. This requires an intermediate `const` value as shown below:
//! //!
//! ``` //! ```
//! use core::ptr::addr_of_mut;
//! use heapless::{object_pool, pool::object::ObjectBlock}; //! use heapless::{object_pool, pool::object::ObjectBlock};
//! //!
//! object_pool!(MyObjectPool: [u8; 128]); //! object_pool!(MyObjectPool: [u8; 128]);
@ -55,7 +57,7 @@
//! let blocks: &'static mut [ObjectBlock<[u8; 128]>] = { //! let blocks: &'static mut [ObjectBlock<[u8; 128]>] = {
//! const BLOCK: ObjectBlock<[u8; 128]> = ObjectBlock::new([0; 128]); // <= //! const BLOCK: ObjectBlock<[u8; 128]> = ObjectBlock::new([0; 128]); // <=
//! static mut BLOCKS: [ObjectBlock<[u8; 128]>; POOL_CAPACITY] = [BLOCK; POOL_CAPACITY]; //! static mut BLOCKS: [ObjectBlock<[u8; 128]>; POOL_CAPACITY] = [BLOCK; POOL_CAPACITY];
//! unsafe { addr_of_mut!(BLOCK).as_mut().unwrap()S } //! unsafe { addr_of_mut!(BLOCKS).as_mut().unwrap() }
//! }; //! };
//! //!
//! for block in blocks { //! for block in blocks {