Getting MidiInputMap object from MidiAccess Object

I have a m = MidiAccess Object and can successfully access m.inputs(), however how do I access/iterate the midi_inputs variable here:

                        let midi: Result<MidiAccess, JsValue> = m.dyn_into();
                        let midi_access = midi.unwrap();
                        let midi_inputs_map: Result<MidiInputMap,MidiInputMap> = midi_access.inputs().dyn_into();
                        let midi_inputs: MidiInputMap = midi_inputs_map.unwrap();

I tried the following with no success:

for input in midi_inputs {

}

Thanks!

Assuming you're talking about web_sys::MidiInputMap, it doesn't implement IntoIterator, so you can't loop over it like that. Looks like it's a JS Map, and it has AsRef<Object>, and you can get map entries from that, so you might be able to do

for input in midi_inputs.as_ref().values().iter() {
    ...
}

Since midi_inputs is a map, you might need entries() instead of values() if the keys are important; I'm not familiar with the Web API MIDI stuff.

Thanks! I get this error on compile:

for input in &midi_inputs.as_ref().values().iter() {
^^^^^^ cannot infer type for T

Try

for input in js_sys::Object::values(&midi_inputs).iter() {
    ...
}

Looks like values isn't a method.

Thank you, that compiled!