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: transaction_selector.rs
    path of file: ./repos/fuel-core/crates/services/txpool/src
    
    the code of the file until where you have to start completion: use fuel_core_types::{
    fuel_types::Word,
    services::txpool::ArcPoolTx,
};

// transaction selection could use a plugin based approach in the
// future for block producers to customize block building (e.g. alternative priorities besides gas fees)

// Expects sorted by gas price transactions, highest first
pub fn select_transactions(
    includable_txs: impl Iterator<Item = ArcPoolTx>,
    max_gas: u64,
) -> Vec<ArcPoolTx> {
    // Select all txs that fit into the block, preferring ones with higher gas price.
    //
    // Future improvements to this algorithm may take into account the parallel nature of
    // transactions to maximize throughput.
    let mut used_block_space: Word = 0;
    // The type of the index for the transaction is `u16`, so we need to
    // limit it to `MAX` value minus 1(because of the `Mint` transaction).
    let takes_txs = u16::MAX - 1;

    // Pick as many transactions as we can fit into the block (greedy)
    includable_txs
        .filter(|tx| {
            let tx_block_space = tx.max_gas();
            if let Some(new_used_space
    
    fn make_txs_and_select(txs: &[TxGas], block_gas_limit: Word) -> Vec<TxGas> {
        let mut rng = thread_rng();

        let fee_params = FeeParameters {
            gas_price_factor: 1,
            gas_per_byte: 0,
        };

        let mut txs = txs
            .iter()
            .map(|tx_gas| {
                TransactionBuilder::script(
                    vec![op::ret(RegId::ONE)].into_iter().collect(),
                    vec![],
                )
                .tip(tx_gas.tip)
                .script_gas_limit(tx_gas.limit)
                .add_unsigned_coin_input(
                    SecretKey::random(&mut rng),
                    rng.gen(),
                    1_000_000,
                    Default::default(),
                    Default::default(),
                )
                .add_output(Output::Change {
                    to: Default::default(),
                    amount: 0,
                    asset_id: Default::default(),
                })
                .with_fee_params(fee_params)
                .with_gas_costs(GasCosts::free())
                // The block producer assumes transactions are already checked
                // so it doesn't need to compute valid sigs for tests
                .finalize_checked_basic(Default::default()).into()
            })
            .map(Arc::new)
            .collect::<Vec<ArcPoolTx>>();
        txs.sort_by_key(|a| core::cmp::Reverse(a.tip()));

        select_transactions(txs.into_iter(), block_gas_limit)
            .into_iter()
            .map(|tx| TxGas {
                limit: tx.script_gas_limit().unwrap_or_default(),
                tip: tx.tip(),
            })
            .collect()
    }