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: optimize.rs
    path of file: ./repos/rustfst/rustfst-ffi/src/algorithms
    
    the code of the file until where you have to start completion: use anyhow::anyhow;

use crate::fst::CFst;
use crate::{get, get_mut, wrap, RUSTFST_FFI_RESULT};

use ffi_convert::RawPointerConverter;
use rustfst::algorithms::weight_converters::SimpleWeightConverter;
use rustfst::algorithms::{optimize, weight_convert};
use rustfst::fst_impls::Vecto
    
pub extern "C" fn fst_optimize(ptr: *mut CFst) -> RUSTFST_FFI_RESULT {
    wrap(|| {
        let fst = get_mut!(CFst, ptr);
        let vec_fst: &mut VectorFst<TropicalWeight> = fst
            .downcast_mut()
            .ok_or_else(|| anyhow!("Could not downcast to vector FST"))?;
        optimize(vec_fst)?;
        Ok(())
    })
}