rust 建立窗口并关闭。
[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(); }