Skip to main content

SurfacePump

Struct SurfacePump 

Source
pub struct SurfacePump<T: Send + 'static> { /* private fields */ }
Expand description

Owning handle for the pump. On Windows, dropping it shuts the thread down (bounded join, then detach - a thread wedged in a driver call is left behind rather than hanging the GUI thread).

Implementations§

Source§

impl<T: Send + 'static> SurfacePump<T>

Source

pub unsafe fn spawn( window: &Window<'_>, device_lost: &Arc<AtomicBool>, init: PumpInitFn<T>, ) -> Option<Self>

Build the pump for a baseview window. On Windows this spawns the pump thread and returns immediately (GPU init runs there; poll Self::take_init); elsewhere init runs synchronously and take_init succeeds on the first call.

device_lost is raised if the pump thread panics so the editor’s device-loss recovery can rebuild with a fresh pump.

§Safety

The window must remain valid while the pump lives - the editor guarantees this by dropping the pump before closing its child window (a destroyed HWND fails surface creation with a driver error, not UB).

Source

pub fn take_init(&mut self) -> Option<T>

Poll for the init closure’s product (non-blocking). Returns it exactly once.

Source

pub fn client(&self) -> PumpClient

Auto Trait Implementations§

§

impl<T> Freeze for SurfacePump<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for SurfacePump<T>
where T: RefUnwindSafe,

§

impl<T> Send for SurfacePump<T>

§

impl<T> Sync for SurfacePump<T>
where T: Sync,

§

impl<T> Unpin for SurfacePump<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for SurfacePump<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for SurfacePump<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,