fn default()

in merkledb/src/merklememdb.rs [46:67]


    fn default() -> MerkleMemDB {
        /*
         * We create a node 0 containing the hash of all 0s used to denote
         * the empty string. This is both a CAS and a FILE node for simplicity,
         * to allow for both the empty string FILE and the empty string CAS
         * case without requiring much explicit client-side handling.
         */
        let mut node_0_attributes = MerkleNodeAttributes::default();
        node_0_attributes.set_file();
        node_0_attributes.set_cas();
        let mut ret = MerkleMemDB {
            nodedb: vec![MerkleNode::default(); 1],  // first real node starts at index 1
            attributedb: vec![node_0_attributes; 1], // first real node starts at index 1
            hashdb: FxHashMap::default(),
            path: PathBuf::default(),
            changed: false,
            autosync: true,
        };
        // for the 0 node.
        ret.hashdb.insert(MerkleHash::default(), 0);
        ret
    }