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: mesh.rs
    path of file: ./repos/egui/crates/epaint/src
    
    the code of the file until where you have to start completion: use crate::*;
use emath::*;

/// The 2D vertex type.
///
/// Should be friendly to send to GPU as is.
#[repr(C)]
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
#[cfg(not(feature = "unity"))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
pub struct Vertex {
    /// Logical pixel coordinates (points).
    /// (0,0) is the top left corner of the scree
    
    pub fn split_to_u16(self) -> Vec<Mesh16> {
        crate::epaint_assert!(self.is_valid());

        const MAX_SIZE: u32 = std::u16::MAX as u32;

        if self.vertices.len() <= MAX_SIZE as usize {
            // Common-case optimization:
            return vec![Mesh16 {
                indices: self.indices.iter().map(|&i| i as u16).collect(),
                vertices: self.vertices,
                texture_id: self.texture_id,
            }];
        }

        let mut output = vec![];
        let mut index_cursor = 0;

        while index_cursor < self.indices.len() {
            let span_start = index_cursor;
            let mut min_vindex = self.indices[index_cursor];
            let mut max_vindex = self.indices[index_cursor];

            while index_cursor < self.indices.len() {
                let (mut new_min, mut new_max) = (min_vindex, max_vindex);
                for i in 0..3 {
                    let idx = self.indices[index_cursor + i];
                    new_min = new_min.min(idx);
                    new_max = new_max.max(idx);
                }

                let new_span_size = new_max - new_min + 1; // plus one, because it is an inclusive range
                if new_span_size <= MAX_SIZE {
                    // Triangle fits
                    min_vindex = new_min;
                    max_vindex = new_max;
                    index_cursor += 3;
                } else {
                    break;
                }
            }

            assert!(
                index_cursor > span_start,
                "One triangle spanned more than {MAX_SIZE} vertices"
            );

            let mesh = Mesh16 {
                indices: self.indices[span_start..index_cursor]
                    .iter()
                    .map(|vi| u16::try_from(vi - min_vindex).unwrap())
                    .collect(),
                vertices: self.vertices[(min_vindex as usize)..=(max_vindex as usize)].to_vec(),
                texture_id: self.texture_id,
            };
            crate::epaint_assert!(mesh.is_valid());
            output.push(mesh);
        }
        output
    }