Skip to main content

moment_segments

Function moment_segments 

Source
pub fn moment_segments(ops: &[Op]) -> Vec<MomentSegment>
Expand description

Split a straight-line op stream into viewer moments, first at Op::Tick.

Every tick segment uses consecutive same-kind runs in source order: even without feedforward, sequential operations may reuse a qubit (SEM-MERGE). Invisible corrections stay at their operation boundary. Empty runs are dropped. The editor timeline consumes this same implementation.

Expects a flattened (straight-line) stream: an Op::Repeat would be silently dropped by op_moment_kind, corrupting the segmentation, so callers flatten first (Layer 2 always does).