flutter_rust_bridge 2.12.0

Flutter/Dart <-> Rust binding generator, feature-rich, but seamless and simple
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::lockable::immediate_invalid_borrow_checker::check_no_immediate_invalid_borrow;
use crate::lockable::order_info::LockableOrderInfo;

pub fn lockable_compute_decode_order(infos: Vec<LockableOrderInfo>) -> Vec<usize> {
    let sorted_infos = {
        let mut x = infos;
        x.sort_unstable_by_key(|info| info.object_order);
        x
    };

    assert!(
        check_no_immediate_invalid_borrow(&sorted_infos),
        "Cannot borrow an object mutably, and at the same time borrow again in another argument"
    );

    sorted_infos.into_iter().map(|info| info.index).collect()
}