Skip to content

Commit 23b4ba7

Browse files
committed
defer head_ids creation
1 parent 5d70dbe commit 23b4ba7

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/cycle.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -471,16 +471,23 @@ impl Iterator for CycleHeadIdsIterator<'_> {
471471
/// The context that the cycle recovery function receives when a query cycle occurs.
472472
#[derive(Clone)]
473473
pub struct Cycle<'a> {
474-
/// An iterator that outputs the [`Id`]s of the current cycle heads.
475-
/// This will always contain the [`Id`] of the query being processed by the current cycle recovery function,
476-
/// but its position will depend on the query execution order.
477-
pub head_ids: CycleHeadIdsIterator<'a>,
474+
/// The cycle heads.
475+
pub(crate) heads: &'a CycleHeads,
478476
/// The [`Id`] of the query that the current cycle recovery function is processing.
479477
pub id: Id,
480478
/// The counter of the current fixed point iteration.
481479
pub iteration: u32,
482480
}
483481

482+
impl Cycle<'_> {
483+
/// An iterator that outputs the [`Id`]s of the current cycle heads.
484+
/// This will always contain the [`Id`] of the query being processed by the current cycle recovery function,
485+
/// but its position will depend on the query execution order.
486+
pub fn head_ids(&self) -> CycleHeadIdsIterator<'_> {
487+
self.heads.ids()
488+
}
489+
}
490+
484491
#[derive(Debug)]
485492
pub enum ProvisionalStatus<'db> {
486493
Provisional {

src/function/execute.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ where
371371
};
372372

373373
let cycle = Cycle {
374-
head_ids: cycle_heads.ids(),
374+
heads: &cycle_heads,
375375
id,
376376
iteration: iteration_count.as_u32(),
377377
};

0 commit comments

Comments
 (0)