Skip to content

Commit cda3b63

Browse files
committed
Move struct
1 parent 6c41328 commit cda3b63

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/memoize.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,16 @@ pub struct CacheData<C, Out> {
135135
tree: CallTree<C, CacheEntry<C, Out>>,
136136
}
137137

138+
/// A memoized result.
139+
struct CacheEntry<C, Out> {
140+
/// The memoized function's output.
141+
output: Out,
142+
/// Mutable tracked calls that must be replayed.
143+
mutable: Vec<C>,
144+
/// How many evictions have passed since the entry has last been used.
145+
age: AtomicUsize,
146+
}
147+
138148
impl<C, Out: 'static> CacheData<C, Out> {
139149
/// Evict all entries whose age is larger than or equal to `max_age`.
140150
fn evict(&mut self, max_age: usize) {
@@ -175,16 +185,6 @@ impl<C, Out: 'static> CacheData<C, Out> {
175185
}
176186
}
177187

178-
/// A memoized result.
179-
struct CacheEntry<C, Out> {
180-
/// The memoized function's output.
181-
output: Out,
182-
/// Mutable tracked calls that must be replayed.
183-
mutable: Vec<C>,
184-
/// How many evictions have passed since the entry has last been used.
185-
age: AtomicUsize,
186-
}
187-
188188
impl<C, Out> Default for CacheData<C, Out> {
189189
fn default() -> Self {
190190
Self { tree: CallTree::new() }

0 commit comments

Comments
 (0)