INNER CODE UNIT · Rust
exit
versotile-org/verso · verso/src/lib.rs:183
pub fn exit(&self) -> Result<(), Box<ipc_channel::ErrorKind>> {
self.sender.send(ToVersoMessage::Exit)
}
/// Listen on close requested from the OS,
/// if you decide to use it, verso will not close the window by itself anymore,
/// so make sure you handle it properly by either do your own logic or call [`Self::exit`] as a fallback
pub fn on_close_requested(
&self,
callback: impl Fn() + Send + 'static,
) -> Result<(), Box<ipc_channel::ErrorKind>> {
let old_listener = self
.event_listeners
.on_close_requested
.lock()
.unwrap()
.replace(Box::new(callback));
if old_listener.is_none() {