move util/
out of coremem
and into its only user: buffer_proto5
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -160,6 +160,7 @@ dependencies = [
|
|||||||
name = "buffer_proto5"
|
name = "buffer_proto5"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"bincode",
|
||||||
"coremem",
|
"coremem",
|
||||||
"log",
|
"log",
|
||||||
"serde",
|
"serde",
|
||||||
|
@@ -5,6 +5,7 @@ authors = ["Colin <colin@uninsane.org>"]
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
bincode = "1.3" # MIT
|
||||||
coremem = { path = "../../coremem" }
|
coremem = { path = "../../coremem" }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
|
@@ -9,6 +9,7 @@ pub struct DiskCache<K, V, S=NoSupplier> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<K: DeserializeOwned, V: DeserializeOwned> DiskCache<K, V, NoSupplier> {
|
impl<K: DeserializeOwned, V: DeserializeOwned> DiskCache<K, V, NoSupplier> {
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn new(path: &str) -> Self {
|
pub fn new(path: &str) -> Self {
|
||||||
Self::new_with_supplier(path, NoSupplier)
|
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> {
|
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 {
|
pub fn get_or_insert_with<F: FnOnce() -> V>(&mut self, k: K, f: F) -> V {
|
||||||
if let Some(v) = self.get(&k) {
|
if let Some(v) = self.get(&k) {
|
||||||
return v.clone();
|
return v.clone();
|
@@ -10,10 +10,13 @@ use coremem::render::CsvRenderer;
|
|||||||
use coremem::sim::spirv::{SpirvSim, WgpuBackend};
|
use coremem::sim::spirv::{SpirvSim, WgpuBackend};
|
||||||
use coremem::sim::units::{Seconds, Time as _};
|
use coremem::sim::units::{Seconds, Time as _};
|
||||||
use coremem::stim::{CurlStimulus, Exp1, Gated, Sinusoid1, TimeVarying as _};
|
use coremem::stim::{CurlStimulus, Exp1, Gated, Sinusoid1, TimeVarying as _};
|
||||||
use coremem::util::cache::DiskCache;
|
|
||||||
use log::{error, info, warn};
|
use log::{error, info, warn};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
mod cache;
|
||||||
|
|
||||||
|
use cache::DiskCache;
|
||||||
|
|
||||||
type Mat = IsoConductorOr<f32, Ferroxcube3R1MH>;
|
type Mat = IsoConductorOr<f32, Ferroxcube3R1MH>;
|
||||||
|
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
|
@@ -13,7 +13,6 @@ pub mod meas;
|
|||||||
pub mod render;
|
pub mod render;
|
||||||
pub mod sim;
|
pub mod sim;
|
||||||
pub mod stim;
|
pub mod stim;
|
||||||
pub mod util;
|
|
||||||
|
|
||||||
pub use driver::*;
|
pub use driver::*;
|
||||||
pub use sim::*;
|
pub use sim::*;
|
||||||
|
@@ -1 +0,0 @@
|
|||||||
pub mod cache;
|
|
Reference in New Issue
Block a user