pub(super) fn execute_in_thread<F>(&self, mut function: F)
    where
        F: FnMut() + Send + 'static,
    {
        unsafe {
            if self.in_event_loop_thread() {
                function();
            } else {
                // We double-box because the first box is a fat pointer.
                let boxed2: ThreadExecFn = Box::new(Box::new(function));

                let raw = Box::into_raw(boxed2);

                let res = PostMessageW(self.target_window, *EXEC_MSG_ID, raw as usize, 0);
                assert!(
                    res != false.into(),
                    "PostMessage failed; is the messages queue full?"
                );
            }
        }
    }
/// Executes a function in the event loop thread. If we're already in the event loop thread,
/// we just call the function directly.
///
/// The `Inserted` can be used to inject a `WindowState` for the callback to use. The state is
/// removed automatically if the callback receives a `WM_CLOSE` message for the window.
///
/// Note that if you are using this to change some property of a window and updating
/// `WindowState` then you should call this within the lock of `WindowState`. Otherwise the
/// events may be sent to the other thread in different order to the one in which you set
/// `WindowState`, leaving them out of sync.
///
/// Note that we use a FnMut instead of a FnOnce because we're too lazy to create an equivalent
/// to the unstable FnBox.
Executes a function in the event loop thread. If we're already in the event loop thread,
we just call the function directly.

The `Inserted` can be used to inject a `WindowState` for the callback to use. The state is
removed automatically if the callback receives a `WM_CLOSE` message for the window.

Note that if you are using this to change some property of a window and updating
`WindowState` then you should call this within the lock of `WindowState`. Otherwise the
events may be sent to the other thread in different order to the one in which you set
`WindowState`, leaving them out of sync.

Note that we use a FnMut instead of a FnOnce because we're too lazy to create an equivalent
to the unstable FnBox.
Executes a function in the event loop thread . If we ' re already in the event loop thread we just call the function directly . The ` Inserted ` can be used to inject a ` WindowState ` for the callback to use . The state is removed automatically if the callback receives a ` WM_CLOSE ` message for the window . Note that if you are using this to change some property of a window and updating ` WindowState ` then you should call this within the lock of ` WindowState ` . Otherwise the events may be sent to the other thread in different order to the one in which you set ` WindowState ` leaving them out of sync . Note that we use a FnMut instead of a FnOnce because we ' re too lazy to create an equivalent to the unstable FnBox .
pub(super) fn execute_in_thread<F>(&self, mut function: F)
    where
        F: FnMut() + Send + 'static,
    {
        unsafe {
            if self.in_event_loop_thread() {
                function();
            } else {
                // We double-box because the first box is a fat pointer.
                let boxed2: ThreadExecFn = Box::new(Box::new(function));
                let raw = Box::into_raw(boxed2);
                let res = PostMessageW(self.target_window, *EXEC_MSG_ID, raw as usize, 0);
                assert!(
                    res != false.into(),
                    "PostMessage failed; is the messages queue full?"
                );
            }
        }
    }
pub ( super ) fn execute_in_thread < F > ( & self , mut function : F ) where F : FnMut ( ) + Send + ' static , { unsafe { if self . in_event_loop_thread ( ) { function ( ) ; } else { // We double-box because the first box is a fat pointer. let boxed2 : ThreadExecFn = Box :: new ( Box :: new ( function ) ) ; let raw = Box :: into_raw ( boxed2 ) ; let res = PostMessageW ( self . target_window , * EXEC_MSG_ID , raw as usize , 0 ) ; assert ! ( res false into ( ) " " ) ; } } }
Executes a function in the event loop thread.
Executes a function in the event loop thread .
&self
function
F