You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unlike regular fields, superstruct's mutable getters don't lend themselves to disjoint mutable borrows, i.e. borrowing field1 and field2 simultaneously, where at least one of the borrows is mutable.
This can be worked around on a case-by-case basis by writing helper functions like this, but I wonder if we should generate these automatically for given pairs/lists of fields:
/// Convenience accessor for validators and balances simultaneously.pubfnvalidators_and_balances_mut(&mutself) -> (&mut[Validator],&mut[u64]){matchself{BeaconState::Base(state) => (&mut state.validators,&mut state.balances),BeaconState::Altair(state) => (&mut state.validators,&mut state.balances),}}
The text was updated successfully, but these errors were encountered:
Unlike regular fields,
superstruct
's mutable getters don't lend themselves to disjoint mutable borrows, i.e. borrowingfield1
andfield2
simultaneously, where at least one of the borrows is mutable.This can be worked around on a case-by-case basis by writing helper functions like this, but I wonder if we should generate these automatically for given pairs/lists of fields:
The text was updated successfully, but these errors were encountered: