You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: state.rs
    path of file: ./repos/enigma-core/enigma-runtime-t/src/data
    
    the code of the file until where you have to start completion: use crate::data::{DeltasInterface, IOInterface, StatePatch};
use enigma_tools_t::common::errors_t::{EnclaveError, EnclaveError::*, EnclaveSystemError::*};
use enigma_types::{ContractAddress, StateKey};
use enigma_crypt
    
    fn apply_delta(&mut self, delta: EncryptedPatch, key: &'a StateKey) -> Result<(), EnclaveError> {
        let delta_hash = delta.keccak256_patch();
        let dec_delta = StatePatch::decrypt(delta.clone(), key)?;
        if dec_delta.previous_hash != self.delta_hash {
            return Err(SystemError(StateError { err: "Hashes don't match, Failed Applying the delta".to_string() }));
        }
        json_patch::patch(&mut self.json, &dec_delta.patch)?;
        self.delta_hash = delta_hash;
        self.delta_index = dec_delta.index;
        Ok(())
    }