#Does get_mut actually update the value

1 messages · Page 1 of 1 (latest)

spiral helm
#

I'm just wondering whether pair.reserves.reserves0 = step.reserves_a.0; actually updates the param g in this instance and whether im using get_mut properly here?

pub fn x(
    p: &mut Vec<Path>,
    g: &mut BTreeMap<(Address, Address), BTreeMap<Dex, Pair>>,
) -> Option<Path> {
    for step in p[0].path.iter() {
            if let Some(group) = g.get_mut(&(step.pair.0, step.pair.1)) {
                if let Some(pair) = group.get_mut(&step.dex) {
                    pair.reserves.reserves0 = step.reserves_a.0;
                    pair.reserves.reserves1 = step.reserves_a.1;
                }
            }
    }

    None
}
faint flax
#

Yes it all looks correct

spiral helm