pub enum PaintState {
PendingGpuResources {
window: Arc<dyn Window>,
rx: Receiver<Result<(GpuResources, Surface<'static>), GpuResourceError>>,
font_embolden: f32,
renderer: Renderer,
},
Initialized {
renderer: Renderer,
},
}Variants§
PendingGpuResources
The renderer is not yet initialized. This state is used to wait for the GPU resources to be acquired.
Fields
§
rx: Receiver<Result<(GpuResources, Surface<'static>), GpuResourceError>>§
renderer: RendererThis field holds an instance of Renderer::Uninitialized until the GPU resources are acquired,
which will be returned in PaintState::renderer and PaintState::renderer_mut.
All calls to renderer methods will be no-ops until the renderer is initialized.
Previously, PaintState::renderer and PaintState::renderer_mut would panic if called when the renderer was uninitialized.
However, this turned out to be hard to handle properly and led to panics, especially since the rest of the application code can’t control when the renderer is initialized.
Initialized
The renderer is initialized and ready to paint.
Implementations§
Source§impl PaintState
impl PaintState
pub fn new_pending( window: Arc<dyn Window>, rx: Receiver<Result<(GpuResources, Surface<'static>), GpuResourceError>>, scale: f64, size: Size, font_embolden: f32, ) -> Self
pub fn new( window: Arc<dyn Window>, surface: Surface<'static>, gpu_resources: GpuResources, scale: f64, size: Size, font_embolden: f32, ) -> Self
Auto Trait Implementations§
impl !Freeze for PaintState
impl !RefUnwindSafe for PaintState
impl Send for PaintState
impl !Sync for PaintState
impl Unpin for PaintState
impl !UnwindSafe for PaintState
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more