Jan. 14th, 2020

:-) Gosh, the gift that just keeps giving

Walk the dependencies BTreeMap<u64, Vec<u64>>:
   let mut clazz_walk = clazz_dep.get(&0).unwrap().clone();
   let mut looked_at = 0;
   while !clazz_walk.is_empty() {
      looked_at += 1;
      let dep_id = clazz_walk.pop().unwrap();
      let super_class = clazz_map.get(&dep_id).unwrap();
      if let Some(super_deps) = clazz_dep.get(&dep_id) {
         for sub_class in super_deps {
            clazz_walk.push(*sub_class);
            let sub = clazz_map.get_mut(&sub_class).unwrap();
            for idx in super_class.id_idx.iter() {
               sub.id_idx.push(idx + sub.instance_sz);
            }
            sub.instance_sz += super_class.instance_sz;
         }
      }
   }

error[E0502]: cannot borrow `clazz_map` as mutable because it is also borrowed as immutable
   --> src/main.rs:493:23
    |
489 |       let super_class = clazz_map.get(&dep_id).unwrap();
    |                         --------- immutable borrow occurs here
...
493 |             let sub = clazz_map.get_mut(&sub_class).unwrap();
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
494 |             for idx in super_class.id_idx.iter() {
    |                        ------------------ immutable borrow later used here

Profile

sassa_nf

January 2026

S M T W T F S
    123
45678910
111213141516 17
18192021222324
25262728293031

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 20th, 2026 08:59 pm
Powered by Dreamwidth Studios