Skip to content

Commit c211f63

Browse files
committed
Fix comments
1 parent a8484a2 commit c211f63

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

macros/src/lib.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ use syn::{parse_quote, Error, Result};
5454
/// basic mutable arguments, but it cannot determine all sources of impurity,
5555
/// so this is your responsibility.
5656
///
57+
/// - The output of a memoized function must be `Send` and `Sync` because it is
58+
/// stored in the global cache.
59+
///
5760
/// Furthermore, memoized functions cannot use destructuring patterns in their
5861
/// arguments.
5962
///
@@ -118,11 +121,14 @@ pub fn memoize(_: BoundaryStream, stream: BoundaryStream) -> BoundaryStream {
118121
/// [`Hash`](std::hash::Hash) and **must feed all the information they expose
119122
/// to the hasher**. Otherwise, memoized results might get reused invalidly.
120123
///
124+
/// - The arguments to a tracked method must be `Send` and `Sync` because they
125+
/// are stored in the global cache.
126+
///
121127
/// Furthermore:
122128
/// - Tracked methods cannot be generic.
123129
/// - They cannot be `unsafe`, `async` or `const`.
124130
/// - They must take an `&self` or `&mut self` parameter.
125-
/// - Their arguments must implement [`ToOwned`](std::borrow::ToOwned).
131+
/// - Their arguments must implement [`ToOwned`].
126132
/// - Their return values must implement [`Hash`](std::hash::Hash).
127133
/// - They cannot use destructuring patterns in their arguments.
128134
///

src/cache.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,12 @@ where
7373
output
7474
}
7575

76-
/// Evict the cache.
76+
/// Evict the global cache.
7777
///
7878
/// This removes all memoized results from the cache whose age is larger than or
7979
/// equal to `max_age`. The age of a result grows by one during each eviction
8080
/// and is reset to zero when the result produces a cache hit. Set `max_age` to
8181
/// zero to completely clear the cache.
82-
///
83-
/// Comemo's cache is thread-local, meaning that this only evicts this thread's
84-
/// cache.
8582
pub fn evict(max_age: usize) {
8683
for subevict in EVICTORS.read().iter() {
8784
subevict(max_age);

0 commit comments

Comments
 (0)