From 6d771161d1b7852be3fb1363bee3b97b890dae50 Mon Sep 17 00:00:00 2001 From: Christian Eltzschig Date: Wed, 13 Nov 2024 11:48:41 +0100 Subject: [PATCH] [#504] Add SlotMap requirements to the documentation --- iceoryx2-bb/container/src/slotmap.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/iceoryx2-bb/container/src/slotmap.rs b/iceoryx2-bb/container/src/slotmap.rs index 98ee89beb..08653b4d7 100644 --- a/iceoryx2-bb/container/src/slotmap.rs +++ b/iceoryx2-bb/container/src/slotmap.rs @@ -21,6 +21,16 @@ //! * [`RelocatableSlotMap`](crate::slotmap::RelocatableSlotMap), run-time fixed-size slotmap that //! is shared-memory compatible. //! +//! The SlotMap shall satisfy the following requirements: +//! +//! * A new element can be inserted with a max runtime of `O(1)` +//! * A new element can be inserted at a user-provided key with a max runtime of `O(1)` +//! * An element can be removed by providing the corresponding key with a max runtime of `O(1)` +//! * One can iterate over all elements of the SlotMap. +//! +//! The SlotMap is the perfect container when elements shall be added, removed and accesses quickly +//! but iteration is allowed to be slow. +//! //! # User Examples //! //! ```