You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: test_fst_into_iterator.rs
    path of file: ./repos/rustfst/rustfst/src/tests_openfst/fst_impls
    
    the code of the file until where you have to start completion: use anyhow::Result;
use itertools::Itertools;

use crate::fst_impls::{ConstFst, VectorFst};
use crate::fst_traits::ExpandedFst;
use crate::semirings::{SerializableSemiring, WeightQuantize};
use crate::tests_openfst::FstTestData;
use crate::{Semiring, Trs};

fn do_test_fst_into_iterator<W: Semiring, F: ExpandedFst<W>>(fst: F) -> Result<()> {
    
fn do_test_fst_iterator<W: Semiring, F: ExpandedFst<W>>(fst: &F) -> Result<()> {
    let mut fst_data_ref = vec![];

    for state in fst.states_range() {
        fst_data_ref.push((
            state,
            fst.get_trs(state)?.trs().iter().cloned().collect_vec(),
            fst.final_weight(state)?,
            fst.num_trs(state)?,
        ));
    }

    let mut fst_data = vec![];
    for data in fst.fst_iter() {
        fst_data.push((
            data.state_id,
            data.trs.trs().iter().cloned().collect_vec(),
            data.final_weight,
            data.num_trs,
        ));
    }
    assert_eq!(fst_data, fst_data_ref);

    Ok(())
}