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: interface.rs
    path of file: ./repos/raft-rs/harness/src
    
    the code of the file until where you have to start completion: // Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0.

// Copyright 2015 CoreOS, Inc.
//
// Licensed under the Apache Licens
    
    pub fn persist(&mut self) {
        if self.raft.is_some() {
            if let Some(snapshot) = self.raft_log.unstable_snapshot() {
                let snap = snapshot.clone();
                let index = snap.get_metadata().index;
                self.raft_log.stable_snap(index);
                self.mut_store().wl().apply_snapshot(snap).expect("");
                self.on_persist_snap(index);
                self.commit_apply(index);
            }
            let unstable = self.raft_log.unstable_entries().to_vec();
            if let Some(e) = unstable.last() {
                let (last_idx, last_term) = (e.get_index(), e.get_term());
                self.raft_log.stable_entries(last_idx, last_term);
                self.mut_store().wl().append(&unstable).expect("");
                self.on_persist_entries(last_idx, last_term);
            }
        }
    }