fn copy_page_maps(dst: &mut ReplicatedState, src: &ReplicatedState) {
    for (dst_canister, src_canister) in dst.canisters_iter_mut().zip(src.canisters_iter()) {
        assert_eq!(
            dst_canister.system_state.canister_id,
            src_canister.system_state.canister_id
        );
        assert_eq!(
            dst_canister.execution_state.is_some(),
            src_canister.execution_state.is_some(),
            "execution state of canister {} unexpectedly (dis)appeared after creating a checkpoint",
            dst_canister.system_state.canister_id
        );
        dst_canister.system_state.stable_memory = src_canister.system_state.stable_memory.clone();
        if let (Some(dst_state), Some(src_state)) = (
            &mut dst_canister.execution_state,
            &src_canister.execution_state,
        ) {
            dst_state.page_map = src_state.page_map.clone();
        }
    }
}
/// Copy heap and stable memory of the canisters stored in page maps from the
/// source state to the destination state.
///
/// We do this after every checkpoint to release in-memory deltas captured by
/// page maps and switch to the most recent checkpoint instead.
///
/// Precondition: src and dst have exactly the same set of canisters
Copy heap and stable memory of the canisters stored in page maps from the
source state to the destination state.

We do this after every checkpoint to release in-memory deltas captured by
page maps and switch to the most recent checkpoint instead.

src and dst have exactly the same set of canisters
Copy heap and stable memory of the canisters stored in page maps from the source state to the destination state . We do this after every checkpoint to release in - memory deltas captured by page maps and switch to the most recent checkpoint instead . src and dst have exactly the same set of canisters
fn copy_page_maps(dst: &mut ReplicatedState, src: &ReplicatedState) {
    for (dst_canister, src_canister) in dst.canisters_iter_mut().zip(src.canisters_iter()) {
        assert_eq!(
            dst_canister.system_state.canister_id,
            src_canister.system_state.canister_id
        );
        assert_eq!(
            dst_canister.execution_state.is_some(),
            src_canister.execution_state.is_some(),
            "execution state of canister {} unexpectedly (dis)appeared after creating a checkpoint",
            dst_canister.system_state.canister_id
        );
        dst_canister.system_state.stable_memory = src_canister.system_state.stable_memory.clone();
        if let (Some(dst_state), Some(src_state)) = (
            &mut dst_canister.execution_state,
            &src_canister.execution_state,
        ) {
            dst_state.page_map = src_state.page_map.clone();
        }
    }
}
fn copy_page_maps ( dst : & mut ReplicatedState , src : & ReplicatedState ) { for ( dst_canister , src_canister ) in dst . canisters_iter_mut ( ) . zip ( src . canisters_iter ( ) ) { assert_eq ! ( dst_canister system_state canister_id src_canister system_state canister_id ) ; assert_eq ! ( dst_canister execution_state is_some ( ) src_canister execution_state is_some ( ) " " dst_canister system_state canister_id ) ; dst_canister . system_state . stable_memory = src_canister . system_state . stable_memory . clone ( ) ; if let ( Some ( dst_state ) , Some ( src_state ) ) = ( & mut dst_canister . execution_state , & src_canister . execution_state , ) { dst_state . page_map = src_state . page_map . clone ( ) ; } } }
Copy heap and stable memory of the canisters stored in page maps from the
source state to the destination state.
Copy heap and stable memory of the canisters stored in page maps from the source state to the destination state .
dst
&mut ReplicatedState
src
&ReplicatedState
dst
&mut ReplicatedState
src
&ReplicatedState