Refactor Storage Program (#3622)
* Refactor Storage Program * Replace KeyedAccount trait with StorageAccount struct * Implement State for Account, not StorageAccount * Make State trait more generic * Move validation check into function
This commit is contained in:
		@@ -45,6 +45,14 @@ impl Account {
 | 
			
		||||
            executable: false,
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub fn deserialize_data<T: serde::de::DeserializeOwned>(&self) -> Result<T, bincode::Error> {
 | 
			
		||||
        bincode::deserialize(&self.data)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub fn serialize_data<T: serde::Serialize>(&mut self, state: &T) -> Result<(), bincode::Error> {
 | 
			
		||||
        bincode::serialize_into(&mut self.data[..], state)
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[repr(C)]
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user