Skip to main content

Scene

Struct Scene 

Source
pub struct Scene { /* private fields */ }
Expand description

An owned root view plus ordered overlays.

A scene is itself a View, so a host can pass it directly to paint. Overlays are rendered in insertion order and only the topmost one receives a focused render context.

Use ScopedScene when the root view borrows host-owned data that should not be cloned into this scene’s owned Element.

owned primitives demo

Implementations§

Source§

impl Scene

Source

pub fn new(root: Element) -> Self

Create a scene with no overlays.

Source

pub fn overlay(self, overlay: SceneOverlay) -> Self

Add an owned overlay.

Source

pub fn layer(self, view: Element, spec: OverlaySpec) -> Self

Add an owned view with a placement specification.

Source

pub fn dialog(self, dialog: Dialog) -> Self

Add a dialog composition.

Source

pub fn overlay_count(&self) -> usize

The number of overlay layers.

Source

pub fn sync_focus(&self, focus: &mut FocusRegistry)

Synchronize exclusive input ownership with the topmost overlay.

Call this after constructing the frame’s scene. A scene without an owner-bearing overlay releases overlay ownership.

Trait Implementations§

Source§

impl View for Scene

Source§

fn measure(&self, available: Size) -> Size

Report the intrinsic content size wanted given available.
Source§

fn render(&self, area: Rect, surface: &mut Surface<'_>, ctx: &RenderCtx<'_>)

Paint the view into the assigned area through surface.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Scene

§

impl !Send for Scene

§

impl !Sync for Scene

§

impl !UnwindSafe for Scene

§

impl Freeze for Scene

§

impl Unpin for Scene

§

impl UnsafeUnpin for Scene

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<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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
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.