MCPcopy Create free account
hub / github.com/Bonfida/dex-v4 / from_buffer

Method from_buffer

program/src/state.rs:232–238  ·  view source on GitHub ↗
(buf: &'a mut [u8])

Source from the content-addressed store, hash-verified

230impl<'a> UserAccount<'a> {
231 #[allow(missing_docs)]
232 pub fn from_buffer(buf: &'a mut [u8]) -> Result<Self, ProgramError> {
233 let user_acc = UserAccount::from_buffer_unchecked(buf).unwrap();
234 if user_acc.header.tag != AccountTag::UserAccount as u64 {
235 return Err(ProgramError::InvalidAccountData);
236 };
237 Ok(user_acc)
238 }
239
240 #[allow(missing_docs)]
241 pub fn from_buffer_unchecked(buf: &'a mut [u8]) -> Result<Self, ProgramError> {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected