move util/ out of coremem and into its only user: buffer_proto5

This commit is contained in:
2022-07-28 15:30:50 -07:00
parent 80d3765bcf
commit 9e35b29087
6 changed files with 8 additions and 3 deletions

1
Cargo.lock generated
View File

@@ -160,6 +160,7 @@ dependencies = [
name = "buffer_proto5"
version = "0.1.0"
dependencies = [
"bincode",
"coremem",
"log",
"serde",

View File

@@ -5,6 +5,7 @@ authors = ["Colin <colin@uninsane.org>"]
edition = "2021"
[dependencies]
bincode = "1.3" # MIT
coremem = { path = "../../coremem" }
log = "0.4"
serde = "1.0"

View File

@@ -9,6 +9,7 @@ pub struct DiskCache<K, V, S=NoSupplier> {
}
impl<K: DeserializeOwned, V: DeserializeOwned> DiskCache<K, V, NoSupplier> {
#[allow(dead_code)]
pub fn new(path: &str) -> Self {
Self::new_with_supplier(path, NoSupplier)
}
@@ -48,6 +49,7 @@ impl<K: Serialize, V: Serialize, S> DiskCache<K, V, S> {
}
impl<K: PartialEq + Serialize, V: Serialize + Clone, S> DiskCache<K, V, S> {
#[allow(dead_code)]
pub fn get_or_insert_with<F: FnOnce() -> V>(&mut self, k: K, f: F) -> V {
if let Some(v) = self.get(&k) {
return v.clone();

View File

@@ -10,10 +10,13 @@ use coremem::render::CsvRenderer;
use coremem::sim::spirv::{SpirvSim, WgpuBackend};
use coremem::sim::units::{Seconds, Time as _};
use coremem::stim::{CurlStimulus, Exp1, Gated, Sinusoid1, TimeVarying as _};
use coremem::util::cache::DiskCache;
use log::{error, info, warn};
use serde::{Deserialize, Serialize};
mod cache;
use cache::DiskCache;
type Mat = IsoConductorOr<f32, Ferroxcube3R1MH>;
#[allow(unused)]

View File

@@ -13,7 +13,6 @@ pub mod meas;
pub mod render;
pub mod sim;
pub mod stim;
pub mod util;
pub use driver::*;
pub use sim::*;

View File

@@ -1 +0,0 @@
pub mod cache;