Skip to content

Commit ab9f251

Browse files
Merge #154
154: indexmap: expose PowerOfTwo, Bucket and Pos r=japaric a=willem66745 This change allows the create custom structs based on `IndexMap` with size arguments outside the heapless crate itself. For example: ```rust use heapless::consts::*; use heapless::{ArrayLength, Bucket, FnvIndexMap, Pos, PowerOfTwo}; struct CustomMap<S> where S: ArrayLength<Bucket<u8, u16>> + ArrayLength<Option<Pos>> + PowerOfTwo, { map: FnvIndexMap<u8, u16, S>, } impl<S> CustomMap<S> where S: ArrayLength<Bucket<u8, u16>> + ArrayLength<Option<Pos>> + PowerOfTwo, { fn new() -> CustomMap<S> { CustomMap { map: FnvIndexMap::<_, _, S>::new(), } } } fn main() { let mut bla = CustomMap::<U8>::new(); bla.map.insert(8, 16).unwrap(); } ``` I can imagine that exposing these types is not preferable, but at least it would help for my usecase. Or is there a way where exposing these types is not needed? Co-authored-by: Willem <willem66745@gmail.com>
2 parents b265330 + 7a369f3 commit ab9f251

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@
7676
#![deny(warnings)]
7777

7878
pub use binary_heap::BinaryHeap;
79-
pub use generic_array::typenum::consts;
79+
pub use generic_array::typenum::{consts, PowerOfTwo};
8080
pub use generic_array::ArrayLength;
81-
pub use indexmap::{FnvIndexMap, IndexMap};
81+
pub use indexmap::{Bucket, FnvIndexMap, IndexMap, Pos};
8282
pub use indexset::{FnvIndexSet, IndexSet};
8383
pub use linear_map::LinearMap;
8484
pub use string::String;

0 commit comments

Comments
 (0)