libcosmic/cosmic/iced/daemon/program/graphics/trait.Layer.html
2026-04-18 20:11:25 +00:00

30 lines
No EOL
14 KiB
HTML

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A layer of graphical primitives."><title>Layer in cosmic::iced::daemon::program::graphics - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../../../static.files/rustdoc-aa0817cf.css"><meta name="rustdoc-vars" data-root-path="../../../../../" data-static-root-path="../../../../../static.files/" data-current-crate="cosmic" data-themes="" data-resource-suffix="" data-rustdoc-version="1.90.0-nightly (3048886e5 2025-07-30)" data-channel="nightly" data-search-js="search-fa3e91e5.js" data-settings-js="settings-5514c975.js" ><script src="../../../../../static.files/storage-68b7e25d.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../../../static.files/main-eebb9057.js"></script><noscript><link rel="stylesheet" href="../../../../../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../../../cosmic/index.html">cosmic</a><span class="version">1.0.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Layer</a></h2><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.bounds" title="bounds">bounds</a></li><li><a href="#tymethod.end" title="end">end</a></li><li><a href="#tymethod.flush" title="flush">flush</a></li><li><a href="#tymethod.merge" title="merge">merge</a></li><li><a href="#tymethod.reset" title="reset">reset</a></li><li><a href="#tymethod.resize" title="resize">resize</a></li><li><a href="#tymethod.start" title="start">start</a></li><li><a href="#tymethod.with_bounds" title="with_bounds">with_bounds</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-Layer-for-Layer" title="Layer">Layer</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>iced::<wbr>daemon::<wbr>program::<wbr>graphics</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../../index.html">cosmic</a>::<wbr><a href="../../../index.html">iced</a>::<wbr><a href="../../index.html">daemon</a>::<wbr><a href="../index.html">program</a>::<wbr><a href="index.html">graphics</a></div><h1>Trait <span class="trait">Layer</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>pub trait Layer: <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> {
// Required methods
fn <a href="#tymethod.with_bounds" class="fn">with_bounds</a>(bounds: <a class="struct" href="../../../struct.Rectangle.html" title="struct cosmic::iced::Rectangle">Rectangle</a>) -&gt; Self;
<span class="item-spacer"></span> fn <a href="#tymethod.bounds" class="fn">bounds</a>(&amp;self) -&gt; <a class="struct" href="../../../struct.Rectangle.html" title="struct cosmic::iced::Rectangle">Rectangle</a>;
<span class="item-spacer"></span> fn <a href="#tymethod.flush" class="fn">flush</a>(&amp;mut self);
<span class="item-spacer"></span> fn <a href="#tymethod.resize" class="fn">resize</a>(&amp;mut self, bounds: <a class="struct" href="../../../struct.Rectangle.html" title="struct cosmic::iced::Rectangle">Rectangle</a>);
<span class="item-spacer"></span> fn <a href="#tymethod.reset" class="fn">reset</a>(&amp;mut self);
<span class="item-spacer"></span> fn <a href="#tymethod.start" class="fn">start</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>;
<span class="item-spacer"></span> fn <a href="#tymethod.end" class="fn">end</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>;
<span class="item-spacer"></span> fn <a href="#tymethod.merge" class="fn">merge</a>(&amp;mut self, _layer: &amp;mut Self);
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A layer of graphical primitives.</p>
<p>Layers normally dictate a set of primitives that are
rendered in a specific order.</p>
</div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.with_bounds" class="method"><h4 class="code-header">fn <a href="#tymethod.with_bounds" class="fn">with_bounds</a>(bounds: <a class="struct" href="../../../struct.Rectangle.html" title="struct cosmic::iced::Rectangle">Rectangle</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Creates a new <a href="trait.Layer.html" title="trait cosmic::iced::daemon::program::graphics::Layer"><code>Layer</code></a> with the given bounds.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.bounds" class="method"><h4 class="code-header">fn <a href="#tymethod.bounds" class="fn">bounds</a>(&amp;self) -&gt; <a class="struct" href="../../../struct.Rectangle.html" title="struct cosmic::iced::Rectangle">Rectangle</a></h4></section></summary><div class="docblock"><p>Returns the current bounds of the <a href="trait.Layer.html" title="trait cosmic::iced::daemon::program::graphics::Layer"><code>Layer</code></a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.flush" class="method"><h4 class="code-header">fn <a href="#tymethod.flush" class="fn">flush</a>(&amp;mut self)</h4></section></summary><div class="docblock"><p>Flushes and settles any pending group of primitives in the <a href="trait.Layer.html" title="trait cosmic::iced::daemon::program::graphics::Layer"><code>Layer</code></a>.</p>
<p>This will be called when a <a href="trait.Layer.html" title="trait cosmic::iced::daemon::program::graphics::Layer"><code>Layer</code></a> is finished. It allows layers to efficiently
record primitives together and defer grouping until the end.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.resize" class="method"><h4 class="code-header">fn <a href="#tymethod.resize" class="fn">resize</a>(&amp;mut self, bounds: <a class="struct" href="../../../struct.Rectangle.html" title="struct cosmic::iced::Rectangle">Rectangle</a>)</h4></section></summary><div class="docblock"><p>Resizes the <a href="trait.Layer.html" title="trait cosmic::iced::daemon::program::graphics::Layer"><code>Layer</code></a> to the given bounds.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.reset" class="method"><h4 class="code-header">fn <a href="#tymethod.reset" class="fn">reset</a>(&amp;mut self)</h4></section></summary><div class="docblock"><p>Clears all the layers contents and resets its bounds.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.start" class="method"><h4 class="code-header">fn <a href="#tymethod.start" class="fn">start</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Returns the start level of the <a href="trait.Layer.html" title="trait cosmic::iced::daemon::program::graphics::Layer"><code>Layer</code></a>.</p>
<p>A level is a “sublayer” index inside of a <a href="trait.Layer.html" title="trait cosmic::iced::daemon::program::graphics::Layer"><code>Layer</code></a>.</p>
<p>A <a href="trait.Layer.html" title="trait cosmic::iced::daemon::program::graphics::Layer"><code>Layer</code></a> may draw multiple primitive types in a certain order.
The level represents the lowest index of the primitive types it
contains.</p>
<p>Two layers A and B can therefore be merged if they have the same bounds,
and the end level of A is lower or equal than the start level of B.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.end" class="method"><h4 class="code-header">fn <a href="#tymethod.end" class="fn">end</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Returns the end level of the <a href="trait.Layer.html" title="trait cosmic::iced::daemon::program::graphics::Layer"><code>Layer</code></a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.merge" class="method"><h4 class="code-header">fn <a href="#tymethod.merge" class="fn">merge</a>(&amp;mut self, _layer: &amp;mut Self)</h4></section></summary><div class="docblock"><p>Merges a <a href="trait.Layer.html" title="trait cosmic::iced::daemon::program::graphics::Layer"><code>Layer</code></a> with the current one.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/nightly/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-Layer-for-Layer" class="impl"><a href="#impl-Layer-for-Layer" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Layer.html" title="trait cosmic::iced::daemon::program::graphics::Layer">Layer</a> for Layer</h3></section></summary><div class="impl-items"><section id="method.with_bounds" class="method trait-impl"><a href="#method.with_bounds" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.with_bounds" class="fn">with_bounds</a>(bounds: <a class="struct" href="../../../struct.Rectangle.html" title="struct cosmic::iced::Rectangle">Rectangle</a>) -&gt; Layer</h4></section><section id="method.bounds" class="method trait-impl"><a href="#method.bounds" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.bounds" class="fn">bounds</a>(&amp;self) -&gt; <a class="struct" href="../../../struct.Rectangle.html" title="struct cosmic::iced::Rectangle">Rectangle</a></h4></section><section id="method.flush" class="method trait-impl"><a href="#method.flush" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.flush" class="fn">flush</a>(&amp;mut self)</h4></section><section id="method.resize" class="method trait-impl"><a href="#method.resize" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.resize" class="fn">resize</a>(&amp;mut self, bounds: <a class="struct" href="../../../struct.Rectangle.html" title="struct cosmic::iced::Rectangle">Rectangle</a>)</h4></section><section id="method.reset" class="method trait-impl"><a href="#method.reset" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.reset" class="fn">reset</a>(&amp;mut self)</h4></section><section id="method.start" class="method trait-impl"><a href="#method.start" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.start" class="fn">start</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></h4></section><section id="method.end" class="method trait-impl"><a href="#method.end" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.end" class="fn">end</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></h4></section><section id="method.merge" class="method trait-impl"><a href="#method.merge" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.merge" class="fn">merge</a>(&amp;mut self, layer: &amp;mut Layer)</h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"></div><script src="../../../../../trait.impl/iced_graphics/layer/trait.Layer.js" data-ignore-extern-crates="iced_tiny_skia" async></script></section></div></main></body></html>