pub struct Window<S> { /* private fields */ }
Expand description
Owned window handle.
Dropping the handle destroys the window.
Implementations§
Source§impl<S> Window<S>
impl<S> Window<S>
Sourcepub fn new<F>(
window_type: WindowType,
state: S,
wndproc: F,
) -> Result<Self, WindowCreationError>
pub fn new<F>( window_type: WindowType, state: S, wndproc: F, ) -> Result<Self, WindowCreationError>
Creates a new window with a wndproc
closure.
The state
parameter will be allocated alongside the closure. It is
meant as a convenient alternative to Rc<State>
to access to variables
from both inside and outside of the closure. A pinned reference to the
state is passed as first parameter the closure. Use Window::state()
to access the state from the outside.
Sourcepub fn new_checked<F>(
window_type: WindowType,
state: S,
wndproc: F,
) -> Result<Self, WindowCreationError>
pub fn new_checked<F>( window_type: WindowType, state: S, wndproc: F, ) -> Result<Self, WindowCreationError>
Same as Window::new()
but allows the closure to be FnMut
.
Internally uses a RefCell
for the closure to prevent it from being
re-entered by nested message loops (e.g., from modal dialogs). Forwards
nested messages to the default wndproc procedure.
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for Window<S>
impl<S> RefUnwindSafe for Window<S>where
S: RefUnwindSafe,
impl<S> !Send for Window<S>
impl<S> !Sync for Window<S>
impl<S> Unpin for Window<S>where
S: Unpin,
impl<S> UnwindSafe for Window<S>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more