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: wordlist.rs
    path of file: ./repos/trezor-firmware/core/embed/rust/src/ui/model_tr/component/input_methods
    
    the code of the file until where you have to start completion: use crate::{
    translations::TR,
    trezorhal::{random, wordlist::Wordlist},
    ui::{
        component::{text::common::TextBox, Child, Component, ComponentExt, Event, EventCtx},
        geometry::Rect,
        util::char_to_string,
    },
};

use super::super::{theme, ButtonLayout, ChangingTextLine, ChoiceFactory, ChoiceItem, ChoicePage};
use heapless::{String, Vec};

enum WordlistAction {
    Letter(char),
    Word(&'static str),
    Delete,
    Previous,
}

const MAX_WORD_LENGTH: usize = 10;

/// Offer words when there will be fewer of them than this
const OFFER_WORDS_THRESHOLD: usize = 10;

/// Where will be the DELETE option - at the first
    
    pub fn new(wordlist_type: WordlistType, prefix: &str) -> Self {
        let wordlist = match wordlist_type {
            WordlistType::Bip39 => Wordlist::bip39(),
            WordlistType::Slip39 => Wordlist::slip39(),
        }
        .filter_prefix(prefix);
        let offer_words = wordlist.len() < OFFER_WORDS_THRESHOLD;
        let word_random_order: Vec<usize, OFFER_WORDS_THRESHOLD> = if offer_words {
            // Filling slice with numbers 0..wordlist.len() and shuffling them
            let slice = &mut [0; OFFER_WORDS_THRESHOLD][..wordlist.len()];
            for (i, item) in slice.iter_mut().enumerate() {
                *item = i;
            }
            random::shuffle(slice);
            slice.iter().copied().collect()
        } else {
            Vec::new()
        };
        Self {
            wordlist,
            offer_words,
            word_random_order,
            empty_input: prefix.is_empty(),
        }
    }