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: timepicker.rs
    path of file: ./repos/vizia/crates/vizia_core/src/views
    
    the code of the file until where you have to start completion: use std::marker::PhantomData;

use crate::prelude::*;
use chrono::{NaiveTime, Timelike};

use super::spinbox::SpinboxIcons;

#[derive(PartialEq, Clone, Copy, Debug)]
pub enum AMOrPM {
    AM,
    PM,
}

#[derive(PartialEq, Lens, Clone, Copy, Debug)]
pub struct DayTime {
    pub hour: u8,
    pub minutes: u8,
    pub zone: AMOrPM,
}

#[derive(Lens)]
pub struct Timepicker {
    on_change: Option<Box<dyn Fn(&mut EventContext, NaiveTime)>>,
}

pub enum TimepickerEvent {
    Change(NaiveTime),
    ChangePage(AnalogTimepickerPage),
}

impl Timepicker {
    pub fn new<L, T>(cx: &mut Context, lens: L) -> Handle<Self>
    where
        L: Lens<Target = T>,
        T: Timelike + Data + Copy,
    {
        Self { on_change: None }
            .build(cx, move |cx| {
                DigitalTimepicker::new(cx, lens)
                    .on_change(|cx, time| cx.emit(TimepickerEvent::Change(time)));
                AnalogTimepicker::new(cx, lens)
                    .on_change(|cx, time| cx.emit(TimepickerEvent::Change
    
    pub fn new(cx: &mut Context, lens: L) -> Handle<Self> {
        Self { lens, p: PhantomData, on_change: None }
            .build(cx, move |cx| {
                Spinbox::custom(
                    cx,
                    |cx| {
                        Textbox::new(cx, lens.map(|time| format!("{:#02}", time.hour12().1)))
                            .on_submit(|cx, text, _| {
                                if let Ok(parsed) = text.parse::<u32>() {
                                    if parsed < 24 {
                                        cx.emit(DigitalTimepickerEvent::SetHour(parsed))
                                    }
                                }
                            })
                            .width(Pixels(38.))
                            .overflow(Overflow::Hidden)
                    },
                    SpinboxKind::Vertical,
                    SpinboxIcons::PlusMinus,
                )
                .on_increment(|ex| ex.emit(DigitalTimepickerEvent::IncrementHour))
                .on_decrement(|ex| ex.emit(DigitalTimepickerEvent::DecrementHour))
                .on_press_down(|cx| {
                    cx.emit(TimepickerEvent::ChangePage(AnalogTimepickerPage::Hours))
                });
                VStack::new(cx, |cx| {
                    Element::new(cx).class("digitaltimepicker-dot");
                    Element::new(cx).class("digitaltimepicker-dot");
                })
                .class("digitaltimepicker-dots-wrapper");
                Spinbox::custom(
                    cx,
                    |cx| {
                        Textbox::new(cx, lens.map(|time| format!("{:#02}", time.minute())))
                            .on_submit(|cx, text, _| {
                                if let Ok(parsed) = text.parse::<u32>() {
                                    if parsed < 60 {
                                        cx.emit(DigitalTimepickerEvent::SetMinutes(parsed))
                                    }
                                }
                            })
                            .width(Pixels(38.))
                            .overflow(Overflow::Hidden)
                    },
                    SpinboxKind::Vertical,
                    SpinboxIcons::PlusMinus,
                )
                .on_increment(|ex| ex.emit(DigitalTimepickerEvent::IncrementMinutes))
                .on_decrement(|ex| ex.emit(DigitalTimepickerEvent::DecrementMinutes))
                .on_press_down(|cx| {
                    cx.emit(TimepickerEvent::ChangePage(AnalogTimepickerPage::Minutes))
                });
                VStack::new(cx, |cx| {
                    Button::new(
                        cx,
                        |cx| cx.emit(DigitalTimepickerEvent::ToggleAMOrPM),
                        |cx| {
                            Label::new(
                                cx,
                                lens.map(|time| match time.hour12().0 {
                                    false => "AM",
                                    true => "PM",
                                }),
                            )
                        },
                    );
                })
                .class("digitaltimepicker-button-wrapper");
            })
            .layout_type(LayoutType::Row)
    }