core_preview/generated/accounts/
plugin_registry_v1.rs

1//! This code was AUTOGENERATED using the kinobi library.
2//! Please DO NOT EDIT THIS FILE, instead use visitors
3//! to add features, then rerun kinobi to update it.
4//!
5//! [https://github.com/metaplex-foundation/kinobi]
6//!
7
8use crate::generated::types::ExternalPluginRecord;
9use crate::generated::types::Key;
10use crate::generated::types::RegistryRecord;
11use borsh::BorshDeserialize;
12use borsh::BorshSerialize;
13
14#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
15#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
16pub struct PluginRegistryV1 {
17    pub key: Key,
18    pub registry: Vec<RegistryRecord>,
19    pub external_plugins: Vec<ExternalPluginRecord>,
20}
21
22impl PluginRegistryV1 {
23    #[inline(always)]
24    pub fn from_bytes(data: &[u8]) -> Result<Self, std::io::Error> {
25        let mut data = data;
26        Self::deserialize(&mut data)
27    }
28}
29
30impl<'a> TryFrom<&solana_program::account_info::AccountInfo<'a>> for PluginRegistryV1 {
31    type Error = std::io::Error;
32
33    fn try_from(
34        account_info: &solana_program::account_info::AccountInfo<'a>,
35    ) -> Result<Self, Self::Error> {
36        let mut data: &[u8] = &(*account_info.data).borrow();
37        Self::deserialize(&mut data)
38    }
39}