|
@@ -1,5 +1,6 @@
|
|
//! Type facilitating on demand zero copy deserialization.
|
|
//! Type facilitating on demand zero copy deserialization.
|
|
|
|
|
|
|
|
+use crate::bpf_writer::BpfWriter;
|
|
use crate::error::ErrorCode;
|
|
use crate::error::ErrorCode;
|
|
use crate::{
|
|
use crate::{
|
|
Accounts, AccountsClose, AccountsExit, Owner, Result, ToAccountInfo, ToAccountInfos,
|
|
Accounts, AccountsClose, AccountsExit, Owner, Result, ToAccountInfo, ToAccountInfos,
|
|
@@ -225,8 +226,8 @@ impl<'info, T: ZeroCopy + Owner> AccountsExit<'info> for AccountLoader<'info, T>
|
|
fn exit(&self, _program_id: &Pubkey) -> Result<()> {
|
|
fn exit(&self, _program_id: &Pubkey) -> Result<()> {
|
|
let mut data = self.acc_info.try_borrow_mut_data()?;
|
|
let mut data = self.acc_info.try_borrow_mut_data()?;
|
|
let dst: &mut [u8] = &mut data;
|
|
let dst: &mut [u8] = &mut data;
|
|
- let mut cursor = std::io::Cursor::new(dst);
|
|
|
|
- cursor.write_all(&T::discriminator()).unwrap();
|
|
|
|
|
|
+ let mut writer = BpfWriter::new(dst);
|
|
|
|
+ writer.write_all(&T::discriminator()).unwrap();
|
|
Ok(())
|
|
Ok(())
|
|
}
|
|
}
|
|
}
|
|
}
|