Skip to main content

Frame

Struct Frame 

Source
pub struct Frame<'a> { /* private fields */ }
Expand description

The window an update is building, application-level window management, and shutdown.

update is called once per redraw of one window; window_key says which, and the Context passed alongside is that window’s alone. Draw each window’s content from your own data keyed by that window.

Implementations§

Source§

impl<'a> Frame<'a>

Source

pub fn window(&self) -> &Arc<Window> ⓘ

Native window of this frame for changing the title, requesting redraws, or cloning its Arc into a background worker that needs to wake the sleeping event loop.

Source

pub fn window_key(&self) -> &WindowKey

The key of the window being drawn: WindowKey::main in a single-window application.

Source

pub fn is_main(&self) -> bool

Whether this is the main window.

Source

pub fn info(&self) -> &WindowInfo

Size, scale factor and state of this window at the start of the frame.

Source

pub fn windows(&mut self) -> &mut Windows<'a>

Open, close, focus and inspect other windows; see Windows.

Source

pub fn open_window( &mut self, key: impl Into<WindowKey>, options: WindowOptions, ) -> OpenOutcome

Ask for a secondary window; sugar for Windows::open.

Source

pub fn close_window(&mut self, key: impl Into<WindowKey>)

Close one window now, without asking the application; see Windows::close.

Source

pub fn close_this_window(&mut self)

Close this window now, without asking: the way to confirm a close you rejected.

Source

pub fn request_close(&mut self)

Ask to close this window as the user would, so App::close_requested decides. Use it for an in-window close button that must honour the same confirmation.

Source

pub fn window_status(&self, key: &WindowKey) -> Option<&WindowStatus>

Where a requested window is, or None for a key that was never requested or has closed.

Source

pub fn stats(&self) -> AppStats

Counters over all windows.

Source

pub fn device_resets(&self) -> u64

How many times the runner has recreated the GPU renderer after a lost device. Recovery is automatic and covers every window; compare with the previous value to notice it.

Source

pub fn last_device_loss(&self) -> Option<&str>

The reason the GPU device was last lost, if it ever was.

Source

pub fn close(&mut self)

End the application after the current frame has been presented successfully, closing every window. To close only this window use close_this_window.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Frame<'a>

§

impl<'a> !UnwindSafe for Frame<'a>

§

impl<'a> Freeze for Frame<'a>

§

impl<'a> Send for Frame<'a>

§

impl<'a> Sync for Frame<'a>

§

impl<'a> Unpin for Frame<'a>

§

impl<'a> UnsafeUnpin for Frame<'a>

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 for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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 = !

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

fn try_from(value: U) -> Result<T, !>

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,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more