I'm trying to get this working:
let raw_account_data = account.data.borrow_mut(); // account type is AccountInfo
let account_data = AccountData::deserialize(raw_account_data); // <-- ERROR
////////////////////////////////////////////////////////////////
pub struct AccountInfo<'a> {
pub data: Rc<RefCell<&'a mut [u8]>>,
////////////////////////////////////////////////////////////////
pub fn deserialize(buf: &mut &[u8]) -> Result<Self>
////////////////////////////////////////////////////////////////
I tried various combinations but none gave me expected &mut &[u8]
.
How to convert account.data
?
mismatched types
expected mutable reference `&mut &[u8]`
found struct `RefMut<'_, &mut [u8]>`