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: multi_class_model.rs
    path of file: ./repos/linfa/src/composing
    
    the code of the file until where you have to start completion: //! Merge models with binary to multi-class classification
//!
use crate::dataset::{Pr, Records};
use crate::traits::PredictInplace;
use ndarray::{Array1, ArrayBase, Data, Ix2};
use std::iter::FromIterator;

type MultiClassVec<R, L> = 
    
    fn predict_inplace(&self, arr: &ArrayBase<D, Ix2>, y: &mut Array1<L>) {
        assert_eq!(
            arr.nrows(),
            y.len(),
            "The number of data points must match the number of output targets."
        );

        let mut res = Vec::new();

        for pairs in self.models.iter().map(|(elm, model)| {
            let mut targets = Array1::default(arr.nrows());
            model.predict_inplace(arr, &mut targets);

            targets.into_iter().map(|x| (elm.clone(), *x)).collect()
        }) {
            // initialize result with guess of first model
            if res.is_empty() {
                res = pairs;
                continue;
            }

            // compare probability to each subsequent model and replace label
            // if probability is higher
            res = res
                .into_iter()
                .zip(pairs.into_iter())
                .map(|(c, d)| if d.1 > c.1 { d } else { c })
                .collect();
        }

        // remove probabilities from array and convert to `Array1`
        for (r, target) in res.into_iter().zip(y.iter_mut()) {
            *target = r.0;
        }
    }