Skip to content

Commit 8a8873c

Browse files
committed
doc for the two callback methods
1 parent cc13c46 commit 8a8873c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

app/lib/search/token_index.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ abstract class _AllocationPool<T> {
177177
_pool.add(item);
178178
}
179179

180+
/// Executes [fn] and provides a pool item in the callback.
181+
/// The item will be released to the pool after [fn] completes.
180182
R withPoolItem<R>({
181183
required R Function(T array) fn,
182184
}) {
@@ -186,6 +188,9 @@ abstract class _AllocationPool<T> {
186188
return r;
187189
}
188190

191+
/// Executes [fn] and provides a getter function that can be used to
192+
/// acquire new pool items while the [fn] is being executed. The
193+
/// acquired items will be released back to the pool after [fn] completes.
189194
R withItemGetter<R>(R Function(T Function() itemFn) fn) {
190195
List<T>? items;
191196
T itemFn() {

0 commit comments

Comments
 (0)