Simplify API of Viewer

This commit is contained in:
Hanno Braun 2025-03-28 19:58:33 +01:00
parent d19cd87020
commit 7b9613038c
2 changed files with 7 additions and 7 deletions

View File

@ -9,7 +9,7 @@ use winit::{
event::{ event::{
ElementState, KeyEvent, MouseButton, MouseScrollDelta, WindowEvent, ElementState, KeyEvent, MouseButton, MouseScrollDelta, WindowEvent,
}, },
event_loop::{ActiveEventLoop, EventLoop, EventLoopClosed, EventLoopProxy}, event_loop::{ActiveEventLoop, EventLoop, EventLoopProxy},
keyboard::{Key, NamedKey}, keyboard::{Key, NamedKey},
window::WindowId, window::WindowId,
}; };
@ -60,11 +60,11 @@ impl Viewer {
/// ///
/// This can fail, if the viewer thread is no longer running. Returns the /// This can fail, if the viewer thread is no longer running. Returns the
/// triangle mesh, wrapped in an error, if that is the case. /// triangle mesh, wrapped in an error, if that is the case.
pub fn display( pub fn display(&self, tri_mesh: TriMesh) {
&self, // If there's an error, that means the display thread has closed down
tri_mesh: TriMesh, // and we're on our way to shutting down as well. I don't think there's
) -> Result<(), EventLoopClosed<TriMesh>> { // much we can do about that.
self.event_loop.send_event(tri_mesh) let _ = self.event_loop.send_event(tri_mesh);
} }
} }

View File

@ -89,7 +89,7 @@ impl Instance {
} }
make_viewer_and_spawn_thread(|viewer| { make_viewer_and_spawn_thread(|viewer| {
let _ = viewer.display(tri_mesh); viewer.display(tri_mesh);
})?; })?;
Ok(()) Ok(())