You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// given `account`, attempts to perform zero-copy deserialization of the account farm_key/// however due to the nature of this function, no validation of the account discriminator is performed/// and as such it's technically possibly for this function to produce valid results on accounts/// which aren't actually vault accountspubfnfarm_accessor(account:&Account) -> Result<Farm>{if account.data.len() < 448{returnErr(anyhow!("account data length too smal"));}let farm_information = &account.data[8 + 424..8 + 424 + 16];let(part_one, part_two) = farm_information.split_at(8);let part_one = {letmut bytes:[u8;8] = [0u8;8];
bytes.copy_from_slice(part_one);
u64::from_le_bytes(bytes)};let part_two = {letmut bytes:[u8;8] = [0u8;8];
bytes.copy_from_slice(part_two);
u64::from_le_bytes(bytes)};Ok(Farm::from([part_one, part_two]))}
add
hex = "0.4.3"
tocargo.toml
The text was updated successfully, but these errors were encountered: