Repository: nushell/nushell
File: crates/nu-protocol/src/config/table.rs (Rust)

Code before:
            "header_on_separator" => self.header_on_separator.into_value(span),
            "abbreviated_row_count" => abbv_count,
            "footer_inheritance" => self.footer_inheritance.into_value(span),
            "missing_value_symbol" => self.missing_value_symbol.into_value(span),
            "batch_duration" => self.batch_duration.into_value(span),
            "stream_page_size" => u16::from(self.stream_page_size).into_value(span),
        }
        .into_value(span)
    }
}

impl Default for TableConfig {
    fn default() -> Self {
        Self {
            mode: TableMode::Rounded,
            index_mode: TableIndexMode::Always,
            show_empty: true,
            trim: TrimStrategy::default(),
            header_on_separator: false,
            padding: TableIndent::default(),
            abbreviated_row_count: None,
            footer_inheritance: false,
            missing_value_symbol: "❎".into(),
            batch_duration: Duration::from_secs(1),
            // SAFETY: 1000 is non-zero.
            stream_page_size: unsafe { NonZeroU16::new_unchecked(1000) },
        }
    }
}

impl UpdateFromValue for TableConfig {
    fn update<'a>(
        &mut self,
        value: &'a Value,
        path: &mut ConfigPath<'a>,
        errors: &mut ConfigErrors,
    ) {
        let Value::Record { val: record, .. } = value else {
            errors.type_mismatch(path, Type::record(), value);
            return;
        };

        for (col, val) in record.iter() {
            let path = &mut path.push(col);
            match col.as_str() {
                "mode" => self.mode.update(val, path, errors),
                "index_mode" => self.index_mode.update(val, path, errors),
                "show_empty" => self.show_empty.update(val, path, errors),
                "trim" => self.trim.update(val, path, errors),
                "header_on_separator" => self.header_on_separator.update(val, path, errors),
                "padding" => self.padding.update(val, path, errors),

Review comment (suggestion):
```suggestion
            stream_page_size: const { NonZeroU16::new(1000).expect("Non zero integer") },
```
Surprisingly `Option::expect()` is a const function!

Code after:
            "header_on_separator" => self.header_on_separator.into_value(span),
            "abbreviated_row_count" => abbv_count,
            "footer_inheritance" => self.footer_inheritance.into_value(span),
            "missing_value_symbol" => self.missing_value_symbol.into_value(span),
            "batch_duration" => self.batch_duration.into_value(span),
            "stream_page_size" => self.stream_page_size.get().into_value(span),
        }
        .into_value(span)
    }
}

impl Default for TableConfig {
    fn default() -> Self {
        Self {
            mode: TableMode::Rounded,
            index_mode: TableIndexMode::Always,
            show_empty: true,
            trim: TrimStrategy::default(),
            header_on_separator: false,
            padding: TableIndent::default(),
            abbreviated_row_count: None,
            footer_inheritance: false,
            missing_value_symbol: "❎".into(),
            batch_duration: Duration::from_secs(1),
            stream_page_size: const { NonZeroU16::new(1000).expect("Non zero integer") },
        }
    }
}

impl UpdateFromValue for TableConfig {
    fn update<'a>(
        &mut self,
        value: &'a Value,
        path: &mut ConfigPath<'a>,
        errors: &mut ConfigErrors,
    ) {
        let Value::Record { val: record, .. } = value else {
            errors.type_mismatch(path, Type::record(), value);
            return;
        };

        for (col, val) in record.iter() {
            let path = &mut path.push(col);
            match col.as_str() {
                "mode" => self.mode.update(val, path, errors),
                "index_mode" => self.index_mode.update(val, path, errors),
                "show_empty" => self.show_empty.update(val, path, errors),
                "trim" => self.trim.update(val, path, errors),
                "header_on_separator" => self.header_on_separator.update(val, path, errors),
                "padding" => self.padding.update(val, path, errors),
                "abbreviated_row_count" => match val {