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: unitentry.rs
    path of file: ./repos/rnote/crates/rnote-ui/src
    
    the code of the file until where you have to start completion: // Imports
use gtk4::{
    glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate, DropDown, SpinButton,
    Widget,
};
use num_traits::ToPrimitive;
use once_cell::sync::Lazy;
use rnote_engine::document::format::MeasureUnit;
use std::cell::Cell;

mod imp {
    use super::*;

    #[derive(Debug, CompositeTemplate)]
    #[template(resource = "/com/github/flxzt/rnote/ui/unitentry.ui")]
    pub(crate) struct RnUnitEntry {
        pub(crate) value: Cell<f64>,
        pub(crate) unit: Cell<MeasureUnit>,
        pub(crate) dpi: Cell<f64>,

        #[template_child]
        pub(crate) value_spinner: TemplateChild<SpinButton>,
        #[template_child]
        pub(crate) unit_dropdown: TemplateChild<DropDown>,
    }

    impl Default for RnUnitEntry {
        fn default() -> Self {
            Self {
                value: Cell::new(1.0),
                unit: Cell::new(MeasureUnit::Px),
                dpi: Cell::new(96.0),
                value_spinner: TemplateChild::<S
    
        fn configure_spinner(&self, unit: MeasureUnit, dpi: f64) {
            let min_val = MeasureUnit::convert_measurement(
                Self::MIN_VAL_IN_PX,
                MeasureUnit::Px,
                dpi,
                unit,
                dpi,
            );
            let max_val = MeasureUnit::convert_measurement(
                Self::MAX_VAL_IN_PX,
                MeasureUnit::Px,
                dpi,
                unit,
                dpi,
            );

            let (step_increment, climb_rate, digits) = match unit {
                MeasureUnit::Px => (
                    Self::STEP_INCREMENT_PX,
                    Self::CLIMB_RATE_PX,
                    Self::DIGITS_PX,
                ),
                MeasureUnit::Mm => (
                    Self::STEP_INCREMENT_MM,
                    Self::CLIMB_RATE_MM,
                    Self::DIGITS_MM,
                ),
                MeasureUnit::Cm => (
                    Self::STEP_INCREMENT_CM,
                    Self::CLIMB_RATE_CM,
                    Self::DIGITS_CM,
                ),
            };

            self.value_spinner.set_range(min_val, max_val);
            self.value_spinner
                .set_increments(step_increment, 2.0 * step_increment);
            self.value_spinner.set_climb_rate(climb_rate);
            self.value_spinner.set_digits(digits);
        }