You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: proximity.rs
    path of file: ./repos/tock/capsules/extra/src
    
    the code of the file until where you have to start completion: // Licensed under the Apache License, Version 2.0 or the MIT License.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// Copyright Tock Contributors 2022.

//! Provides userspace with access to proximity sensors.
//!
//! Userspace Interface
//! -------------------
//!
//! ### `subscribe` System Call
//!
//! The `subscribe` system call supports the single `subscribe_number` zero,
//! which is used to provide a callback that will return back the result of
//! a proximity reading.
//! The `subscribe`call return codes indicate the following:
//!
//! * `Ok(())`: the callback been successfully been configured.
//! * `ENOSUPPORT`: Invalid allow_num.
//!
//!
//! ### `command` System Call
//!
//! The `command` system call support one argument `cmd` which is used to specify the specific
//! operation, currently the following cmd's are supported:
//!
//! * `0`: driver existence check
//! * `1`: read proximity
//! * `2`: read proximity on interrupt
//!
//!
//! The possible return from the 'command' system call indicates the following:
//!
//! * `Ok(())`:    The operation has been successful.
//! * `BUSY`:      The driver is busy.
//! * `
    
    fn run_next_command(&self) -> Result<(), ErrorCode> {
        // Find thresholds before entering any grant regions
        let t: Thresholds = self.find_thresholds();
        // Find and run another command
        for cntr in self.apps.iter() {
            let break_flag = cntr.enter(|app, _| {
                if app.subscribed {
                    // run it
                    match app.enqueued_command_type {
                        ProximityCommand::ReadProximity => {
                            let _ = self.driver.read_proximity();
                            self.command_running.set(ProximityCommand::ReadProximity);
                        }
                        ProximityCommand::ReadProximityOnInterrupt => {
                            let _ = self.driver.read_proximity_on_interrupt(t.lower, t.upper);
                            self.command_running
                                .set(ProximityCommand::ReadProximityOnInterrupt);
                        }
                        ProximityCommand::NoCommand => {}
                    }
                    true
                } else {
                    false
                }
            });

            if break_flag {
                break;
            }
        }

        Ok(())
    }