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: main.rs
    path of file: ./repos/three-d/examples/lights/src
    
    the code of the file until where you have to start completion: // Entry point for non-wasm
#[cfg(not(target_arch = "wasm32"))]
#[tokio::main]
async fn main() {
    run().await;
}

use rand::prelude::*;
use three_d::*;

pub async fn run() {
    let window = Window::new(WindowSettings {
        title: "Lights!".to_string(),
        max_size: Some((1280, 720)),
        ..Default::default()
    })
    .unwrap();
    let context = window.gl();

    let mut camera = Camera::new_perspective(
        window.viewport(),
        vec3(10.0, 1.0, 0.0),
        vec3(0.0, 1.0, 0.0),
        vec3(0.0, 1.0, 0.0),
        degrees(45.0),
        0.1,
        5000.0,
    );
    let mut control = FlyControl::new(0.01);
    let mut gui = three_d::GUI::new(&context);

    let mut loaded = if let Ok(loaded) =
        three_d_asset::io::load_async(&["../assets/sponza/Sponza.gltf"]).await
    {
        loaded
    } else {
        three_d_asset::io::load_async(&["https://asny.github.io/three-d/assets/sponza/Sponza.gltf"])
            .await
            .expect("failed to download the necessary assets, to enable running this example offline, place the relevant assets in a folder called 'assets' next to the three-d source")
    };

    let model = loaded.deserialize("Sponza.gltf").unwrap();
    let model = Model::<DeferredPhysicalMaterial>::new
    
pub async fn run() {
    let window = Window::new(WindowSettings {
        title: "Lights!".to_string(),
        max_size: Some((1280, 720)),
        ..Default::default()
    })
    .unwrap();
    let context = window.gl();

    let mut camera = Camera::new_perspective(
        window.viewport(),
        vec3(10.0, 1.0, 0.0),
        vec3(0.0, 1.0, 0.0),
        vec3(0.0, 1.0, 0.0),
        degrees(45.0),
        0.1,
        5000.0,
    );
    let mut control = FlyControl::new(0.01);
    let mut gui = three_d::GUI::new(&context);

    let mut loaded = if let Ok(loaded) =
        three_d_asset::io::load_async(&["../assets/sponza/Sponza.gltf"]).await
    {
        loaded
    } else {
        three_d_asset::io::load_async(&["https://asny.github.io/three-d/assets/sponza/Sponza.gltf"])
            .await
            .expect("failed to download the necessary assets, to enable running this example offline, place the relevant assets in a folder called 'assets' next to the three-d source")
    };

    let model = loaded.deserialize("Sponza.gltf").unwrap();
    let model = Model::<DeferredPhysicalMaterial>::new(&context, &model).unwrap();

    let mut aabb = AxisAlignedBoundingBox::EMPTY;
    for m in model.iter() {
        aabb.expand_with_aabb(&m.aabb());
    }

    let size = aabb.size();
    let min = aabb.min() + vec3(size.x * 0.1, size.y * 0.1, size.z * 0.4);
    let max = aabb.max() - vec3(size.x * 0.1, size.y * 0.3, size.z * 0.4);
    let light_box = AxisAlignedBoundingBox::new_with_positions(&[min, max]);
    let mut lights = Vec::new();

    // main loop
    let mut intensity = 3.0;
    let mut constant = 0.0;
    let mut linear = 0.5;
    let mut quadratic = 0.5;
    let mut light_count = 20;
    let mut color = [1.0; 4];
    window.render_loop(move |mut frame_input| {
        let mut panel_width = 0.0;
        gui.update(
            &mut frame_input.events,
            frame_input.accumulated_time,
            frame_input.viewport,
            frame_input.device_pixel_ratio,
            |gui_context| {
                use three_d::egui::*;
                SidePanel::left("side_panel").show(gui_context, |ui| {
                    ui.heading("Debug Panel");
                    ui.add(Slider::new::<usize>(&mut light_count, 0..=50).text("Light count"));
                    ui.add(Slider::new::<f32>(&mut intensity, 0.0..=10.0).text("Light intensity"));
                    ui.add(
                        Slider::new::<f32>(&mut constant, 0.0..=10.0).text("Attenuation constant"),
                    );
                    ui.add(Slider::new::<f32>(&mut linear, 0.01..=1.0).text("Attenuation linear"));
                    ui.add(
                        Slider::new::<f32>(&mut quadratic, 0.0001..=1.0)
                            .text("Attenuation quadratic"),
                    );
                    ui.color_edit_button_rgba_unmultiplied(&mut color);

                    ui.label("Tone mapping");
                    ui.radio_value(&mut camera.tone_mapping, ToneMapping::None, "None");
                    ui.radio_value(&mut camera.tone_mapping, ToneMapping::Reinhard, "Reinhard");
                    ui.radio_value(&mut camera.tone_mapping, ToneMapping::Aces, "Aces");
                    ui.radio_value(&mut camera.tone_mapping, ToneMapping::Filmic, "Filmic");
                });
                panel_width = gui_context.used_rect().width();
            },
        );
        while lights.len() < light_count {
            lights.push(Glow::new(&context, light_box));
        }
        while lights.len() > light_count {
            lights.pop();
        }

        for light in lights.iter_mut() {
            light.set_light(
                intensity,
                Srgba::from(color),
                Attenuation {
                    constant,
                    linear,
                    quadratic,
                },
            );
            light.update(0.00005 * size.magnitude() * frame_input.elapsed_time as f32);
        }
        let viewport = Viewport {
            x: (panel_width * frame_input.device_pixel_ratio) as i32,
            y: 0,
            width: frame_input.viewport.width
                - (panel_width * frame_input.device_pixel_ratio) as u32,
            height: frame_input.viewport.height,
        };
        camera.set_viewport(viewport);

        control.handle_events(&mut camera, &mut frame_input.events);

        frame_input
            .screen()
            .clear(ClearState::color_and_depth(0.2, 0.2, 0.8, 1.0, 1.0))
            .render(
                &camera,
                lights.iter().map(|l| l.object()).chain(&model),
                &lights.iter().map(|l| l.light()).collect::<Vec<_>>(),
            )
            .write(|| gui.render())
            .unwrap();

        FrameOutput::default()
    });
}