Skip to main content

aligned_moment_segments

Function aligned_moment_segments 

Source
pub fn aligned_moment_segments(
    ops: &[Op],
) -> Result<Vec<Option<MomentSegment>>, MomentAlignmentError>
Expand description

Split a straight-line circuit into alignable kind buckets and idle gaps.

A tick closes the preceding interval; it does not open a trailing empty interval. Mixed intervals become consecutive same-kind runs, while a leading or between-ticks empty interval is retained as None. Measurement-controlled corrections stay in source order inside the adjacent visible runs, matching crate::moment_segments; they do not add visible moments. A correction-only interval retains an idle slot and carries its corrections to the next run (or the last run if trailing). Correction-only circuits have no such anchor and are rejected.

ยงErrors

Returns MomentAlignmentError::UnsupportedCircuitOperation for an operation that cannot be represented as an aligned moment.