[dependencies] web-view = "0.7.3" use std::thread; use web_view::*; fn main() { let handle = thread::spawn(|| { let webview = web_view::builder() .title("") .content(Content::Html("<html><body><center>Hello, world!</center></body></html>")) .size(250, 100) .resizable(true) .debug(true) .user_data(()) .frameless(true) .invoke_handler(|_webview, _arg| { Ok(()) }) .build() .unwrap(); webview.run().unwrap(); }); // Wait for the window to be created thread::sleep(std::time::Duration::from_secs(3)); // Close the window by terminating the thread handle.thread().unpark(); }
标签:web,use,窗口,thread,关闭,webview,true,rust,view From: https://www.cnblogs.com/pythonClub/p/17287880.html