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: union_fst.rs
    path of file: ./repos/rustfst/rustfst/src/algorithms/union
    
    the code of the file until where you have to start completion: use std::sync::Arc;

use anyhow::Result;

use crate::algorithms::replace::ReplaceFst;
use crate::fst_properties::mutable_properties::union_properties;
use crate::fst_properties::FstProperties;
use crate::fst_traits::{AllocableFst, CoreFst, Fst, FstIterator, MutableFst, StateIterator};
use crate::semirings::Semiring;
use crate::{StateId, SymbolTable, Tr, TrsVec, EPS_LABEL, NO_LABEL};

/// Computes the union (sum) of two FSTs. This version is a d
    
    pub fn new(fst1: F, fst2: F) -> Result<Self> {
        let props1 = fst1.properties();
        let props2 = fst2.properties();
        let mut rfst = F::new();
        rfst.add_states(2);
        rfst.set_start(0)?;
        unsafe { rfst.set_final_unchecked(1, W::one()) };
        if let Some(isymt) = fst1.input_symbols() {
            rfst.set_input_symbols(Arc::clone(isymt));
        }
        if let Some(osymt) = fst1.output_symbols() {
            rfst.set_output_symbols(Arc::clone(osymt));
        }
        unsafe { rfst.reserve_trs_unchecked(0, 2) };
        unsafe { rfst.add_tr_unchecked(0, Tr::new(EPS_LABEL, NO_LABEL, W::one(), 1)) };
        unsafe { rfst.add_tr_unchecked(0, Tr::new(EPS_LABEL, NO_LABEL - 1, W::one(), 1)) };

        let fst_tuples = vec![(0, rfst), (NO_LABEL, fst1), (NO_LABEL - 1, fst2)];

        Ok(UnionFst(
            ReplaceFst::new(fst_tuples, 0, false)?,
            union_properties(props1, props2, true),
        ))
    }