You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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>
0 commit comments