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
impl SceneSet
Sourcepub fn new(scenes: Vec<LayerScene>) -> Self
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.
Sourcepub fn slot_count(&self) -> usize
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.
Sourcepub fn scene_count(&self) -> usize
pub fn scene_count(&self) -> usize
How many slots hold a scene.
Sourcepub fn scene(&self, index: usize) -> Option<&LayerScene>
pub fn scene(&self, index: usize) -> Option<&LayerScene>
The scene at index, if that slot holds one.
Sourcepub fn scene_mut(&mut self, index: usize) -> Option<&mut LayerScene>
pub fn scene_mut(&mut self, index: usize) -> Option<&mut LayerScene>
The scene at index, mutably.
Sourcepub fn add_scene(&mut self, scene: LayerScene) -> usize
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.
Sourcepub fn remove_scene(&mut self, index: usize)
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.
Sourcepub fn add_layer(
&mut self,
spec: &LayerSpec,
) -> Result<SetLayerHandle, SetError>
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.
Sourcepub fn remove_layer(&mut self, handle: SetLayerHandle)
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.
Sourcepub fn slot_states(&self, wants_modeset: &[usize]) -> Vec<SlotState>
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.
Sourcepub fn plan_commits(
&self,
wants_modeset: &[usize],
policy: NarrowPolicy,
) -> Vec<Vec<usize>>
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.