pub fn borrow_field_from_nonce(
        &mut self,
        idx: FieldDefinitionIndex,
        nonce: Nonce,
        new_nonce: Nonce,
    ) {
        self.borrows
            .entry(nonce)
            .and_modify(|borrow_info| match borrow_info {
                BorrowInfo::BorrowedBy(nonce_set) => {
                    nonce_set.insert(new_nonce);
                }
                BorrowInfo::FieldsBorrowedBy(index_to_nonce_set) => {
                    index_to_nonce_set
                        .entry(idx)
                        .and_modify(|nonce_set| {
                            nonce_set.insert(new_nonce);
                        })
                        .or_insert({
                            let mut nonce_set = BTreeSet::new();
                            nonce_set.insert(new_nonce);
                            nonce_set
                        });
                }
            })
            .or_insert({
                let mut nonce_set = BTreeSet::new();
                nonce_set.insert(new_nonce);
                let mut fields_borrowed_by = BTreeMap::new();
                fields_borrowed_by.insert(idx, nonce_set);
                BorrowInfo::FieldsBorrowedBy(fields_borrowed_by)
            });
    }
/// update self to reflect a borrow of idx from nonce by new_nonce
update self to reflect a borrow of idx from nonce by new_nonce
update self to reflect a borrow of idx from nonce by new_nonce
pub fn borrow_field_from_nonce(
        &mut self,
        idx: FieldDefinitionIndex,
        nonce: Nonce,
        new_nonce: Nonce,
    ) {
        self.borrows
            .entry(nonce)
            .and_modify(|borrow_info| match borrow_info {
                BorrowInfo::BorrowedBy(nonce_set) => {
                    nonce_set.insert(new_nonce);
                }
                BorrowInfo::FieldsBorrowedBy(index_to_nonce_set) => {
                    index_to_nonce_set
                        .entry(idx)
                        .and_modify(|nonce_set| {
                            nonce_set.insert(new_nonce);
                        })
                        .or_insert({
                            let mut nonce_set = BTreeSet::new();
                            nonce_set.insert(new_nonce);
                            nonce_set
                        });
                }
            })
            .or_insert({
                let mut nonce_set = BTreeSet::new();
                nonce_set.insert(new_nonce);
                let mut fields_borrowed_by = BTreeMap::new();
                fields_borrowed_by.insert(idx, nonce_set);
                BorrowInfo::FieldsBorrowedBy(fields_borrowed_by)
            });
    }
pub fn borrow_field_from_nonce ( & mut self , idx : FieldDefinitionIndex , nonce : Nonce , new_nonce : Nonce , ) { self . borrows . entry ( nonce ) . and_modify ( | borrow_info | match borrow_info { BorrowInfo :: BorrowedBy ( nonce_set ) => { nonce_set . insert ( new_nonce ) ; } BorrowInfo :: FieldsBorrowedBy ( index_to_nonce_set ) => { index_to_nonce_set . entry ( idx ) . and_modify ( | nonce_set | { nonce_set . insert ( new_nonce ) ; } ) . or_insert ( { let mut nonce_set = BTreeSet :: new ( ) ; nonce_set . insert ( new_nonce ) ; nonce_set } ) ; } } ) . or_insert ( { let mut nonce_set = BTreeSet :: new ( ) ; nonce_set . insert ( new_nonce ) ; let mut fields_borrowed_by = BTreeMap :: new ( ) ; fields_borrowed_by . insert ( idx , nonce_set ) ; BorrowInfo :: FieldsBorrowedBy ( fields_borrowed_by ) } ) ; }
update self to reflect a borrow of idx from nonce by new_nonce
update self to reflect a borrow of idx from nonce by new_nonce
&mut self
idx
FieldDefinitionIndex
nonce
Nonce
new_nonce
Nonce