Skip to main content

SceneSet

Struct SceneSet 

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

Several scenes, with mirrored layers and a plan for how a frame across them is committed.

Implementations§

Source§

impl SceneSet

Source

pub fn new(scenes: Vec<LayerScene>) -> Self

A set over scenes, in the order given.

The index is the caller’s handle to an output for the set’s lifetime, so the order is theirs to choose and is never rearranged.

Source

pub fn slot_count(&self) -> usize

How many slots the set has, holes included.

Not how many scenes: a hole still occupies an index, because that is what keeps every other index meaning what it did.

Source

pub fn scene_count(&self) -> usize

How many slots hold a scene.

Source

pub fn scene(&self, index: usize) -> Option<&LayerScene>

The scene at index, if that slot holds one.

Source

pub fn scene_mut(&mut self, index: usize) -> Option<&mut LayerScene>

The scene at index, mutably.

Source

pub fn add_scene(&mut self, scene: LayerScene) -> usize

Add a scene, reusing a hole if there is one.

Reusing keeps the set from growing without bound as outputs come and go — a laptop docking and undocking all day would otherwise leave a slot behind each time.

Source

pub fn remove_scene(&mut self, index: usize)

Remove the scene at index, leaving a hole.

Out of range is a no-op, and so is a slot that is already a hole: both are what a caller reacting to an output that has gone away will do twice.

Source

pub fn add_layer( &mut self, spec: &LayerSpec, ) -> Result<SetLayerHandle, SetError>

Add one layer to every target scene.

§Errors

SetError::NoTargets for an empty target list, and SetError::NoSuchScene if a target names a slot the set does not have or that holds no scene. Checked before anything is added, so a spec naming three scenes and one bad index leaves the set as it was rather than half-populated.

Source

pub fn remove_layer(&mut self, handle: SetLayerHandle)

Remove every copy of a layer.

A handle that was never issued, or was issued and already removed, is ignored. The generation is what makes the second case safe: a slot reused by a later layer does not answer to the old handle.

Source

pub fn slot_states(&self, wants_modeset: &[usize]) -> Vec<SlotState>

What each slot looks like this frame, for the partition.

wants_modeset is the caller’s to say: the scene does not know whether the mode has been set, since the commit path owns the Modeset and this type does not commit for the caller.

Source

pub fn plan_commits( &self, wants_modeset: &[usize], policy: NarrowPolicy, ) -> Vec<Vec<usize>>

How this frame splits into commits.

The groups are slot indices, in the order they should be committed.

Trait Implementations§

Source§

impl Debug for SceneSet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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