Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LinearMap: add LinearMapView, similar to VecView #479

Closed

Conversation

sosthene-nitrokey
Copy link
Contributor

While implementing I realized that &mut LinearMap does not implement IntoIter. Should I add it ? 

I currently did not add it to LinearMapView either for symmetry, but that can lead to confusion. For example, the following doesn't compile:

use heapless::{LinearMap, LinearMapView};

let mut map: LinearMap<_, _, 8> = LinearMap::new();
let map_view: &mut LinearMapView<_, _> = &mut map;

for (key, val) in map_view {
    println!("key: {} val: {}", key, val);
}

The fix is to use instead

for (key, val) in &*map_view {

@sosthene-nitrokey
Copy link
Contributor Author

replaced by #491

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant