Document Window Drop behavior (#3315)
This commit is contained in:
parent
d1717b6a01
commit
aec608f93c
1 changed files with 9 additions and 1 deletions
|
|
@ -19,6 +19,7 @@ use serde::{Deserialize, Serialize};
|
|||
|
||||
/// Represents a window.
|
||||
///
|
||||
/// The window is closed when dropped.
|
||||
///
|
||||
/// # Threading
|
||||
///
|
||||
|
|
@ -30,7 +31,6 @@ use serde::{Deserialize, Serialize};
|
|||
/// window from a thread other than the main, the code is scheduled to run on
|
||||
/// the main thread, and your thread may be blocked until that completes.
|
||||
///
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```no_run
|
||||
|
|
@ -54,6 +54,11 @@ use serde::{Deserialize, Serialize};
|
|||
/// }
|
||||
/// });
|
||||
/// ```
|
||||
///
|
||||
/// ## Platform-specific
|
||||
///
|
||||
/// **Web:** The [`Window`], which is represented by a `HTMLElementCanvas`, can
|
||||
/// not be closed by dropping the [`Window`].
|
||||
pub struct Window {
|
||||
pub(crate) window: platform_impl::Window,
|
||||
}
|
||||
|
|
@ -65,6 +70,9 @@ impl fmt::Debug for Window {
|
|||
}
|
||||
|
||||
impl Drop for Window {
|
||||
/// This will close the [`Window`].
|
||||
///
|
||||
/// See [`Window`] for more details.
|
||||
fn drop(&mut self) {
|
||||
self.window.maybe_wait_on_main(|w| {
|
||||
// If the window is in exclusive fullscreen, we must restore the desktop
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue