Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // How to add an element to the accumulator acc and move out?
- .fold(|| HashMap::new(), | mut acc: HashMap<Hash, Group>, (idx, hash) | {
- {
- let e = acc.entry(hash)
- .or_insert(Group {value: Vec::new(), pos: group.pos + CHUNK_SIZE as u64, size: group.size });
- (*e).value.push(*idx);
- }
- acc
- })
- // compiler output
- error[E0505]: cannot move out of `acc` because it is borrowed
- --> src/main.rs:114:13
- |
- 111 | let e = acc.entry(hash)
- | --- borrow of `acc` occurs here
- ...
- 114 | acc
- | ^^^ move out of `acc` occurs here
- error: aborting due to previous error
Add Comment
Please, Sign In to add comment