Skip to content

Commit 9c9a1a3

Browse files
committed
Rename cache.rs to memoize.rs
1 parent 5b4c936 commit 9c9a1a3

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

macros/src/memoize.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,10 @@ fn process(function: &Function) -> Result<TokenStream> {
157157

158158
#(#bounds;)*
159159

160-
::comemo::internal::memoized(
160+
::comemo::internal::memoize(
161+
&__CACHE,
161162
::comemo::internal::Multi(#arg_tuple),
162163
&::core::default::Default::default(),
163-
&__CACHE,
164164
#enabled,
165165
#closure,
166166
)

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@ For the full example see [`examples/calc.rs`][calc].
8989
*/
9090

9191
mod accelerate;
92-
mod cache;
9392
mod constraint;
9493
mod hash;
9594
mod input;
95+
mod memoize;
9696
mod track;
9797

98-
pub use crate::cache::evict;
9998
pub use crate::hash::Prehashed;
99+
pub use crate::memoize::evict;
100100
pub use crate::track::{Track, Tracked, TrackedMut, Validate};
101101

102102
#[cfg(feature = "macros")]
@@ -107,12 +107,12 @@ pub use comemo_macros::{memoize, track};
107107
pub mod internal {
108108
pub use parking_lot::RwLock;
109109

110-
pub use crate::cache::{Cache, CacheData, memoized, register_evictor};
111110
pub use crate::constraint::{Call, ImmutableConstraint, MutableConstraint};
112111
pub use crate::hash::hash;
113112
pub use crate::input::{Input, Multi, assert_hashable_or_trackable};
113+
pub use crate::memoize::{Cache, CacheData, memoize, register_evictor};
114114
pub use crate::track::{Surfaces, to_parts_mut_mut, to_parts_mut_ref, to_parts_ref};
115115

116116
#[cfg(feature = "testing")]
117-
pub use crate::cache::last_was_hit;
117+
pub use crate::memoize::last_was_hit;
118118
}

src/cache.rs renamed to src/memoize.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ thread_local! {
1919
}
2020

2121
/// Execute a function or use a cached result for it.
22-
pub fn memoized<'a, In, Out, F>(
22+
pub fn memoize<'a, In, Out, F>(
23+
cache: &Cache<In::Constraint, Out>,
2324
mut input: In,
2425
constraint: &'a In::Constraint,
25-
cache: &Cache<In::Constraint, Out>,
2626
enabled: bool,
2727
func: F,
2828
) -> Out

0 commit comments

Comments
 (0)