check this function:

// Find 5' truncations in a set of query reads
// based on a consensus/target track/group
//
// In short, each Vec<Arc<FendPred>> is a group of overlapping
// transcripts. For each of these groups, a pre-processing sort
// is performed to facilite further comparisons detailed here.
//
// Pre-sort logic:
// For a given group, all transcripts are sorted by their first
// exon start and end coordinates so that:
//
//          5'------------------------------- 3'
// Target1: XXXXX---XXXXXX------XXXXXX---XXXXXX
// Target2:   XXXXXXXXXXXX------XXXXXX---XXXXXX
// Target3:       XXXXXXXX------XXXXXX---XXXXXX
// Target4:                XXXX-XXXXXX---XXXXXX
// Target5:                  XX-XXXXXX---XXXXXX
//
// This allows for a more efficient search for 5' truncations
// in the query transcripts.
//
// See config.rs for the definition of FendPred and FendCGroup
// structs.
// ...
fn find_truncation(
    tx: &FendPred,
    target: &Vec<Arc<FendPred>>,
    flags: (bool, usize),
) -> Option<Status> {
    let skip_exon = flags.0;
    let threshold = flags.1;
    let (query_exon_start, query_exon_end) = tx.exons.get(0).unwrap();

    for t in target {
        for (idx, (target_exon_start, target_exon_end)) in t.exons.iter().enumerate() {
            if query_exon_start >= target_exon_start && query_exon_start <= target_exon_end {
                // Query is inside target group 5' ends
                //
                // Does not directly mean that its truncated.
                // mRNAs captured by PacBio Iso-Seqs present
                // a particular distribution of pseudo-5'-truncations
                // that are not necessarily indicative of a true
                // truncation.
                //
                // Four different scenarios can be observed:
                //
                // 1. Query start is within the target start and end (same end)
                //
                // Target: XXXXX---XXXXXX---XXXXXX
                //           |||
                // Query:    XXX---XXXXXX---XXXXXX
                //
                // 2. Query start is within the target start and end (different end)
                //
                // Target: XXXXX---XXXXXX---XXXXXX
                //           ||^
                // Query:    XX----XXXXXX---XXXXXX
                //
                // 3. Query start is within target start/end but query ends in an intron
                //
                // Target: XXXXX---XXXXXX---XXXXXX
                //           |||**
                // Query:    XXXXX-XXXXXX---XXXXXX
                //
                // 4. Query retains an intron
                //
                // Target: XXXXX---XXXXXX---XXXXXX
                //           |||***||||||
                // Query:    XXXXXXXXXXXX---XXXXXX
                //
                // In all cases, the query is considered complete.
                // ...
                return Some(Status::Complete);
            } else {
                // Query is not inside the current target group 5' end.
                // Here, three possibilities are considered:
                //
                // 1. Query start is before the next target start (in intron)
                //
                // Target: XXXXX-----XXXXX-----XXXXXXX
                //               |||
                // Query:        XXX-XXXXX-----XXXXXXX
                //
                // 2. Query start is after the next target start (or somewhere downstream)
                //
                // Target: XXXXX-----XXXXX-----XXXXXXX
                //                     |||
                // Query:              XXX-----XXXXXXX
                //
                // 3. Query start is after the next target end (not on reach)
                //
                // Target: XXXXX-----XXXXX-----XXXXXXX
                //                         |||
                // Query:                  XXX-XXXXXXX
                //...
                if query_exon_start < &t.exons[idx + 1].0 && idx < t.exons.len() - 1 {
                    // Query starts in an intron
                    if query_exon_end > &t.exons[idx + 1].0 {
                        // Query ends overlaps with the next exon
                        //
                        // Target: XXXXX-----XXXXX-----XXXXXXX
                        //                   *****
                        // Query:         XXXXXXXX-----XXXXXXX
                        return Some(Status::Truncated);
                    } else {
                        // Query 5'end is in an intron
                        //
                        // Target: XXXXX-----XXXXX-----XXXXXXX
                        //               |||
                        // Query:        XXX-XXXXX-----XXXXXXX
                        return Some(Status::Complete);
                    }
                } else if query_exon_start >= &t.exons[idx + 1].0
                    && query_exon_end <= &t.exons[idx + 1].1
                    && idx < t.exons.len() - 1
                {
                    // Query is in the next exon
                    //
                    // Target: XXXXX-----XXXXX-----XXXXXXX
                    //                    |||
                    // Query:             XXX------XXXXXXX
                    return Some(Status::Truncated);
                } else {
                    // Query starts somewhere downstream
                    // the next exon
                    continue;
                }
            }
        }
    }

    None
}

I am getting this errors:

' panicked at 101:
:src/fivend/classify.rsindex out of bounds: the len is 12 but the index is 12src/fivend/classify.rs:index out of bounds: the len is 12 but the index is 12101:
:47
:101101:
47::index out of bounds: the len is 12 but the index is 12:
47index out of bounds: the len is 12 but the index is 1247
:

:
index out of bounds: the len is 12 but the index is 12index out of bounds: the len is 12 but the index is 12
<unnamed>
' panicked at src/fivend/classify.rs<unnamed>:101' panicked at :index out of bounds: the len is 12 but the index is 12src/fivend/classify.rssrc/fivend/classify.rs47
:' panicked at :
:101src/fivend/classify.rsindex out of bounds: the len is 12 but the index is 12101::47
:
:10147101index out of bounds: the len is 12 but the index is 12::
:
47index out of bounds: the len is 12 but the index is 1247:

:
index out of bounds: the len is 12 but the index is 12index out of bounds: the len is 12 but the index is 12

thread 'thread 'thread 'thread 'thread '<unnamed><unnamed><unnamed><unnamed><unnamed>' panicked at ' panicked at ' panicked at ' panicked at ' panicked at src/fivend/classify.rssrc/fivend/classify.rssrc/fivend/classify.rssrc/fivend/classify.rssrc/fivend/classify.rs:::::101101101101101:::::4747474747:
:
:
:
:
index out of bounds: the len is 4 but the index is 4index out of bounds: the len is 4 but the index is 4index out of bounds: the len is 4 but the index is 4index out of bounds: the len is 4 but the index is 4index out of bounds: the len is 4 but the index is 4

I am assuming that it is because once the inner loop reaches the last exon and there is no break statement. I am not really sure. Could you help me please?