/// Returns a `RefMut` to the account data structure for reading or writing.
Returns a `RefMut` to the account data structure for reading or writing.
Returns a ` RefMut ` to the account data structure for reading or writing .
pub fn load_mut(&self) -> Result<RefMut<T>, ProgramError> {
        // AccountInfo api allows you to borrow mut even if the account isn't
        // writable, so add this check for a better dev experience.
        if !self.acc_info.is_writable {
            return Err(ErrorCode::AccountNotMutable.into());
        }
        let data = self.acc_info.try_borrow_mut_data()?;
        let mut disc_bytes = [0u8; 8];
        disc_bytes.copy_from_slice(&data[..8]);
        if disc_bytes != T::discriminator() {
            return Err(ErrorCode::AccountDiscriminatorMismatch.into());
        }
        Ok(RefMut::map(data, |data| {
            bytemuck::from_bytes_mut(&mut data.deref_mut()[8..])
        }))
    }
pub fn load_mut ( & self ) -> Result < RefMut < T > , ProgramError > { // AccountInfo api allows you to borrow mut even if the account isn't // writable, so add this check for a better dev experience. if ! self . acc_info . is_writable { return Err ( ErrorCode :: AccountNotMutable . into ( ) ) ; } let data = self . acc_info . try_borrow_mut_data ( ) ? ; let mut disc_bytes = [ 0u8 ; 8 ] ; disc_bytes . copy_from_slice ( & data [ .. 8 ] ) ; if disc_bytes != T :: discriminator ( ) { return Err ( ErrorCode :: AccountDiscriminatorMismatch . into ( ) ) ; } Ok ( RefMut :: map ( data , | data | { bytemuck :: from_bytes_mut ( & mut data . deref_mut ( ) [ 8 .. ] ) } ) ) }
Returns a `RefMut` to the account data structure for reading or writing.
Returns a ` RefMut ` to the account data structure for reading or writing .
&self