eclectic
eclectic copied to clipboard
Experimental collection traits for Rust
Should it implement `List`? Should we add the following method (and/or a corresponding associated type or associated const) to `List`? ``` rust fn is_random_access(&self) -> bool; ```
This would enable node-based collections to directly embed trait objects. For example: ``` rust struct Node { left: Option, right: Option, item: T, } pub struct Heap { root: Option,...
- `Collection` - [x] `capacity` - [x] `into_vec` - [ ] `reserve_exact` - [x] `with_capacity` - `List` - [x] `reverse` - [ ] `sort` - [ ] `split_at(_mut)`* - `Set`...
The current design is nonsensical. With some future-Rust features, we could have: ``` rust pub trait EntryMap: Map { type Occupied: Vacant; fn entry Entry>; } pub enum Entry where...
The former doesn't own its keys, and the latter doesn't own its items, but it probably requires higher-kinded types to be able to deal with these in the iteration methods.