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: collapse.rs
    path of file: ./repos/nushell/crates/nu-table/src/types
    
    the code of the file until where you have to start completion: use nu_color_config::StyleComputer;
use nu_protocol::{Config, Record, TableMode, Value};

use crate::UnstructuredTable;

use crate::common::nu_value_to_string_clean;
use crate::{
    common::{get_index_style, load_theme},
    StringResult, TableOpts,
};

pub struct CollapsedTable;

impl CollapsedTable {
    pub fn build(value: Value, opts: TableOpts<'_>) -> StringResult {
        collapsed_table(
            value,
            opts.config,
            opts.width,
            opts.style_computer,
            opts.mode,
        )
    }
}

fn collapsed_table(
    mut value: Value,
    config: &Config,
    term_width: usize,
    style_computer: &StyleComputer,
    mode: TableMode,
) -> StringResult {
    colorize_value(&mut value, config
    
fn colorize_value(value: &mut Value, config: &Config, style_computer: &StyleComputer) {
    match value {
        Value::Record { ref mut val, .. } => {
            let style = get_index_style(style_computer);
            // Take ownership of the record and reassign to &mut
            // We do this to have owned keys through `.into_iter`
            let record = std::mem::take(val);
            *val = record
                .into_iter()
                .map(|(mut header, mut val)| {
                    colorize_value(&mut val, config, style_computer);

                    if let Some(color) = style.color_style {
                        header = color.paint(header).to_string();
                    }
                    (header, val)
                })
                .collect::<Record>();
        }
        Value::List { vals, .. } => {
            for val in vals {
                colorize_value(val, config, style_computer);
            }
        }
        value => {
            let (text, style) = nu_value_to_string_clean(value, config, style_computer);
            if let Some(color) = style.color_style {
                let text = color.paint(text).to_string();
                let span = value.span();
                *value = Value::string(text, span);
            }
        }
    }
}