pub fn sort_values(vm: &mut Vm, arr: &mut [Value]) -> Result<(), RuntimeError> {
    let mut error = None;

    arr.sort_by(|a, b| {
        if error.is_some() {
            return Ordering::Equal;
        }

        match compare_values(vm, a, b) {
            Ok(ordering) => ordering,
            Err(e) => {
                error.get_or_insert(e);
                Ordering::Equal
            }
        }
    });

    if let Some(err) = error {
        return Err(err);
    }

    Ok(())
}
/// Sorts values in a slice using Koto operators for comparison.
Sorts values in a slice using Koto operators for comparison.
Sorts values in a slice using Koto operators for comparison .
pub fn sort_values(vm: &mut Vm, arr: &mut [Value]) -> Result<(), RuntimeError> {
    let mut error = None;
    arr.sort_by(|a, b| {
        if error.is_some() {
            return Ordering::Equal;
        }
        match compare_values(vm, a, b) {
            Ok(ordering) => ordering,
            Err(e) => {
                error.get_or_insert(e);
                Ordering::Equal
            }
        }
    });
    if let Some(err) = error {
        return Err(err);
    }
    Ok(())
}
pub fn sort_values ( vm : & mut Vm , arr : & mut [ Value ] ) -> Result < ( ) , RuntimeError > { let mut error = None ; arr . sort_by ( | a , b | { if error . is_some ( ) { return Ordering :: Equal ; } match compare_values ( vm , a , b ) { Ok ( ordering ) => ordering , Err ( e ) => { error . get_or_insert ( e ) ; Ordering :: Equal } } } ) ; if let Some ( err ) = error { return Err ( err ) ; } Ok ( ( ) ) }
Sorts values in a slice using Koto operators for comparison.
Sorts values in a slice using Koto operators for comparison .
vm
&mut Vm
arr
&mut [Value]
vm
&mut Vm
arr
&mut [Value]