diff --git a/src/desktop/space/element.rs b/src/desktop/space/element.rs index d623e6a..6752af9 100644 --- a/src/desktop/space/element.rs +++ b/src/desktop/space/element.rs @@ -35,6 +35,7 @@ pub type DynamicRenderElements = pub(super) type SpaceElem = dyn SpaceElement::Frame, ::Error, ::TextureId>; +/// Helper struct for iterating over diffrent layers of `DynamicRenderElements` pub(super) struct DynamicRenderElementMap<'a, R: Renderer>(pub(super) &'a [DynamicRenderElements]); impl<'a, R> DynamicRenderElementMap<'a, R> @@ -44,30 +45,37 @@ where R::Error: 'static, R::Frame: 'static, { + /// Iterate over `DynamicRenderElements` with layer `RenderLayer::Bottom` pub fn iter_bottom(&'a self) -> Box> + 'a> { self.iter_layer(RenderLayer::Bottom) } + /// Iterate over `DynamicRenderElements with layer `RenderLayer::AboveBackground` pub fn iter_above_background(&'a self) -> Box> + 'a> { self.iter_layer(RenderLayer::AboveBackground) } + /// Iterate over `DynamicRenderElements` with layer `RenderLayer::BeforeWindows` pub fn iter_before_windows(&'a self) -> Box> + 'a> { self.iter_layer(RenderLayer::BeforeWindows) } + /// Iterate over `DynamicRenderElements` with layer `RenderLayer::AfterWindows` pub fn iter_after_windows(&'a self) -> Box> + 'a> { self.iter_layer(RenderLayer::AfterWindows) } + /// Iterate over `DynamicRenderElements` with layer `RenderLayer::BeforeOverlay` pub fn iter_before_overlay(&'a self) -> Box> + 'a> { self.iter_layer(RenderLayer::BeforeOverlay) } + /// Iterate over `DynamicRenderElements` with layer `RenderLayer::Top` pub fn iter_top(&'a self) -> Box> + 'a> { self.iter_layer(RenderLayer::Top) } + /// Iterate over `DynamicRenderElements` with provided `layer` pub fn iter_layer(&'a self, layer: RenderLayer) -> Box> + 'a> { Box::new( self.0