deploy: 95756b1a57
This commit is contained in:
commit
0fa87f2b35
16382 changed files with 734838 additions and 0 deletions
6
cosmic/cosmic_theme/palette/cast/derive.ArrayCast.html
Normal file
6
cosmic/cosmic_theme/palette/cast/derive.ArrayCast.html
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<!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="API documentation for the Rust `ArrayCast` derive in crate `cosmic`."><title>ArrayCast in cosmic::cosmic_theme::palette::cast - 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 derive"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Derive Macro <span class="derive">ArrayCast</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>#[derive(ArrayCast)]
|
||||
{
|
||||
<span class="comment">// Attributes available to this derive:</span>
|
||||
#[palette]
|
||||
}
|
||||
</code></pre></section></div></main></body></html>
|
||||
83
cosmic/cosmic_theme/palette/cast/enum.VecCastErrorKind.html
Normal file
83
cosmic/cosmic_theme/palette/cast/enum.VecCastErrorKind.html
Normal file
File diff suppressed because one or more lines are too long
19
cosmic/cosmic_theme/palette/cast/fn.from_array.html
Normal file
19
cosmic/cosmic_theme/palette/cast/fn.from_array.html
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<!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="Cast from an array to a color type."><title>from_array in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">from_array</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#203-205">Source</a> </span></div><pre class="rust item-decl"><code>pub fn from_array<T>(array: <T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>) -> T<div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from an array to a color type.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>array = [<span class="number">23</span>, <span class="number">198</span>, <span class="number">76</span>];
|
||||
<span class="macro">assert_eq!</span>(cast::from_array::<Srgb<u8>>(array), Srgb::new(<span class="number">23</span>, <span class="number">198</span>, <span class="number">76</span>));</code></pre></div>
|
||||
<p>It’s also possible to use <code>From</code> and <code>Into</code> when casting built-in types:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::Srgb;
|
||||
|
||||
<span class="kw">let </span>array = [<span class="number">23</span>, <span class="number">198</span>, <span class="number">76</span>];
|
||||
|
||||
<span class="comment">// Arrays implement `Into`:
|
||||
</span><span class="kw">let </span>color1: Srgb<u8> = array.into();
|
||||
|
||||
<span class="comment">// Colors implement `From`:
|
||||
</span><span class="kw">let </span>color2 = Srgb::from(array);</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
13
cosmic/cosmic_theme/palette/cast/fn.from_array_array.html
Normal file
13
cosmic/cosmic_theme/palette/cast/fn.from_array_array.html
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<!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="Cast from an array of arrays to an array of colors."><title>from_array_array in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">from_array_array</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#495-497">Source</a> </span></div><pre class="rust item-decl"><code>pub fn from_array_array<T, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>(
|
||||
values: [<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">N</a>],
|
||||
) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a><div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from an array of arrays to an array of colors.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>arrays = [[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]];
|
||||
<span class="macro">assert_eq!</span>(
|
||||
cast::from_array_array::<Srgb<u8>, <span class="number">2</span>>(arrays),
|
||||
[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]
|
||||
)</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
20
cosmic/cosmic_theme/palette/cast/fn.from_array_box.html
Normal file
20
cosmic/cosmic_theme/palette/cast/fn.from_array_box.html
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<!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="Cast from a boxed array to a boxed color type."><title>from_array_box in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">from_array_box</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#1008-1010">Source</a> </span></div><pre class="rust item-decl"><code>pub fn from_array_box<T>(value: <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>>) -> <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><T><div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a boxed array to a boxed color type.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>array = Box::new([<span class="number">23</span>, <span class="number">198</span>, <span class="number">76</span>]);
|
||||
<span class="macro">assert_eq!</span>(cast::from_array_box::<Srgb<u8>>(array), Box::new(Srgb::new(<span class="number">23</span>, <span class="number">198</span>, <span class="number">76</span>)));</code></pre></div>
|
||||
<p>It’s also possible to use <code>From</code> and <code>Into</code> when casting built-in types:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::Srgb;
|
||||
|
||||
|
||||
<span class="comment">// Boxed arrays implement `Into`:
|
||||
</span><span class="kw">let </span>array1 = Box::new([<span class="number">23</span>, <span class="number">198</span>, <span class="number">76</span>]);
|
||||
<span class="kw">let </span>color1: Box<Srgb<u8>> = array1.into();
|
||||
|
||||
<span class="comment">// Boxed colors implement `From`:
|
||||
</span><span class="kw">let </span>array2 = Box::new([<span class="number">23</span>, <span class="number">198</span>, <span class="number">76</span>]);
|
||||
<span class="kw">let </span>color2 = <Box<Srgb<u8>>>::from(array2);</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
23
cosmic/cosmic_theme/palette/cast/fn.from_array_mut.html
Normal file
23
cosmic/cosmic_theme/palette/cast/fn.from_array_mut.html
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<!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="Cast from a mutable array reference to a mutable color type reference."><title>from_array_mut in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">from_array_mut</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#373-375">Source</a> </span></div><pre class="rust item-decl"><code>pub fn from_array_mut<T>(value: &mut <T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut T</a><div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a mutable array reference to a mutable color type reference.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>array = [<span class="number">23</span>, <span class="number">198</span>, <span class="number">76</span>];
|
||||
<span class="macro">assert_eq!</span>(cast::from_array_mut::<Srgb<u8>>(<span class="kw-2">&mut </span>array), <span class="kw-2">&mut </span>Srgb::new(<span class="number">23</span>, <span class="number">198</span>, <span class="number">76</span>));</code></pre></div>
|
||||
<p>It’s also possible to use <code>From</code>, <code>Into</code> and <code>AsMut</code> when casting built-in
|
||||
types:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::Srgb;
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>array = [<span class="number">23</span>, <span class="number">198</span>, <span class="number">76</span>];
|
||||
|
||||
<span class="comment">// Arrays implement `AsMut`:
|
||||
</span><span class="kw">let </span>color1: <span class="kw-2">&mut </span>Srgb<u8> = array.as_mut();
|
||||
|
||||
<span class="comment">// Array references implement `Into`:
|
||||
</span><span class="kw">let </span>color2: <span class="kw-2">&mut </span>Srgb<u8> = (<span class="kw-2">&mut </span>array).into();
|
||||
|
||||
<span class="comment">// Color references implement `From`:
|
||||
</span><span class="kw">let </span>color3 = <<span class="kw-2">&mut </span>Srgb<u8>>::from(<span class="kw-2">&mut </span>array);</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
23
cosmic/cosmic_theme/palette/cast/fn.from_array_ref.html
Normal file
23
cosmic/cosmic_theme/palette/cast/fn.from_array_ref.html
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<!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="Cast from an array reference to a color type reference."><title>from_array_ref in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">from_array_ref</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#285-287">Source</a> </span></div><pre class="rust item-decl"><code>pub fn from_array_ref<T>(value: &<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&T</a><div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from an array reference to a color type reference.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>array = [<span class="number">23</span>, <span class="number">198</span>, <span class="number">76</span>];
|
||||
<span class="macro">assert_eq!</span>(cast::from_array_ref::<Srgb<u8>>(<span class="kw-2">&</span>array), <span class="kw-2">&</span>Srgb::new(<span class="number">23</span>, <span class="number">198</span>, <span class="number">76</span>));</code></pre></div>
|
||||
<p>It’s also possible to use <code>From</code>, <code>Into</code> and <code>AsRef</code> when casting built-in
|
||||
types:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::Srgb;
|
||||
|
||||
<span class="kw">let </span>array = [<span class="number">23</span>, <span class="number">198</span>, <span class="number">76</span>];
|
||||
|
||||
<span class="comment">// Arrays implement `AsRef`:
|
||||
</span><span class="kw">let </span>color1: <span class="kw-2">&</span>Srgb<u8> = array.as_ref();
|
||||
|
||||
<span class="comment">// Array references implement `Into`:
|
||||
</span><span class="kw">let </span>color2: <span class="kw-2">&</span>Srgb<u8> = (<span class="kw-2">&</span>array).into();
|
||||
|
||||
<span class="comment">// Color references implement `From`:
|
||||
</span><span class="kw">let </span>color3 = <<span class="kw-2">&</span>Srgb<u8>>::from(<span class="kw-2">&</span>array);</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
11
cosmic/cosmic_theme/palette/cast/fn.from_array_slice.html
Normal file
11
cosmic/cosmic_theme/palette/cast/fn.from_array_slice.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!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="Cast from a slice of arrays to a slice of colors."><title>from_array_slice in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">from_array_slice</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#661-663">Source</a> </span></div><pre class="rust item-decl"><code>pub fn from_array_slice<T>(values: &[<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>]) -> &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a><div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a slice of arrays to a slice of colors.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>arrays = <span class="kw-2">&</span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]];
|
||||
<span class="macro">assert_eq!</span>(
|
||||
cast::from_array_slice::<Srgb<u8>>(arrays),
|
||||
<span class="kw-2">&</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]
|
||||
)</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<!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="Cast from a boxed slice of arrays to a boxed slice of colors."><title>from_array_slice_box in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">from_array_slice_box</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#1084-1086">Source</a> </span></div><pre class="rust item-decl"><code>pub fn from_array_slice_box<T>(
|
||||
values: <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><[<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>]>,
|
||||
) -> <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>><div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a boxed slice of arrays to a boxed slice of colors.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>arrays = <span class="macro">vec!</span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]].into_boxed_slice();
|
||||
<span class="macro">assert_eq!</span>(
|
||||
cast::from_array_slice_box::<Srgb<u8>>(arrays),
|
||||
<span class="macro">vec!</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)].into_boxed_slice()
|
||||
)</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<!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="Cast from a mutable slice of arrays to a mutable slice of colors."><title>from_array_slice_mut in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">from_array_slice_mut</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#839-841">Source</a> </span></div><pre class="rust item-decl"><code>pub fn from_array_slice_mut<T>(
|
||||
values: &mut [<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>],
|
||||
) -> &mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a><div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a mutable slice of arrays to a mutable slice of colors.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>arrays = <span class="kw-2">&mut </span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]];
|
||||
<span class="macro">assert_eq!</span>(
|
||||
cast::from_array_slice_mut::<Srgb<u8>>(arrays),
|
||||
<span class="kw-2">&mut </span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]
|
||||
)</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
11
cosmic/cosmic_theme/palette/cast/fn.from_array_vec.html
Normal file
11
cosmic/cosmic_theme/palette/cast/fn.from_array_vec.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!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="Cast from a `Vec` of arrays to a `Vec` of colors."><title>from_array_vec in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">from_array_vec</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#1265-1267">Source</a> </span></div><pre class="rust item-decl"><code>pub fn from_array_vec<T>(values: <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>>) -> <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><T><div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a <code>Vec</code> of arrays to a <code>Vec</code> of colors.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>arrays = <span class="macro">vec!</span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]];
|
||||
<span class="macro">assert_eq!</span>(
|
||||
cast::from_array_vec::<Srgb<u8>>(arrays),
|
||||
<span class="macro">vec!</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]
|
||||
)</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<!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="Cast from an array of color components to an array of colors."><title>from_component_array in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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="#">from_<wbr>component_<wbr>array</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#panics" title="Panics">Panics</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">from_component_array</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#547-551">Source</a> </span></div><pre class="rust item-decl"><code>pub fn from_component_array<T, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, const M: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>(
|
||||
values: [<<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a> as <a class="trait" href="../trait.ArrayExt.html" title="trait cosmic::cosmic_theme::palette::ArrayExt">ArrayExt</a>>::<a class="associatedtype" href="../trait.ArrayExt.html#associatedtype.Item" title="type cosmic::cosmic_theme::palette::ArrayExt::Item">Item</a>; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">N</a>],
|
||||
) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; M]</a><div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from an array of color components to an array of colors.</p>
|
||||
<h3 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h3>
|
||||
<p>The cast will panic if the length of the input array is not a multiple of
|
||||
the color’s array length. This is unfortunately unavoidable until generic
|
||||
const expressions are stabilized.</p>
|
||||
<p>No <code>try_*</code> alternative is provided, since the array size can’t be changed
|
||||
during runtime.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>components = [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
<span class="macro">assert_eq!</span>(
|
||||
cast::from_component_array::<Srgb<u8>, <span class="number">6</span>, <span class="number">2</span>>(components),
|
||||
[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]
|
||||
);</code></pre></div>
|
||||
<p>This panics:</p>
|
||||
|
||||
<div class="example-wrap should_panic"><a href="#" class="tooltip" title="This example panics">ⓘ</a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>components = [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>]; <span class="comment">// Not a multiple of 3
|
||||
</span><span class="macro">assert_eq!</span>(
|
||||
cast::from_component_array::<Srgb<u8>, <span class="number">5</span>, <span class="number">2</span>>(components),
|
||||
[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]
|
||||
);</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<!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="The same as `try_from_component_slice` but panics on error."><title>from_component_slice in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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="#">from_<wbr>component_<wbr>slice</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#panics" title="Panics">Panics</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">from_component_slice</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#705-707">Source</a> </span></div><pre class="rust item-decl"><code>pub fn from_component_slice<T>(
|
||||
values: &[<<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a> as <a class="trait" href="../trait.ArrayExt.html" title="trait cosmic::cosmic_theme::palette::ArrayExt">ArrayExt</a>>::<a class="associatedtype" href="../trait.ArrayExt.html#associatedtype.Item" title="type cosmic::cosmic_theme::palette::ArrayExt::Item">Item</a>],
|
||||
) -> &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a><div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The same as <a href="fn.try_from_component_slice.html" title="fn cosmic::cosmic_theme::palette::cast::try_from_component_slice"><code>try_from_component_slice</code></a> but panics on error.</p>
|
||||
<h3 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h3>
|
||||
<p>The cast will panic if the length of the input slice is not a multiple of
|
||||
the color’s array length.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>components = <span class="kw-2">&</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
<span class="macro">assert_eq!</span>(
|
||||
cast::from_component_slice::<Srgb<u8>>(components),
|
||||
<span class="kw-2">&</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]
|
||||
)</code></pre></div>
|
||||
<p>This panics:</p>
|
||||
|
||||
<div class="example-wrap should_panic"><a href="#" class="tooltip" title="This example panics">ⓘ</a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>components = <span class="kw-2">&</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>, <span class="number">0</span>, <span class="number">123</span>]; <span class="comment">// Not a multiple of 3
|
||||
</span>cast::from_component_slice::<Srgb<u8>>(components);</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<!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="The same as `try_from_component_slice_box` but panics on error."><title>from_component_slice_box in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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="#">from_<wbr>component_<wbr>slice_<wbr>box</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#panics" title="Panics">Panics</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">from_component_slice_box</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#1124-1126">Source</a> </span></div><pre class="rust item-decl"><code>pub fn from_component_slice_box<T>(
|
||||
values: <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><[<<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a> as <a class="trait" href="../trait.ArrayExt.html" title="trait cosmic::cosmic_theme::palette::ArrayExt">ArrayExt</a>>::<a class="associatedtype" href="../trait.ArrayExt.html#associatedtype.Item" title="type cosmic::cosmic_theme::palette::ArrayExt::Item">Item</a>]>,
|
||||
) -> <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>><div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The same as <a href="fn.try_from_component_slice_box.html" title="fn cosmic::cosmic_theme::palette::cast::try_from_component_slice_box"><code>try_from_component_slice_box</code></a> but panics on error.</p>
|
||||
<h3 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h3>
|
||||
<p>The cast will panic if the length of the input slice is not a multiple of
|
||||
the color’s array length.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>components = <span class="macro">vec!</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>].into_boxed_slice();
|
||||
<span class="macro">assert_eq!</span>(
|
||||
cast::from_component_slice_box::<Srgb<u8>>(components),
|
||||
<span class="macro">vec!</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)].into_boxed_slice()
|
||||
)</code></pre></div>
|
||||
<p>This panics:</p>
|
||||
|
||||
<div class="example-wrap should_panic"><a href="#" class="tooltip" title="This example panics">ⓘ</a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="comment">// Not a multiple of 3:
|
||||
</span><span class="kw">let </span>components = <span class="macro">vec!</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>, <span class="number">0</span>, <span class="number">123</span>].into_boxed_slice();
|
||||
cast::from_component_slice_box::<Srgb<u8>>(components);</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<!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="The same as `try_from_component_slice_mut` but panics on error."><title>from_component_slice_mut in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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="#">from_<wbr>component_<wbr>slice_<wbr>mut</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#panics" title="Panics">Panics</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">from_component_slice_mut</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#883-885">Source</a> </span></div><pre class="rust item-decl"><code>pub fn from_component_slice_mut<T>(
|
||||
values: &mut [<<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a> as <a class="trait" href="../trait.ArrayExt.html" title="trait cosmic::cosmic_theme::palette::ArrayExt">ArrayExt</a>>::<a class="associatedtype" href="../trait.ArrayExt.html#associatedtype.Item" title="type cosmic::cosmic_theme::palette::ArrayExt::Item">Item</a>],
|
||||
) -> &mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a><div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The same as <a href="fn.try_from_component_slice_mut.html" title="fn cosmic::cosmic_theme::palette::cast::try_from_component_slice_mut"><code>try_from_component_slice_mut</code></a> but panics on error.</p>
|
||||
<h3 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h3>
|
||||
<p>The cast will panic if the length of the input slice is not a multiple of
|
||||
the color’s array length.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>components = <span class="kw-2">&mut </span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
<span class="macro">assert_eq!</span>(
|
||||
cast::from_component_slice_mut::<Srgb<u8>>(components),
|
||||
<span class="kw-2">&mut </span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]
|
||||
)</code></pre></div>
|
||||
<p>This panics:</p>
|
||||
|
||||
<div class="example-wrap should_panic"><a href="#" class="tooltip" title="This example panics">ⓘ</a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>components = <span class="kw-2">&mut </span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>, <span class="number">0</span>, <span class="number">123</span>]; <span class="comment">// Not a multiple of 3
|
||||
</span>cast::from_component_slice_mut::<Srgb<u8>>(components);</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
30
cosmic/cosmic_theme/palette/cast/fn.from_component_vec.html
Normal file
30
cosmic/cosmic_theme/palette/cast/fn.from_component_vec.html
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<!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="The same as `try_from_component_vec` but panics on error."><title>from_component_vec in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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="#">from_<wbr>component_<wbr>vec</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#panics" title="Panics">Panics</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">from_component_vec</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#1324-1326">Source</a> </span></div><pre class="rust item-decl"><code>pub fn from_component_vec<T>(
|
||||
values: <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><<<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a> as <a class="trait" href="../trait.ArrayExt.html" title="trait cosmic::cosmic_theme::palette::ArrayExt">ArrayExt</a>>::<a class="associatedtype" href="../trait.ArrayExt.html#associatedtype.Item" title="type cosmic::cosmic_theme::palette::ArrayExt::Item">Item</a>>,
|
||||
) -> <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><T><div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The same as <a href="fn.try_from_component_vec.html" title="fn cosmic::cosmic_theme::palette::cast::try_from_component_vec"><code>try_from_component_vec</code></a> but panics on error.</p>
|
||||
<h3 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h3>
|
||||
<p>The cast will panic if the length or capacity of the input <code>Vec</code> is not a
|
||||
multiple of the color’s array length.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>components = <span class="macro">vec!</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
<span class="macro">assert_eq!</span>(
|
||||
cast::from_component_vec::<Srgb<u8>>(components),
|
||||
<span class="macro">vec!</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]
|
||||
)</code></pre></div>
|
||||
<p>This panics due to the incorrect length:</p>
|
||||
|
||||
<div class="example-wrap should_panic"><a href="#" class="tooltip" title="This example panics">ⓘ</a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="comment">// Not a multiple of 3:
|
||||
</span><span class="kw">let </span>components = <span class="macro">vec!</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>, <span class="number">0</span>, <span class="number">123</span>];
|
||||
cast::from_component_vec::<Srgb<u8>>(components);</code></pre></div>
|
||||
<p>This panics due to the incorrect capacity:</p>
|
||||
|
||||
<div class="example-wrap should_panic"><a href="#" class="tooltip" title="This example panics">ⓘ</a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>components = <span class="macro">vec!</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
components.reserve_exact(<span class="number">2</span>); <span class="comment">// Not a multiple of 3
|
||||
</span>cast::from_component_vec::<Srgb<u8>>(components);</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
19
cosmic/cosmic_theme/palette/cast/fn.from_uint.html
Normal file
19
cosmic/cosmic_theme/palette/cast/fn.from_uint.html
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<!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="Cast from an unsigned integer to a color type."><title>from_uint in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">from_uint</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/uint.rs.html#93-95">Source</a> </span></div><pre class="rust item-decl"><code>pub fn from_uint<T>(uint: <T as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>) -> T<div class="where">where
|
||||
T: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from an unsigned integer to a color type.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, rgb::PackedArgb, Srgba};
|
||||
|
||||
<span class="kw">let </span>color: PackedArgb = Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into();
|
||||
<span class="macro">assert_eq!</span>(cast::from_uint::<PackedArgb>(<span class="number">0xFF17C64C</span>), color);</code></pre></div>
|
||||
<p>It’s also possible to use <code>From</code> and <code>Into</code> when casting built-in types:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::Srgba;
|
||||
|
||||
<span class="kw">let </span>uint = <span class="number">0xFF17C64C</span>;
|
||||
|
||||
<span class="comment">// Integers implement `Into`:
|
||||
</span><span class="kw">let </span>color1: Srgba<u8> = uint.into();
|
||||
|
||||
<span class="comment">// Colors implement `From`:
|
||||
</span><span class="kw">let </span>color2 = Srgba::from(uint);</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
13
cosmic/cosmic_theme/palette/cast/fn.from_uint_array.html
Normal file
13
cosmic/cosmic_theme/palette/cast/fn.from_uint_array.html
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<!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="Cast from an array of unsigned integers to an array of colors."><title>from_uint_array in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">from_uint_array</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/uint.rs.html#233-235">Source</a> </span></div><pre class="rust item-decl"><code>pub fn from_uint_array<T, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>(
|
||||
values: [<T as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">N</a>],
|
||||
) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a><div class="where">where
|
||||
T: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from an array of unsigned integers to an array of colors.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, rgb::PackedArgb, Srgba};
|
||||
|
||||
<span class="kw">let </span>colors: [PackedArgb; <span class="number">2</span>] = [
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
];
|
||||
<span class="macro">assert_eq!</span>(cast::from_uint_array::<PackedArgb, <span class="number">2</span>>([<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>]), colors)</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
8
cosmic/cosmic_theme/palette/cast/fn.from_uint_mut.html
Normal file
8
cosmic/cosmic_theme/palette/cast/fn.from_uint_mut.html
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<!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="Cast from a mutable unsigned integer reference to a mutable color type reference."><title>from_uint_mut in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">from_uint_mut</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/uint.rs.html#182-184">Source</a> </span></div><pre class="rust item-decl"><code>pub fn from_uint_mut<T>(value: &mut <T as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut T</a><div class="where">where
|
||||
T: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a mutable unsigned integer reference to a mutable color type reference.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, rgb::PackedArgb, Srgba};
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>color: PackedArgb = Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into();
|
||||
<span class="macro">assert_eq!</span>(cast::from_uint_mut::<PackedArgb>(<span class="kw-2">&mut </span><span class="number">0xFF17C64C</span>), <span class="kw-2">&mut </span>color);</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
8
cosmic/cosmic_theme/palette/cast/fn.from_uint_ref.html
Normal file
8
cosmic/cosmic_theme/palette/cast/fn.from_uint_ref.html
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<!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="Cast from an unsigned integer reference to a color type reference."><title>from_uint_ref in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">from_uint_ref</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/uint.rs.html#136-138">Source</a> </span></div><pre class="rust item-decl"><code>pub fn from_uint_ref<T>(value: &<T as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&T</a><div class="where">where
|
||||
T: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from an unsigned integer reference to a color type reference.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, rgb::PackedArgb, Srgba};
|
||||
|
||||
<span class="kw">let </span>color: PackedArgb = Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into();
|
||||
<span class="macro">assert_eq!</span>(cast::from_uint_ref::<PackedArgb>(<span class="kw-2">&</span><span class="number">0xFF17C64C</span>), <span class="kw-2">&</span>color);</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
11
cosmic/cosmic_theme/palette/cast/fn.from_uint_slice.html
Normal file
11
cosmic/cosmic_theme/palette/cast/fn.from_uint_slice.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!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="Cast from a slice of unsigned integers to a slice of colors."><title>from_uint_slice in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">from_uint_slice</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/uint.rs.html#283-285">Source</a> </span></div><pre class="rust item-decl"><code>pub fn from_uint_slice<T>(values: &[<T as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]) -> &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a><div class="where">where
|
||||
T: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a slice of unsigned integers to a slice of colors.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, rgb::PackedArgb, Srgba};
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&</span>[PackedArgb] = <span class="kw-2">&</span>[
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
];
|
||||
<span class="macro">assert_eq!</span>(cast::from_uint_slice::<PackedArgb>(<span class="kw-2">&</span>[<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>]), colors)</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
15
cosmic/cosmic_theme/palette/cast/fn.from_uint_slice_box.html
Normal file
15
cosmic/cosmic_theme/palette/cast/fn.from_uint_slice_box.html
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<!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="Cast from a boxed slice of unsigned integers to a boxed slice of colors."><title>from_uint_slice_box in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">from_uint_slice_box</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/uint.rs.html#394-396">Source</a> </span></div><pre class="rust item-decl"><code>pub fn from_uint_slice_box<T>(values: <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><[<T as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]>) -> <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>><div class="where">where
|
||||
T: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a boxed slice of unsigned integers to a boxed slice of colors.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, rgb::PackedArgb, Srgba};
|
||||
|
||||
<span class="kw">let </span>colors: Box<[PackedArgb]> = <span class="macro">vec!</span>[
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
].into_boxed_slice();
|
||||
|
||||
<span class="macro">assert_eq!</span>(
|
||||
cast::from_uint_slice_box(<span class="macro">vec!</span>[<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>].into_boxed_slice()),
|
||||
colors
|
||||
)</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
11
cosmic/cosmic_theme/palette/cast/fn.from_uint_slice_mut.html
Normal file
11
cosmic/cosmic_theme/palette/cast/fn.from_uint_slice_mut.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!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="Cast from a mutable slice of unsigned integers to a mutable slice of colors."><title>from_uint_slice_mut in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">from_uint_slice_mut</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/uint.rs.html#333-335">Source</a> </span></div><pre class="rust item-decl"><code>pub fn from_uint_slice_mut<T>(values: &mut [<T as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]) -> &mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a><div class="where">where
|
||||
T: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a mutable slice of unsigned integers to a mutable slice of colors.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, rgb::PackedArgb, Srgba};
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&mut </span>[PackedArgb] = <span class="kw-2">&mut </span>[
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
];
|
||||
<span class="macro">assert_eq!</span>(cast::from_uint_slice_mut::<PackedArgb>(<span class="kw-2">&mut </span>[<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>]), colors)</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
15
cosmic/cosmic_theme/palette/cast/fn.from_uint_vec.html
Normal file
15
cosmic/cosmic_theme/palette/cast/fn.from_uint_vec.html
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<!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="Cast from a `Vec` of unsigned integers to a `Vec` of colors."><title>from_uint_vec in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">from_uint_vec</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/uint.rs.html#460-462">Source</a> </span></div><pre class="rust item-decl"><code>pub fn from_uint_vec<T>(values: <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><<T as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>>) -> <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><T><div class="where">where
|
||||
T: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a <code>Vec</code> of unsigned integers to a <code>Vec</code> of colors.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, rgb::PackedArgb, Srgba};
|
||||
|
||||
<span class="kw">let </span>colors: Vec<PackedArgb> = <span class="macro">vec!</span>[
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
];
|
||||
|
||||
<span class="macro">assert_eq!</span>(
|
||||
cast::from_uint_vec::<PackedArgb>(<span class="macro">vec!</span>[<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>]),
|
||||
colors
|
||||
)</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
19
cosmic/cosmic_theme/palette/cast/fn.into_array.html
Normal file
19
cosmic/cosmic_theme/palette/cast/fn.into_array.html
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<!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="Cast from a color type to an array."><title>into_array in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">into_array</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#169-171">Source</a> </span></div><pre class="rust item-decl"><code>pub fn into_array<T>(color: T) -> <T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a><div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a color type to an array.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>color = Srgb::new(<span class="number">23u8</span>, <span class="number">198</span>, <span class="number">76</span>);
|
||||
<span class="macro">assert_eq!</span>(cast::into_array(color), [<span class="number">23</span>, <span class="number">198</span>, <span class="number">76</span>]);</code></pre></div>
|
||||
<p>It’s also possible to use <code>From</code> and <code>Into</code> when casting built-in types:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::Srgb;
|
||||
|
||||
<span class="kw">let </span>color = Srgb::new(<span class="number">23u8</span>, <span class="number">198</span>, <span class="number">76</span>);
|
||||
|
||||
<span class="comment">// Colors implement `Into`:
|
||||
</span><span class="kw">let </span>array1: [<span class="kw">_</span>; <span class="number">3</span>] = color.into();
|
||||
|
||||
<span class="comment">// Arrays implement `From`:
|
||||
</span><span class="kw">let </span>array2 = <[<span class="kw">_</span>; <span class="number">3</span>]>::from(color);</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
10
cosmic/cosmic_theme/palette/cast/fn.into_array_array.html
Normal file
10
cosmic/cosmic_theme/palette/cast/fn.into_array_array.html
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<!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="Cast from an array of colors to an array of arrays."><title>into_array_array in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">into_array_array</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#399-401">Source</a> </span></div><pre class="rust item-decl"><code>pub fn into_array_array<T, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>(
|
||||
values: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>,
|
||||
) -> [<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">N</a>]<div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from an array of colors to an array of arrays.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>colors = [Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="macro">assert_eq!</span>(cast::into_array_array(colors), [[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]])</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
19
cosmic/cosmic_theme/palette/cast/fn.into_array_box.html
Normal file
19
cosmic/cosmic_theme/palette/cast/fn.into_array_box.html
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<!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="Cast from a boxed color type to a boxed array."><title>into_array_box in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">into_array_box</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#966-968">Source</a> </span></div><pre class="rust item-decl"><code>pub fn into_array_box<T>(value: <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><T>) -> <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>><div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a boxed color type to a boxed array.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>color = Box::new(Srgb::new(<span class="number">23u8</span>, <span class="number">198</span>, <span class="number">76</span>));
|
||||
<span class="macro">assert_eq!</span>(cast::into_array_box(color), Box::new([<span class="number">23</span>, <span class="number">198</span>, <span class="number">76</span>]));</code></pre></div>
|
||||
<p>It’s also possible to use <code>From</code> and <code>Into</code> when casting built-in types:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::Srgb;
|
||||
|
||||
<span class="comment">// Boxed colors implement `Into`:
|
||||
</span><span class="kw">let </span>color1 = Box::new(Srgb::new(<span class="number">23u8</span>, <span class="number">198</span>, <span class="number">76</span>));
|
||||
<span class="kw">let </span>array1: Box<[<span class="kw">_</span>; <span class="number">3</span>]> = color1.into();
|
||||
|
||||
<span class="comment">// Boxed arrays implement `From`:
|
||||
</span><span class="kw">let </span>color2 = Box::new(Srgb::new(<span class="number">23u8</span>, <span class="number">198</span>, <span class="number">76</span>));
|
||||
<span class="kw">let </span>array2 = <Box<[<span class="kw">_</span>; <span class="number">3</span>]>>::from(color2);</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
22
cosmic/cosmic_theme/palette/cast/fn.into_array_mut.html
Normal file
22
cosmic/cosmic_theme/palette/cast/fn.into_array_mut.html
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<!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="Cast from a mutable color type reference to a mutable array reference."><title>into_array_mut in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">into_array_mut</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#329-331">Source</a> </span></div><pre class="rust item-decl"><code>pub fn into_array_mut<T>(value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut T</a>) -> &mut <T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a><div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a mutable color type reference to a mutable array reference.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>color = Srgb::new(<span class="number">23u8</span>, <span class="number">198</span>, <span class="number">76</span>);
|
||||
<span class="macro">assert_eq!</span>(cast::into_array_mut(<span class="kw-2">&mut </span>color), <span class="kw-2">&mut </span>[<span class="number">23</span>, <span class="number">198</span>, <span class="number">76</span>]);</code></pre></div>
|
||||
<p>It’s also possible to use <code>From</code>, <code>Into</code> and <code>AsMut</code> when casting built-in
|
||||
types:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::Srgb;
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>color = Srgb::new(<span class="number">23u8</span>, <span class="number">198</span>, <span class="number">76</span>);
|
||||
|
||||
<span class="comment">// Colors implement `AsMut`:
|
||||
</span><span class="kw">let </span>array1: <span class="kw-2">&mut </span>[<span class="kw">_</span>; <span class="number">3</span>] = color.as_mut();
|
||||
|
||||
<span class="comment">// Color references implement `Into`:
|
||||
</span><span class="kw">let </span>array2: <span class="kw-2">&mut </span>[<span class="kw">_</span>; <span class="number">3</span>] = (<span class="kw-2">&mut </span>color).into();
|
||||
<span class="comment">// Array references implement `From`:
|
||||
</span><span class="kw">let </span>array3 = <<span class="kw-2">&mut </span>[<span class="kw">_</span>; <span class="number">3</span>]>::from(<span class="kw-2">&mut </span>color);</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
22
cosmic/cosmic_theme/palette/cast/fn.into_array_ref.html
Normal file
22
cosmic/cosmic_theme/palette/cast/fn.into_array_ref.html
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<!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="Cast from a color type reference to an array reference."><title>into_array_ref in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">into_array_ref</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#241-243">Source</a> </span></div><pre class="rust item-decl"><code>pub fn into_array_ref<T>(value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&T</a>) -> &<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a><div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a color type reference to an array reference.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>color = Srgb::new(<span class="number">23u8</span>, <span class="number">198</span>, <span class="number">76</span>);
|
||||
<span class="macro">assert_eq!</span>(cast::into_array_ref(<span class="kw-2">&</span>color), <span class="kw-2">&</span>[<span class="number">23</span>, <span class="number">198</span>, <span class="number">76</span>]);</code></pre></div>
|
||||
<p>It’s also possible to use <code>From</code>, <code>Into</code> and <code>AsRef</code> when casting built-in
|
||||
types:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::Srgb;
|
||||
|
||||
<span class="kw">let </span>color = Srgb::new(<span class="number">23u8</span>, <span class="number">198</span>, <span class="number">76</span>);
|
||||
|
||||
<span class="comment">// Colors implement `AsRef`:
|
||||
</span><span class="kw">let </span>array1: <span class="kw-2">&</span>[<span class="kw">_</span>; <span class="number">3</span>] = color.as_ref();
|
||||
|
||||
<span class="comment">// Color references implement `Into`:
|
||||
</span><span class="kw">let </span>array2: <span class="kw-2">&</span>[<span class="kw">_</span>; <span class="number">3</span>] = (<span class="kw-2">&</span>color).into();
|
||||
<span class="comment">// Array references implement `From`:
|
||||
</span><span class="kw">let </span>array3 = <<span class="kw-2">&</span>[<span class="kw">_</span>; <span class="number">3</span>]>::from(<span class="kw-2">&</span>color);</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<!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="Cast from a slice of colors to a slice of arrays."><title>into_array_slice in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">into_array_slice</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#601-603">Source</a> </span></div><pre class="rust item-decl"><code>pub fn into_array_slice<T>(values: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>) -> &[<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>]<div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a slice of colors to a slice of arrays.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>colors = <span class="kw-2">&</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="macro">assert_eq!</span>(cast::into_array_slice(colors), <span class="kw-2">&</span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]])</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<!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="Cast from a boxed slice of colors to a boxed slice of arrays."><title>into_array_slice_box in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">into_array_slice_box</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#1038-1040">Source</a> </span></div><pre class="rust item-decl"><code>pub fn into_array_slice_box<T>(
|
||||
values: <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>>,
|
||||
) -> <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><[<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>]><div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a boxed slice of colors to a boxed slice of arrays.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>colors = <span class="macro">vec!</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)].into_boxed_slice();
|
||||
<span class="macro">assert_eq!</span>(
|
||||
cast::into_array_slice_box(colors),
|
||||
<span class="macro">vec!</span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]].into_boxed_slice()
|
||||
)</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<!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="Cast from a mutable slice of colors to a mutable slice of arrays."><title>into_array_slice_mut in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">into_array_slice_mut</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#776-778">Source</a> </span></div><pre class="rust item-decl"><code>pub fn into_array_slice_mut<T>(
|
||||
values: &mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>,
|
||||
) -> &mut [<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>]<div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a mutable slice of colors to a mutable slice of arrays.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>colors = <span class="kw-2">&mut </span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="macro">assert_eq!</span>(
|
||||
cast::into_array_slice_mut(colors),
|
||||
<span class="kw-2">&mut </span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]]
|
||||
)</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
11
cosmic/cosmic_theme/palette/cast/fn.into_array_vec.html
Normal file
11
cosmic/cosmic_theme/palette/cast/fn.into_array_vec.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!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="Cast from a `Vec` of colors to a `Vec` of arrays."><title>into_array_vec in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">into_array_vec</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#1199-1201">Source</a> </span></div><pre class="rust item-decl"><code>pub fn into_array_vec<T>(values: <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><T>) -> <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>><div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a <code>Vec</code> of colors to a <code>Vec</code> of arrays.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>colors = <span class="macro">vec!</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="macro">assert_eq!</span>(
|
||||
cast::into_array_vec(colors),
|
||||
<span class="macro">vec!</span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]]
|
||||
)</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<!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="Cast from an array of colors to an array of color components."><title>into_component_array in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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="#">into_<wbr>component_<wbr>array</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#panics" title="Panics">Panics</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">into_component_array</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#446-450">Source</a> </span></div><pre class="rust item-decl"><code>pub fn into_component_array<T, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, const M: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>(
|
||||
values: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>,
|
||||
) -> [<<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a> as <a class="trait" href="../trait.ArrayExt.html" title="trait cosmic::cosmic_theme::palette::ArrayExt">ArrayExt</a>>::<a class="associatedtype" href="../trait.ArrayExt.html#associatedtype.Item" title="type cosmic::cosmic_theme::palette::ArrayExt::Item">Item</a>; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">M</a>]<div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from an array of colors to an array of color components.</p>
|
||||
<h3 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h3>
|
||||
<p>It’s unfortunately not able to infer the length of the component array,
|
||||
until generic const expressions are stabilized. In the meantime, it’s going
|
||||
to panic if <code>M</code> isn’t <code>N * T::Array::LENGTH</code>. A future version will remove
|
||||
the <code>M</code> parameter and make the mismatch a compiler error.</p>
|
||||
<p>No <code>try_*</code> alternative is provided, since the array size can’t be changed
|
||||
during runtime.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>colors = [Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="macro">assert_eq!</span>(cast::into_component_array(colors), [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>])</code></pre></div>
|
||||
<p>It panics when the array lengths don’t match up:</p>
|
||||
|
||||
<div class="example-wrap should_panic"><a href="#" class="tooltip" title="This example panics">ⓘ</a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>colors = [Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="macro">assert_eq!</span>(cast::into_component_array(colors), [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>]) <span class="comment">// Too short</span></code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<!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="Cast from a slice of colors to a slice of color components."><title>into_component_slice in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">into_component_slice</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#626-628">Source</a> </span></div><pre class="rust item-decl"><code>pub fn into_component_slice<T>(
|
||||
values: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>,
|
||||
) -> &[<<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a> as <a class="trait" href="../trait.ArrayExt.html" title="trait cosmic::cosmic_theme::palette::ArrayExt">ArrayExt</a>>::<a class="associatedtype" href="../trait.ArrayExt.html#associatedtype.Item" title="type cosmic::cosmic_theme::palette::ArrayExt::Item">Item</a>]<div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a slice of colors to a slice of color components.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>colors = <span class="kw-2">&</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="macro">assert_eq!</span>(cast::into_component_slice(colors), <span class="kw-2">&</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>])</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<!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="Cast from a boxed slice of colors to a boxed slice of color components."><title>into_component_slice_box in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">into_component_slice_box</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#1061-1063">Source</a> </span></div><pre class="rust item-decl"><code>pub fn into_component_slice_box<T>(
|
||||
values: <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>>,
|
||||
) -> <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><[<<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a> as <a class="trait" href="../trait.ArrayExt.html" title="trait cosmic::cosmic_theme::palette::ArrayExt">ArrayExt</a>>::<a class="associatedtype" href="../trait.ArrayExt.html#associatedtype.Item" title="type cosmic::cosmic_theme::palette::ArrayExt::Item">Item</a>]><div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a boxed slice of colors to a boxed slice of color components.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>colors = <span class="macro">vec!</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)].into_boxed_slice();
|
||||
<span class="macro">assert_eq!</span>(
|
||||
cast::into_component_slice_box(colors),
|
||||
<span class="macro">vec!</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>].into_boxed_slice()
|
||||
)</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<!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="Cast from a slice of colors to a slice of color components."><title>into_component_slice_mut in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">into_component_slice_mut</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#804-806">Source</a> </span></div><pre class="rust item-decl"><code>pub fn into_component_slice_mut<T>(
|
||||
values: &mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>,
|
||||
) -> &mut [<<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a> as <a class="trait" href="../trait.ArrayExt.html" title="trait cosmic::cosmic_theme::palette::ArrayExt">ArrayExt</a>>::<a class="associatedtype" href="../trait.ArrayExt.html#associatedtype.Item" title="type cosmic::cosmic_theme::palette::ArrayExt::Item">Item</a>]<div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a slice of colors to a slice of color components.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>colors = <span class="kw-2">&mut </span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="macro">assert_eq!</span>(
|
||||
cast::into_component_slice_mut(colors),
|
||||
<span class="kw-2">&mut </span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]
|
||||
)</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
13
cosmic/cosmic_theme/palette/cast/fn.into_component_vec.html
Normal file
13
cosmic/cosmic_theme/palette/cast/fn.into_component_vec.html
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<!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="Cast from a `Vec` of colors to a `Vec` of color components."><title>into_component_vec in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">into_component_vec</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#1231-1233">Source</a> </span></div><pre class="rust item-decl"><code>pub fn into_component_vec<T>(
|
||||
values: <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><T>,
|
||||
) -> <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><<<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a> as <a class="trait" href="../trait.ArrayExt.html" title="trait cosmic::cosmic_theme::palette::ArrayExt">ArrayExt</a>>::<a class="associatedtype" href="../trait.ArrayExt.html#associatedtype.Item" title="type cosmic::cosmic_theme::palette::ArrayExt::Item">Item</a>><div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a <code>Vec</code> of colors to a <code>Vec</code> of color components.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>colors = <span class="macro">vec!</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="macro">assert_eq!</span>(
|
||||
cast::into_component_vec(colors),
|
||||
<span class="macro">vec!</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]
|
||||
)</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
19
cosmic/cosmic_theme/palette/cast/fn.into_uint.html
Normal file
19
cosmic/cosmic_theme/palette/cast/fn.into_uint.html
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<!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="Cast from a color type to an unsigned integer."><title>into_uint in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">into_uint</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/uint.rs.html#59-61">Source</a> </span></div><pre class="rust item-decl"><code>pub fn into_uint<T>(color: T) -> <T as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a><div class="where">where
|
||||
T: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a color type to an unsigned integer.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, rgb::PackedArgb, Srgba};
|
||||
|
||||
<span class="kw">let </span>color: PackedArgb = Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into();
|
||||
<span class="macro">assert_eq!</span>(cast::into_uint(color), <span class="number">0xFF17C64C</span>);</code></pre></div>
|
||||
<p>It’s also possible to use <code>From</code> and <code>Into</code> when casting built-in types:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::Srgba;
|
||||
|
||||
<span class="kw">let </span>color = Srgba::new(<span class="number">23u8</span>, <span class="number">198</span>, <span class="number">76</span>, <span class="number">255</span>);
|
||||
|
||||
<span class="comment">// Integers implement `Into`:
|
||||
</span><span class="kw">let </span>uint1: u32 = color.into();
|
||||
|
||||
<span class="comment">// Integers implement `From`:
|
||||
</span><span class="kw">let </span>uint2 = u32::from(color);</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
13
cosmic/cosmic_theme/palette/cast/fn.into_uint_array.html
Normal file
13
cosmic/cosmic_theme/palette/cast/fn.into_uint_array.html
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<!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="Cast from an array of colors to an array of unsigned integers."><title>into_uint_array in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">into_uint_array</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/uint.rs.html#208-210">Source</a> </span></div><pre class="rust item-decl"><code>pub fn into_uint_array<T, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>(
|
||||
values: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>,
|
||||
) -> [<T as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">N</a>]<div class="where">where
|
||||
T: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from an array of colors to an array of unsigned integers.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, rgb::PackedArgb, Srgba};
|
||||
|
||||
<span class="kw">let </span>colors: [PackedArgb; <span class="number">2</span>] = [
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
];
|
||||
<span class="macro">assert_eq!</span>(cast::into_uint_array(colors), [<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>])</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
8
cosmic/cosmic_theme/palette/cast/fn.into_uint_mut.html
Normal file
8
cosmic/cosmic_theme/palette/cast/fn.into_uint_mut.html
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<!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="Cast from a mutable color type reference to a mutable unsigned integer reference."><title>into_uint_mut in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">into_uint_mut</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/uint.rs.html#159-161">Source</a> </span></div><pre class="rust item-decl"><code>pub fn into_uint_mut<T>(value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut T</a>) -> &mut <T as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a><div class="where">where
|
||||
T: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a mutable color type reference to a mutable unsigned integer reference.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, rgb::PackedArgb, Srgba};
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>color: PackedArgb = Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into();
|
||||
<span class="macro">assert_eq!</span>(cast::into_uint_mut(<span class="kw-2">&mut </span>color), <span class="kw-2">&mut </span><span class="number">0xFF17C64C</span>);</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
8
cosmic/cosmic_theme/palette/cast/fn.into_uint_ref.html
Normal file
8
cosmic/cosmic_theme/palette/cast/fn.into_uint_ref.html
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<!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="Cast from a color type reference to an unsigned integer reference."><title>into_uint_ref in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">into_uint_ref</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/uint.rs.html#113-115">Source</a> </span></div><pre class="rust item-decl"><code>pub fn into_uint_ref<T>(value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&T</a>) -> &<T as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a><div class="where">where
|
||||
T: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a color type reference to an unsigned integer reference.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, rgb::PackedArgb, Srgba};
|
||||
|
||||
<span class="kw">let </span>color: PackedArgb = Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into();
|
||||
<span class="macro">assert_eq!</span>(cast::into_uint_ref(<span class="kw-2">&</span>color), <span class="kw-2">&</span><span class="number">0xFF17C64C</span>);</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
11
cosmic/cosmic_theme/palette/cast/fn.into_uint_slice.html
Normal file
11
cosmic/cosmic_theme/palette/cast/fn.into_uint_slice.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!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="Cast from a slice of colors to a slice of unsigned integers."><title>into_uint_slice in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">into_uint_slice</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/uint.rs.html#258-260">Source</a> </span></div><pre class="rust item-decl"><code>pub fn into_uint_slice<T>(values: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>) -> &[<T as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]<div class="where">where
|
||||
T: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a slice of colors to a slice of unsigned integers.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, rgb::PackedArgb, Srgba};
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&</span>[PackedArgb] = <span class="kw-2">&</span>[
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
];
|
||||
<span class="macro">assert_eq!</span>(cast::into_uint_slice(colors), <span class="kw-2">&</span>[<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>])</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
15
cosmic/cosmic_theme/palette/cast/fn.into_uint_slice_box.html
Normal file
15
cosmic/cosmic_theme/palette/cast/fn.into_uint_slice_box.html
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<!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="Cast from a boxed slice of colors to a boxed slice of unsigned integers."><title>into_uint_slice_box in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">into_uint_slice_box</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/uint.rs.html#363-365">Source</a> </span></div><pre class="rust item-decl"><code>pub fn into_uint_slice_box<T>(values: <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>>) -> <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><[<T as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]><div class="where">where
|
||||
T: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a boxed slice of colors to a boxed slice of unsigned integers.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, rgb::PackedArgb, Srgba};
|
||||
|
||||
<span class="kw">let </span>colors: Box<[PackedArgb]> = <span class="macro">vec!</span>[
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
].into_boxed_slice();
|
||||
|
||||
<span class="macro">assert_eq!</span>(
|
||||
cast::into_uint_slice_box(colors),
|
||||
<span class="macro">vec!</span>[<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>].into_boxed_slice()
|
||||
)</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
11
cosmic/cosmic_theme/palette/cast/fn.into_uint_slice_mut.html
Normal file
11
cosmic/cosmic_theme/palette/cast/fn.into_uint_slice_mut.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!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="Cast from a mutable slice of colors to a mutable slice of unsigned integers."><title>into_uint_slice_mut in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">into_uint_slice_mut</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/uint.rs.html#308-310">Source</a> </span></div><pre class="rust item-decl"><code>pub fn into_uint_slice_mut<T>(values: &mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>) -> &mut [<T as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]<div class="where">where
|
||||
T: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a mutable slice of colors to a mutable slice of unsigned integers.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, rgb::PackedArgb, Srgba};
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&mut </span>[PackedArgb] = <span class="kw-2">&mut </span>[
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
];
|
||||
<span class="macro">assert_eq!</span>(cast::into_uint_slice_mut(colors), <span class="kw-2">&mut </span>[<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>])</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
15
cosmic/cosmic_theme/palette/cast/fn.into_uint_vec.html
Normal file
15
cosmic/cosmic_theme/palette/cast/fn.into_uint_vec.html
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<!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="Cast from a `Vec` of colors to a `Vec` of unsigned integers."><title>into_uint_vec in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">into_uint_vec</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/uint.rs.html#425-427">Source</a> </span></div><pre class="rust item-decl"><code>pub fn into_uint_vec<T>(values: <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><T>) -> <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><<T as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>><div class="where">where
|
||||
T: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a <code>Vec</code> of colors to a <code>Vec</code> of unsigned integers.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, rgb::PackedArgb, Srgba};
|
||||
|
||||
<span class="kw">let </span>colors: Vec<PackedArgb> = <span class="macro">vec!</span>[
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
];
|
||||
|
||||
<span class="macro">assert_eq!</span>(
|
||||
cast::into_uint_vec(colors),
|
||||
<span class="macro">vec!</span>[<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>]
|
||||
)</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<!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="Map values of color A to values of color B without creating a new `Box<[B]>`."><title>map_slice_box_in_place in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">map_slice_box_in_place</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#1461-1465">Source</a> </span></div><pre class="rust item-decl"><code>pub fn map_slice_box_in_place<A, B, F>(values: <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[A]</a>>, map: F) -> <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[B]</a>><div class="where">where
|
||||
A: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,
|
||||
B: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <A as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>>,
|
||||
F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(A) -> B,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Map values of color A to values of color B without creating a new <code>Box<[B]></code>.</p>
|
||||
<p>This uses the guarantees of <a href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast"><code>ArrayCast</code></a> to reuse the allocation.</p>
|
||||
</div></details></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<!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="Map values of color A to values of color B without creating a new `Vec`."><title>map_vec_in_place in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">map_vec_in_place</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#1427-1431">Source</a> </span></div><pre class="rust item-decl"><code>pub fn map_vec_in_place<A, B, F>(values: <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><A>, map: F) -> <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><B><div class="where">where
|
||||
A: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,
|
||||
B: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <A as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>>,
|
||||
F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(A) -> B,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Map values of color A to values of color B without creating a new <code>Vec</code>.</p>
|
||||
<p>This uses the guarantees of <a href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast"><code>ArrayCast</code></a> to reuse the allocation.</p>
|
||||
</div></details></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<!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="Cast from a slice of color components to a slice of colors."><title>try_from_component_slice in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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="#">try_<wbr>from_<wbr>component_<wbr>slice</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#errors" title="Errors">Errors</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">try_from_component_slice</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#740-744">Source</a> </span></div><pre class="rust item-decl"><code>pub fn try_from_component_slice<T>(
|
||||
values: &[<<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a> as <a class="trait" href="../trait.ArrayExt.html" title="trait cosmic::cosmic_theme::palette::ArrayExt">ArrayExt</a>>::<a class="associatedtype" href="../trait.ArrayExt.html#associatedtype.Item" title="type cosmic::cosmic_theme::palette::ArrayExt::Item">Item</a>],
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>, <a class="struct" href="struct.SliceCastError.html" title="struct cosmic::cosmic_theme::palette::cast::SliceCastError">SliceCastError</a>><div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a slice of color components to a slice of colors.</p>
|
||||
<h3 id="errors"><a class="doc-anchor" href="#errors">§</a>Errors</h3>
|
||||
<p>The cast will return an error if the length of the input slice is not a
|
||||
multiple of the color’s array length.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>components = <span class="kw-2">&</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
<span class="macro">assert_eq!</span>(
|
||||
cast::try_from_component_slice::<Srgb<u8>>(components),
|
||||
<span class="prelude-val">Ok</span>([Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)].as_ref())
|
||||
)</code></pre></div>
|
||||
<p>This produces an error:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>components = <span class="kw-2">&</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>]; <span class="comment">// Not a multiple of 3
|
||||
</span><span class="macro">assert!</span>(cast::try_from_component_slice::<Srgb<u8>>(components).is_err());</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<!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="Cast from a boxed slice of color components to a boxed slice of colors."><title>try_from_component_slice_box in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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="#">try_<wbr>from_<wbr>component_<wbr>slice_<wbr>box</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#errors" title="Errors">Errors</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">try_from_component_slice_box</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#1170-1174">Source</a> </span></div><pre class="rust item-decl"><code>pub fn try_from_component_slice_box<T>(
|
||||
values: <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><[<<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a> as <a class="trait" href="../trait.ArrayExt.html" title="trait cosmic::cosmic_theme::palette::ArrayExt">ArrayExt</a>>::<a class="associatedtype" href="../trait.ArrayExt.html#associatedtype.Item" title="type cosmic::cosmic_theme::palette::ArrayExt::Item">Item</a>]>,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>>, <a class="struct" href="struct.BoxedSliceCastError.html" title="struct cosmic::cosmic_theme::palette::cast::BoxedSliceCastError">BoxedSliceCastError</a><<<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a> as <a class="trait" href="../trait.ArrayExt.html" title="trait cosmic::cosmic_theme::palette::ArrayExt">ArrayExt</a>>::<a class="associatedtype" href="../trait.ArrayExt.html#associatedtype.Item" title="type cosmic::cosmic_theme::palette::ArrayExt::Item">Item</a>>><div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a boxed slice of color components to a boxed slice of colors.</p>
|
||||
<h3 id="errors"><a class="doc-anchor" href="#errors">§</a>Errors</h3>
|
||||
<p>The cast will return an error if the length of the input slice is not a
|
||||
multiple of the color’s array length.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>components = <span class="macro">vec!</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>].into_boxed_slice();
|
||||
<span class="macro">assert_eq!</span>(
|
||||
cast::try_from_component_slice_box::<Srgb<u8>>(components),
|
||||
<span class="prelude-val">Ok</span>(<span class="macro">vec!</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)].into_boxed_slice())
|
||||
)</code></pre></div>
|
||||
<p>This produces an error:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="comment">// Not a multiple of 3:
|
||||
</span><span class="kw">let </span>components = <span class="macro">vec!</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>].into_boxed_slice();
|
||||
|
||||
<span class="kw">if let </span><span class="prelude-val">Err</span>(error) = cast::try_from_component_slice_box::<Srgb<u8>>(components) {
|
||||
<span class="comment">// We get the original values back on error:
|
||||
</span><span class="macro">assert_eq!</span>(
|
||||
error.values,
|
||||
<span class="macro">vec!</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>].into_boxed_slice()
|
||||
);
|
||||
} <span class="kw">else </span>{
|
||||
<span class="macro">unreachable!</span>();
|
||||
}</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<!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="Cast from a mutable slice of color components to a slice of colors."><title>try_from_component_slice_mut in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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="#">try_<wbr>from_<wbr>component_<wbr>slice_<wbr>mut</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#errors" title="Errors">Errors</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">try_from_component_slice_mut</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#918-922">Source</a> </span></div><pre class="rust item-decl"><code>pub fn try_from_component_slice_mut<T>(
|
||||
values: &mut [<<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a> as <a class="trait" href="../trait.ArrayExt.html" title="trait cosmic::cosmic_theme::palette::ArrayExt">ArrayExt</a>>::<a class="associatedtype" href="../trait.ArrayExt.html#associatedtype.Item" title="type cosmic::cosmic_theme::palette::ArrayExt::Item">Item</a>],
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>, <a class="struct" href="struct.SliceCastError.html" title="struct cosmic::cosmic_theme::palette::cast::SliceCastError">SliceCastError</a>><div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a mutable slice of color components to a slice of colors.</p>
|
||||
<h3 id="errors"><a class="doc-anchor" href="#errors">§</a>Errors</h3>
|
||||
<p>The cast will return an error if the length of the input slice is not a
|
||||
multiple of the color’s array length.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>components = <span class="kw-2">&mut </span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
<span class="macro">assert_eq!</span>(
|
||||
cast::try_from_component_slice_mut::<Srgb<u8>>(components),
|
||||
<span class="prelude-val">Ok</span>([Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)].as_mut())
|
||||
)</code></pre></div>
|
||||
<p>This produces an error:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>components = <span class="kw-2">&mut </span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>]; <span class="comment">// Not a multiple of 3
|
||||
</span><span class="macro">assert!</span>(cast::try_from_component_slice_mut::<Srgb<u8>>(components).is_err());</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
<!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="Cast from a `Vec` of color components to a `Vec` of colors."><title>try_from_component_vec in cosmic::cosmic_theme::palette::cast - 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 fn"><!--[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="#">try_<wbr>from_<wbr>component_<wbr>vec</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#errors" title="Errors">Errors</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Function <span class="fn">try_from_component_vec</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/array.rs.html#1384-1388">Source</a> </span></div><pre class="rust item-decl"><code>pub fn try_from_component_vec<T>(
|
||||
values: <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><<<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a> as <a class="trait" href="../trait.ArrayExt.html" title="trait cosmic::cosmic_theme::palette::ArrayExt">ArrayExt</a>>::<a class="associatedtype" href="../trait.ArrayExt.html#associatedtype.Item" title="type cosmic::cosmic_theme::palette::ArrayExt::Item">Item</a>>,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><T>, <a class="struct" href="struct.VecCastError.html" title="struct cosmic::cosmic_theme::palette::cast::VecCastError">VecCastError</a><<<T as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a> as <a class="trait" href="../trait.ArrayExt.html" title="trait cosmic::cosmic_theme::palette::ArrayExt">ArrayExt</a>>::<a class="associatedtype" href="../trait.ArrayExt.html#associatedtype.Item" title="type cosmic::cosmic_theme::palette::ArrayExt::Item">Item</a>>><div class="where">where
|
||||
T: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cast from a <code>Vec</code> of color components to a <code>Vec</code> of colors.</p>
|
||||
<h3 id="errors"><a class="doc-anchor" href="#errors">§</a>Errors</h3>
|
||||
<p>The cast will return an error if the length or capacity of the input <code>Vec</code>
|
||||
is not a multiple of the color’s array length.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span>components = <span class="macro">vec!</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
<span class="macro">assert_eq!</span>(
|
||||
cast::try_from_component_vec::<Srgb<u8>>(components),
|
||||
<span class="prelude-val">Ok</span>(<span class="macro">vec!</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)])
|
||||
)</code></pre></div>
|
||||
<p>This produces an error due to the incorrect length:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="comment">// Not a multiple of 3:
|
||||
</span><span class="kw">let </span>components = <span class="macro">vec!</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>];
|
||||
|
||||
<span class="kw">if let </span><span class="prelude-val">Err</span>(error) = cast::try_from_component_vec::<Srgb<u8>>(components) {
|
||||
<span class="comment">// We get the original values back on error:
|
||||
</span><span class="macro">assert_eq!</span>(error.values, <span class="macro">vec!</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>]);
|
||||
} <span class="kw">else </span>{
|
||||
<span class="macro">unreachable!</span>();
|
||||
}</code></pre></div>
|
||||
<p>This produces an error due to the incorrect capacity:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast, Srgb};
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>components = <span class="macro">vec!</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
components.reserve_exact(<span class="number">2</span>); <span class="comment">// Not a multiple of 3
|
||||
|
||||
</span><span class="kw">if let </span><span class="prelude-val">Err</span>(error) = cast::try_from_component_vec::<Srgb<u8>>(components) {
|
||||
<span class="comment">// We get the original values back on error:
|
||||
</span><span class="macro">assert_eq!</span>(error.values, <span class="macro">vec!</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]);
|
||||
<span class="macro">assert_eq!</span>(error.values.capacity(), <span class="number">8</span>);
|
||||
} <span class="kw">else </span>{
|
||||
<span class="macro">unreachable!</span>();
|
||||
}</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
155
cosmic/cosmic_theme/palette/cast/index.html
Normal file
155
cosmic/cosmic_theme/palette/cast/index.html
Normal file
File diff suppressed because one or more lines are too long
1
cosmic/cosmic_theme/palette/cast/sidebar-items.js
Normal file
1
cosmic/cosmic_theme/palette/cast/sidebar-items.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"derive":["ArrayCast"],"enum":["VecCastErrorKind"],"fn":["from_array","from_array_array","from_array_box","from_array_mut","from_array_ref","from_array_slice","from_array_slice_box","from_array_slice_mut","from_array_vec","from_component_array","from_component_slice","from_component_slice_box","from_component_slice_mut","from_component_vec","from_uint","from_uint_array","from_uint_mut","from_uint_ref","from_uint_slice","from_uint_slice_box","from_uint_slice_mut","from_uint_vec","into_array","into_array_array","into_array_box","into_array_mut","into_array_ref","into_array_slice","into_array_slice_box","into_array_slice_mut","into_array_vec","into_component_array","into_component_slice","into_component_slice_box","into_component_slice_mut","into_component_vec","into_uint","into_uint_array","into_uint_mut","into_uint_ref","into_uint_slice","into_uint_slice_box","into_uint_slice_mut","into_uint_vec","map_slice_box_in_place","map_vec_in_place","try_from_component_slice","try_from_component_slice_box","try_from_component_slice_mut","try_from_component_vec"],"struct":["BoxedSliceCastError","Packed","SliceCastError","VecCastError"],"trait":["ArrayCast","ArraysAs","ArraysAsMut","ArraysFrom","ArraysInto","AsArrays","AsArraysMut","AsComponents","AsComponentsMut","AsUints","AsUintsMut","ComponentOrder","ComponentsAs","ComponentsAsMut","ComponentsFrom","ComponentsInto","FromArrays","FromComponents","FromUints","IntoArrays","IntoComponents","IntoUints","TryComponentsAs","TryComponentsAsMut","TryComponentsInto","TryFromComponents","UintCast","UintsAs","UintsAsMut","UintsFrom","UintsInto"]};
|
||||
File diff suppressed because one or more lines are too long
177
cosmic/cosmic_theme/palette/cast/struct.Packed.html
Normal file
177
cosmic/cosmic_theme/palette/cast/struct.Packed.html
Normal file
File diff suppressed because one or more lines are too long
78
cosmic/cosmic_theme/palette/cast/struct.SliceCastError.html
Normal file
78
cosmic/cosmic_theme/palette/cast/struct.SliceCastError.html
Normal file
File diff suppressed because one or more lines are too long
91
cosmic/cosmic_theme/palette/cast/struct.VecCastError.html
Normal file
91
cosmic/cosmic_theme/palette/cast/struct.VecCastError.html
Normal file
File diff suppressed because one or more lines are too long
129
cosmic/cosmic_theme/palette/cast/trait.ArrayCast.html
Normal file
129
cosmic/cosmic_theme/palette/cast/trait.ArrayCast.html
Normal file
File diff suppressed because one or more lines are too long
29
cosmic/cosmic_theme/palette/cast/trait.ArraysAs.html
Normal file
29
cosmic/cosmic_theme/palette/cast/trait.ArraysAs.html
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<!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="Trait for casting a reference to collection of arrays into a reference to collection of colors without copying."><title>ArraysAs in cosmic::cosmic_theme::palette::cast - 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="#">Arrays<wbr>As</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.arrays_as" title="arrays_as">arrays_as</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-ArraysAs%3C%5BC%5D%3E-for-%5B%5BT;+N%5D;+M%5D" title="[[T; N]; M]">[[T; N]; M]</a></li><li><a href="#impl-ArraysAs%3C%5BC%5D%3E-for-%5B%5BT;+N%5D%5D" title="[[T; N]]">[[T; N]]</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Trait <span class="trait">ArraysAs</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#108">Source</a> </span></div><pre class="rust item-decl"><code>pub trait ArraysAs<C><div class="where">where
|
||||
C: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div>{
|
||||
// Required method
|
||||
fn <a href="#tymethod.arrays_as" class="fn">arrays_as</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&C</a>;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait for casting a reference to collection of arrays into a reference to
|
||||
collection of colors without copying.</p>
|
||||
<p>This trait is meant as a more convenient alternative to the free functions
|
||||
in <a href="index.html" title="mod cosmic::cosmic_theme::palette::cast"><code>cast</code></a>, to allow method chaining among other things.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::ArraysAs, Srgb};
|
||||
|
||||
<span class="kw">let </span>array: [<span class="kw">_</span>; <span class="number">2</span>] = [[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]];
|
||||
<span class="kw">let </span>slice: <span class="kw-2">&</span>[<span class="kw">_</span>] = <span class="kw-2">&</span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]];
|
||||
<span class="kw">let </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]];
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&</span>[Srgb<u8>] = array.arrays_as();
|
||||
<span class="macro">assert_eq!</span>(colors, <span class="kw-2">&</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]);
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&</span>[Srgb<u8>] = slice.arrays_as();
|
||||
<span class="macro">assert_eq!</span>(colors, <span class="kw-2">&</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]);
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&</span>[Srgb<u8>] = vec.arrays_as();
|
||||
<span class="macro">assert_eq!</span>(colors, <span class="kw-2">&</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]);</code></pre></div>
|
||||
</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.arrays_as" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#110">Source</a><h4 class="code-header">fn <a href="#tymethod.arrays_as" class="fn">arrays_as</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&C</a></h4></section></summary><div class="docblock"><p>Cast this collection of arrays into a collection of colors.</p>
|
||||
</div></details></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-ArraysAs%3C%5BC%5D%3E-for-%5B%5BT;+N%5D%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#168">Source</a><a href="#impl-ArraysAs%3C%5BC%5D%3E-for-%5B%5BT;+N%5D%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.ArraysAs.html" title="trait cosmic::cosmic_theme::palette::cast::ArraysAs">ArraysAs</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>> for [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]<div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="method.arrays_as" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#168">Source</a><a href="#method.arrays_as" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.arrays_as" class="fn">arrays_as</a>(&self) -> &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-ArraysAs%3C%5BC%5D%3E-for-%5B%5BT;+N%5D;+M%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#168">Source</a><a href="#impl-ArraysAs%3C%5BC%5D%3E-for-%5B%5BT;+N%5D;+M%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, const M: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.ArraysAs.html" title="trait cosmic::cosmic_theme::palette::cast::ArraysAs">ArraysAs</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>> for [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">M</a>]<div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="method.arrays_as-1" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#168">Source</a><a href="#method.arrays_as-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.arrays_as" class="fn">arrays_as</a>(&self) -> &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-ArraysAs%3C%5BC%5D%3E-for-Box%3C%5B%5BT;+N%5D%5D%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#171">Source</a><a href="#impl-ArraysAs%3C%5BC%5D%3E-for-Box%3C%5B%5BT;+N%5D%5D%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.ArraysAs.html" title="trait cosmic::cosmic_theme::palette::cast::ArraysAs">ArraysAs</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section><section id="impl-ArraysAs%3C%5BC%5D%3E-for-Vec%3C%5BT;+N%5D%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#171">Source</a><a href="#impl-ArraysAs%3C%5BC%5D%3E-for-Vec%3C%5BT;+N%5D%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.ArraysAs.html" title="trait cosmic::cosmic_theme::palette::cast::ArraysAs">ArraysAs</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></div><script src="../../../../trait.impl/palette/cast/as_arrays_traits/trait.ArraysAs.js" data-ignore-extern-crates="std,alloc" async></script></section></div></main></body></html>
|
||||
29
cosmic/cosmic_theme/palette/cast/trait.ArraysAsMut.html
Normal file
29
cosmic/cosmic_theme/palette/cast/trait.ArraysAsMut.html
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<!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="Trait for casting a mutable reference to collection of arrays into a mutable reference to collection of colors without copying."><title>ArraysAsMut in cosmic::cosmic_theme::palette::cast - 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="#">Arrays<wbr>AsMut</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.arrays_as_mut" title="arrays_as_mut">arrays_as_mut</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-ArraysAsMut%3C%5BC%5D%3E-for-%5B%5BT;+N%5D;+M%5D" title="[[T; N]; M]">[[T; N]; M]</a></li><li><a href="#impl-ArraysAsMut%3C%5BC%5D%3E-for-%5B%5BT;+N%5D%5D" title="[[T; N]]">[[T; N]]</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Trait <span class="trait">ArraysAsMut</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#137">Source</a> </span></div><pre class="rust item-decl"><code>pub trait ArraysAsMut<C><div class="where">where
|
||||
C: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div>{
|
||||
// Required method
|
||||
fn <a href="#tymethod.arrays_as_mut" class="fn">arrays_as_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut C</a>;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait for casting a mutable reference to collection of arrays into a mutable
|
||||
reference to collection of colors without copying.</p>
|
||||
<p>This trait is meant as a more convenient alternative to the free functions
|
||||
in <a href="index.html" title="mod cosmic::cosmic_theme::palette::cast"><code>cast</code></a>, to allow method chaining among other things.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::ArraysAsMut, Srgb};
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>array: [<span class="kw">_</span>; <span class="number">2</span>] = [[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]];
|
||||
<span class="kw">let </span>slice_mut: <span class="kw-2">&mut </span>[<span class="kw">_</span>] = <span class="kw-2">&mut </span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]];
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]];
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&mut </span>[Srgb<u8>] = array.arrays_as_mut();
|
||||
<span class="macro">assert_eq!</span>(colors, <span class="kw-2">&mut </span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]);
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&mut </span>[Srgb<u8>] = slice_mut.arrays_as_mut();
|
||||
<span class="macro">assert_eq!</span>(colors, <span class="kw-2">&mut </span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]);
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&mut </span>[Srgb<u8>] = vec.arrays_as_mut();
|
||||
<span class="macro">assert_eq!</span>(colors, <span class="kw-2">&mut </span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]);</code></pre></div>
|
||||
</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.arrays_as_mut" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#139">Source</a><h4 class="code-header">fn <a href="#tymethod.arrays_as_mut" class="fn">arrays_as_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut C</a></h4></section></summary><div class="docblock"><p>Cast this collection of arrays into a mutable collection of colors.</p>
|
||||
</div></details></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-ArraysAsMut%3C%5BC%5D%3E-for-%5B%5BT;+N%5D%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#168">Source</a><a href="#impl-ArraysAsMut%3C%5BC%5D%3E-for-%5B%5BT;+N%5D%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.ArraysAsMut.html" title="trait cosmic::cosmic_theme::palette::cast::ArraysAsMut">ArraysAsMut</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>> for [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]<div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="method.arrays_as_mut" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#168">Source</a><a href="#method.arrays_as_mut" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.arrays_as_mut" class="fn">arrays_as_mut</a>(&mut self) -> &mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-ArraysAsMut%3C%5BC%5D%3E-for-%5B%5BT;+N%5D;+M%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#168">Source</a><a href="#impl-ArraysAsMut%3C%5BC%5D%3E-for-%5B%5BT;+N%5D;+M%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, const M: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.ArraysAsMut.html" title="trait cosmic::cosmic_theme::palette::cast::ArraysAsMut">ArraysAsMut</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>> for [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">M</a>]<div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="method.arrays_as_mut-1" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#168">Source</a><a href="#method.arrays_as_mut-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.arrays_as_mut" class="fn">arrays_as_mut</a>(&mut self) -> &mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-ArraysAsMut%3C%5BC%5D%3E-for-Box%3C%5B%5BT;+N%5D%5D%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#171">Source</a><a href="#impl-ArraysAsMut%3C%5BC%5D%3E-for-Box%3C%5B%5BT;+N%5D%5D%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.ArraysAsMut.html" title="trait cosmic::cosmic_theme::palette::cast::ArraysAsMut">ArraysAsMut</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section><section id="impl-ArraysAsMut%3C%5BC%5D%3E-for-Vec%3C%5BT;+N%5D%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#171">Source</a><a href="#impl-ArraysAsMut%3C%5BC%5D%3E-for-Vec%3C%5BT;+N%5D%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.ArraysAsMut.html" title="trait cosmic::cosmic_theme::palette::cast::ArraysAsMut">ArraysAsMut</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></div><script src="../../../../trait.impl/palette/cast/as_arrays_traits/trait.ArraysAsMut.js" data-ignore-extern-crates="std,alloc" async></script></section></div></main></body></html>
|
||||
31
cosmic/cosmic_theme/palette/cast/trait.ArraysFrom.html
Normal file
31
cosmic/cosmic_theme/palette/cast/trait.ArraysFrom.html
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<!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="Trait for casting a collection of arrays from a collection of colors without copying."><title>ArraysFrom in cosmic::cosmic_theme::palette::cast - 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="#">Arrays<wbr>From</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.arrays_from" title="arrays_from">arrays_from</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>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Trait <span class="trait">ArraysFrom</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#266">Source</a> </span></div><pre class="rust item-decl"><code>pub trait ArraysFrom<C> {
|
||||
// Required method
|
||||
fn <a href="#tymethod.arrays_from" class="fn">arrays_from</a>(colors: C) -> Self;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait for casting a collection of arrays from a collection of colors without
|
||||
copying.</p>
|
||||
<p>This trait is meant as a more convenient alternative to the free functions
|
||||
in <a href="index.html" title="mod cosmic::cosmic_theme::palette::cast"><code>cast</code></a>, to allow method chaining among other things.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::ArraysFrom, Srgb};
|
||||
|
||||
<span class="kw">let </span>array: [<span class="kw">_</span>; <span class="number">2</span>] = [Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="kw">let </span>slice: <span class="kw-2">&</span>[<span class="kw">_</span>] = <span class="kw-2">&</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="kw">let </span>slice_mut: <span class="kw-2">&mut </span>[<span class="kw">_</span>] = <span class="kw-2">&mut </span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="kw">let </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
|
||||
<span class="macro">assert_eq!</span>(<[<span class="kw">_</span>; <span class="number">2</span>]>::arrays_from(array), [[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]]);
|
||||
<span class="macro">assert_eq!</span>(<<span class="kw-2">&</span>[<span class="kw">_</span>]>::arrays_from(slice), [[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]]);
|
||||
<span class="macro">assert_eq!</span>(<<span class="kw-2">&mut </span>[<span class="kw">_</span>]>::arrays_from(slice_mut), [[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]]);
|
||||
<span class="macro">assert_eq!</span>(Vec::<<span class="kw">_</span>>::arrays_from(vec), <span class="macro">vec!</span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]]);</code></pre></div>
|
||||
<p>Owning types can be cast as slices, too:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::ArraysFrom, Srgb};
|
||||
|
||||
<span class="kw">let </span>array: [<span class="kw">_</span>; <span class="number">2</span>] = [Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
|
||||
<span class="macro">assert_eq!</span>(<<span class="kw-2">&</span>[<span class="kw">_</span>]>::arrays_from(<span class="kw-2">&</span>array), [[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]]);
|
||||
<span class="macro">assert_eq!</span>(<<span class="kw-2">&mut </span>[<span class="kw">_</span>]>::arrays_from(<span class="kw-2">&mut </span>vec), [[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]]);</code></pre></div>
|
||||
</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.arrays_from" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#268">Source</a><h4 class="code-header">fn <a href="#tymethod.arrays_from" class="fn">arrays_from</a>(colors: C) -> Self</h4></section></summary><div class="docblock"><p>Cast a collection of colors into a collection of arrays.</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="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-ArraysFrom%3CC%3E-for-T" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#271-273">Source</a><a href="#impl-ArraysFrom%3CC%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, C> <a class="trait" href="trait.ArraysFrom.html" title="trait cosmic::cosmic_theme::palette::cast::ArraysFrom">ArraysFrom</a><C> for T<div class="where">where
|
||||
C: <a class="trait" href="trait.IntoArrays.html" title="trait cosmic::cosmic_theme::palette::cast::IntoArrays">IntoArrays</a><T>,</div></h3></section></div><script src="../../../../trait.impl/palette/cast/from_into_arrays_traits/trait.ArraysFrom.js" async></script></section></div></main></body></html>
|
||||
41
cosmic/cosmic_theme/palette/cast/trait.ArraysInto.html
Normal file
41
cosmic/cosmic_theme/palette/cast/trait.ArraysInto.html
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<!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="Trait for casting a collection of arrays into a collection of colors without copying."><title>ArraysInto in cosmic::cosmic_theme::palette::cast - 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="#">Arrays<wbr>Into</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.arrays_into" title="arrays_into">arrays_into</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Trait <span class="trait">ArraysInto</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#324">Source</a> </span></div><pre class="rust item-decl"><code>pub trait ArraysInto<C> {
|
||||
// Required method
|
||||
fn <a href="#tymethod.arrays_into" class="fn">arrays_into</a>(self) -> C;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait for casting a collection of arrays into a collection of colors
|
||||
without copying.</p>
|
||||
<p>This trait is meant as a more convenient alternative to the free functions
|
||||
in <a href="index.html" title="mod cosmic::cosmic_theme::palette::cast"><code>cast</code></a>, to allow method chaining among other things.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::ArraysInto, Srgb};
|
||||
|
||||
<span class="kw">let </span>array: [<span class="kw">_</span>; <span class="number">2</span>] = [[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]];
|
||||
<span class="kw">let </span>slice: <span class="kw-2">&</span>[<span class="kw">_</span>] = <span class="kw-2">&</span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]];
|
||||
<span class="kw">let </span>slice_mut: <span class="kw-2">&mut </span>[<span class="kw">_</span>] = <span class="kw-2">&mut </span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]];
|
||||
<span class="kw">let </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]];
|
||||
|
||||
<span class="kw">let </span>colors: [Srgb<u8>; <span class="number">2</span>] = array.arrays_into();
|
||||
<span class="macro">assert_eq!</span>(colors, [Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]);
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&</span>[Srgb<u8>] = slice.arrays_into();
|
||||
<span class="macro">assert_eq!</span>(colors, [Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]);
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&mut </span>[Srgb<u8>] = slice_mut.arrays_into();
|
||||
<span class="macro">assert_eq!</span>(colors, [Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]);
|
||||
|
||||
<span class="kw">let </span>colors: Vec<Srgb<u8>> = vec.arrays_into();
|
||||
<span class="macro">assert_eq!</span>(colors, <span class="macro">vec!</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]);</code></pre></div>
|
||||
<p>Owning types can be cast as slices, too:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::ArraysInto, Srgb};
|
||||
|
||||
<span class="kw">let </span>array: [<span class="kw">_</span>; <span class="number">2</span>] = [[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]];
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]];
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&</span>[Srgb<u8>] = (<span class="kw-2">&</span>array).arrays_into();
|
||||
<span class="macro">assert_eq!</span>(colors, [Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]);
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&mut </span>[Srgb<u8>] = (<span class="kw-2">&mut </span>vec).arrays_into();
|
||||
<span class="macro">assert_eq!</span>(colors, [Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]);</code></pre></div>
|
||||
</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.arrays_into" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#326">Source</a><h4 class="code-header">fn <a href="#tymethod.arrays_into" class="fn">arrays_into</a>(self) -> C</h4></section></summary><div class="docblock"><p>Cast this collection of arrays into a collection of colors.</p>
|
||||
</div></details></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-ArraysInto%3CC%3E-for-T" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#329-331">Source</a><a href="#impl-ArraysInto%3CC%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, C> <a class="trait" href="trait.ArraysInto.html" title="trait cosmic::cosmic_theme::palette::cast::ArraysInto">ArraysInto</a><C> for T<div class="where">where
|
||||
C: <a class="trait" href="trait.FromArrays.html" title="trait cosmic::cosmic_theme::palette::cast::FromArrays">FromArrays</a><T>,</div></h3></section></div><script src="../../../../trait.impl/palette/cast/from_into_arrays_traits/trait.ArraysInto.js" async></script></section></div></main></body></html>
|
||||
24
cosmic/cosmic_theme/palette/cast/trait.AsArrays.html
Normal file
24
cosmic/cosmic_theme/palette/cast/trait.AsArrays.html
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<!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="Trait for casting a reference to a collection of colors into a reference to a collection of arrays without copying."><title>AsArrays in cosmic::cosmic_theme::palette::cast - 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="#">AsArrays</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.as_arrays" title="as_arrays">as_arrays</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-AsArrays%3C%5B%5BT;+N%5D%5D%3E-for-%5BC;+M%5D" title="[C; M]">[C; M]</a></li><li><a href="#impl-AsArrays%3C%5B%5BT;+N%5D%5D%3E-for-%5BC%5D" title="[C]">[C]</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Trait <span class="trait">AsArrays</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#24">Source</a> </span></div><pre class="rust item-decl"><code>pub trait AsArrays<A><div class="where">where
|
||||
A: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div>{
|
||||
// Required method
|
||||
fn <a href="#tymethod.as_arrays" class="fn">as_arrays</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&A</a>;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait for casting a reference to a collection of colors into a reference to
|
||||
a collection of arrays without copying.</p>
|
||||
<p>This trait is meant as a more convenient alternative to the free functions
|
||||
in <a href="index.html" title="mod cosmic::cosmic_theme::palette::cast"><code>cast</code></a>, to allow method chaining among other things.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::AsArrays, Srgb};
|
||||
|
||||
<span class="kw">let </span>array: [<span class="kw">_</span>; <span class="number">2</span>] = [Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="kw">let </span>slice: <span class="kw-2">&</span>[<span class="kw">_</span>] = <span class="kw-2">&</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="kw">let </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
|
||||
<span class="macro">assert_eq!</span>(array.as_arrays(), <span class="kw-2">&</span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]]);
|
||||
<span class="macro">assert_eq!</span>(slice.as_arrays(), <span class="kw-2">&</span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]]);
|
||||
<span class="macro">assert_eq!</span>(vec.as_arrays(), <span class="kw-2">&</span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]]);</code></pre></div>
|
||||
</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.as_arrays" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#26">Source</a><h4 class="code-header">fn <a href="#tymethod.as_arrays" class="fn">as_arrays</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&A</a></h4></section></summary><div class="docblock"><p>Cast this collection of colors into a collection of arrays.</p>
|
||||
</div></details></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-AsArrays%3C%5B%5BT;+N%5D%5D%3E-for-%5BC%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#79">Source</a><a href="#impl-AsArrays%3C%5B%5BT;+N%5D%5D%3E-for-%5BC%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.AsArrays.html" title="trait cosmic::cosmic_theme::palette::cast::AsArrays">AsArrays</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="method.as_arrays" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#79">Source</a><a href="#method.as_arrays" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.as_arrays" class="fn">as_arrays</a>(&self) -> &[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-AsArrays%3C%5B%5BT;+N%5D%5D%3E-for-%5BC;+M%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#79">Source</a><a href="#impl-AsArrays%3C%5B%5BT;+N%5D%5D%3E-for-%5BC;+M%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, const M: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.AsArrays.html" title="trait cosmic::cosmic_theme::palette::cast::AsArrays">AsArrays</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[C; M]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="method.as_arrays-1" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#79">Source</a><a href="#method.as_arrays-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.as_arrays" class="fn">as_arrays</a>(&self) -> &[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]</h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-AsArrays%3C%5B%5BT;+N%5D%5D%3E-for-Box%3C%5BC%5D%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#82">Source</a><a href="#impl-AsArrays%3C%5B%5BT;+N%5D%5D%3E-for-Box%3C%5BC%5D%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.AsArrays.html" title="trait cosmic::cosmic_theme::palette::cast::AsArrays">AsArrays</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section><section id="impl-AsArrays%3C%5B%5BT;+N%5D%5D%3E-for-Vec%3CC%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#82">Source</a><a href="#impl-AsArrays%3C%5B%5BT;+N%5D%5D%3E-for-Vec%3CC%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.AsArrays.html" title="trait cosmic::cosmic_theme::palette::cast::AsArrays">AsArrays</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><C><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></div><script src="../../../../trait.impl/palette/cast/as_arrays_traits/trait.AsArrays.js" data-ignore-extern-crates="std,alloc" async></script></section></div></main></body></html>
|
||||
24
cosmic/cosmic_theme/palette/cast/trait.AsArraysMut.html
Normal file
24
cosmic/cosmic_theme/palette/cast/trait.AsArraysMut.html
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<!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="Trait for casting a mutable reference to a collection of colors into a mutable reference to a collection of arrays without copying."><title>AsArraysMut in cosmic::cosmic_theme::palette::cast - 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="#">AsArrays<wbr>Mut</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.as_arrays_mut" title="as_arrays_mut">as_arrays_mut</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-AsArraysMut%3C%5B%5BT;+N%5D%5D%3E-for-%5BC;+M%5D" title="[C; M]">[C; M]</a></li><li><a href="#impl-AsArraysMut%3C%5B%5BT;+N%5D%5D%3E-for-%5BC%5D" title="[C]">[C]</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Trait <span class="trait">AsArraysMut</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#48">Source</a> </span></div><pre class="rust item-decl"><code>pub trait AsArraysMut<A><div class="where">where
|
||||
A: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div>{
|
||||
// Required method
|
||||
fn <a href="#tymethod.as_arrays_mut" class="fn">as_arrays_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut A</a>;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait for casting a mutable reference to a collection of colors into a
|
||||
mutable reference to a collection of arrays without copying.</p>
|
||||
<p>This trait is meant as a more convenient alternative to the free functions
|
||||
in <a href="index.html" title="mod cosmic::cosmic_theme::palette::cast"><code>cast</code></a>, to allow method chaining among other things.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::AsArraysMut, Srgb};
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>array: [<span class="kw">_</span>; <span class="number">2</span>] = [Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="kw">let </span>slice_mut: <span class="kw-2">&mut </span>[<span class="kw">_</span>] = <span class="kw-2">&mut </span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
|
||||
<span class="macro">assert_eq!</span>(array.as_arrays_mut(), <span class="kw-2">&mut </span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]]);
|
||||
<span class="macro">assert_eq!</span>(slice_mut.as_arrays_mut(), <span class="kw-2">&mut </span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]]);
|
||||
<span class="macro">assert_eq!</span>(vec.as_arrays_mut(), <span class="kw-2">&mut </span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]]);</code></pre></div>
|
||||
</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.as_arrays_mut" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#50">Source</a><h4 class="code-header">fn <a href="#tymethod.as_arrays_mut" class="fn">as_arrays_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut A</a></h4></section></summary><div class="docblock"><p>Cast this collection of colors into a mutable collection of arrays.</p>
|
||||
</div></details></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-AsArraysMut%3C%5B%5BT;+N%5D%5D%3E-for-%5BC%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#79">Source</a><a href="#impl-AsArraysMut%3C%5B%5BT;+N%5D%5D%3E-for-%5BC%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.AsArraysMut.html" title="trait cosmic::cosmic_theme::palette::cast::AsArraysMut">AsArraysMut</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="method.as_arrays_mut" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#79">Source</a><a href="#method.as_arrays_mut" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.as_arrays_mut" class="fn">as_arrays_mut</a>(&mut self) -> &mut [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-AsArraysMut%3C%5B%5BT;+N%5D%5D%3E-for-%5BC;+M%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#79">Source</a><a href="#impl-AsArraysMut%3C%5B%5BT;+N%5D%5D%3E-for-%5BC;+M%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, const M: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.AsArraysMut.html" title="trait cosmic::cosmic_theme::palette::cast::AsArraysMut">AsArraysMut</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[C; M]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="method.as_arrays_mut-1" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#79">Source</a><a href="#method.as_arrays_mut-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.as_arrays_mut" class="fn">as_arrays_mut</a>(&mut self) -> &mut [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]</h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-AsArraysMut%3C%5B%5BT;+N%5D%5D%3E-for-Box%3C%5BC%5D%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#82">Source</a><a href="#impl-AsArraysMut%3C%5B%5BT;+N%5D%5D%3E-for-Box%3C%5BC%5D%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.AsArraysMut.html" title="trait cosmic::cosmic_theme::palette::cast::AsArraysMut">AsArraysMut</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section><section id="impl-AsArraysMut%3C%5B%5BT;+N%5D%5D%3E-for-Vec%3CC%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_arrays_traits.rs.html#82">Source</a><a href="#impl-AsArraysMut%3C%5B%5BT;+N%5D%5D%3E-for-Vec%3CC%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.AsArraysMut.html" title="trait cosmic::cosmic_theme::palette::cast::AsArraysMut">AsArraysMut</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><C><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></div><script src="../../../../trait.impl/palette/cast/as_arrays_traits/trait.AsArraysMut.js" data-ignore-extern-crates="std,alloc" async></script></section></div></main></body></html>
|
||||
24
cosmic/cosmic_theme/palette/cast/trait.AsComponents.html
Normal file
24
cosmic/cosmic_theme/palette/cast/trait.AsComponents.html
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<!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="Trait for casting a reference to a collection of colors into a reference to a collection of color components without copying."><title>AsComponents in cosmic::cosmic_theme::palette::cast - 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="#">AsComponents</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.as_components" title="as_components">as_components</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-AsComponents%3C%5BT%5D%3E-for-%5BC;+M%5D" title="[C; M]">[C; M]</a></li><li><a href="#impl-AsComponents%3C%5BT%5D%3E-for-%5BC%5D" title="[C]">[C]</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Trait <span class="trait">AsComponents</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#27">Source</a> </span></div><pre class="rust item-decl"><code>pub trait AsComponents<C><div class="where">where
|
||||
C: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div>{
|
||||
// Required method
|
||||
fn <a href="#tymethod.as_components" class="fn">as_components</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&C</a>;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait for casting a reference to a collection of colors into a reference to
|
||||
a collection of color components without copying.</p>
|
||||
<p>This trait is meant as a more convenient alternative to the free functions
|
||||
in <a href="index.html" title="mod cosmic::cosmic_theme::palette::cast"><code>cast</code></a>, to allow method chaining among other things.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::AsComponents, Srgb};
|
||||
|
||||
<span class="kw">let </span>array: [<span class="kw">_</span>; <span class="number">2</span>] = [Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="kw">let </span>slice: <span class="kw-2">&</span>[<span class="kw">_</span>] = <span class="kw-2">&</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="kw">let </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
|
||||
<span class="macro">assert_eq!</span>(array.as_components(), <span class="kw-2">&</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]);
|
||||
<span class="macro">assert_eq!</span>(slice.as_components(), <span class="kw-2">&</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]);
|
||||
<span class="macro">assert_eq!</span>(vec.as_components(), <span class="kw-2">&</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]);</code></pre></div>
|
||||
</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.as_components" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#29">Source</a><h4 class="code-header">fn <a href="#tymethod.as_components" class="fn">as_components</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&C</a></h4></section></summary><div class="docblock"><p>Cast this collection of colors into a collection of color components.</p>
|
||||
</div></details></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-AsComponents%3C%5BT%5D%3E-for-%5BC%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#83">Source</a><a href="#impl-AsComponents%3C%5BT%5D%3E-for-%5BC%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.AsComponents.html" title="trait cosmic::cosmic_theme::palette::cast::AsComponents">AsComponents</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="method.as_components" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#83">Source</a><a href="#method.as_components" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.as_components" class="fn">as_components</a>(&self) -> &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-AsComponents%3C%5BT%5D%3E-for-%5BC;+M%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#83">Source</a><a href="#impl-AsComponents%3C%5BT%5D%3E-for-%5BC;+M%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, const M: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.AsComponents.html" title="trait cosmic::cosmic_theme::palette::cast::AsComponents">AsComponents</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[C; M]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="method.as_components-1" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#83">Source</a><a href="#method.as_components-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.as_components" class="fn">as_components</a>(&self) -> &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-AsComponents%3C%5BT%5D%3E-for-Box%3C%5BC%5D%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#86">Source</a><a href="#impl-AsComponents%3C%5BT%5D%3E-for-Box%3C%5BC%5D%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.AsComponents.html" title="trait cosmic::cosmic_theme::palette::cast::AsComponents">AsComponents</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section><section id="impl-AsComponents%3C%5BT%5D%3E-for-Vec%3CC%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#86">Source</a><a href="#impl-AsComponents%3C%5BT%5D%3E-for-Vec%3CC%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.AsComponents.html" title="trait cosmic::cosmic_theme::palette::cast::AsComponents">AsComponents</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><C><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></div><script src="../../../../trait.impl/palette/cast/as_components_traits/trait.AsComponents.js" data-ignore-extern-crates="std,alloc" async></script></section></div></main></body></html>
|
||||
25
cosmic/cosmic_theme/palette/cast/trait.AsComponentsMut.html
Normal file
25
cosmic/cosmic_theme/palette/cast/trait.AsComponentsMut.html
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<!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="Trait for casting a mutable reference to a collection of colors into a mutable reference to a collection of color components without copying."><title>AsComponentsMut in cosmic::cosmic_theme::palette::cast - 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="#">AsComponents<wbr>Mut</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.as_components_mut" title="as_components_mut">as_components_mut</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-AsComponentsMut%3C%5BT%5D%3E-for-%5BC;+M%5D" title="[C; M]">[C; M]</a></li><li><a href="#impl-AsComponentsMut%3C%5BT%5D%3E-for-%5BC%5D" title="[C]">[C]</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Trait <span class="trait">AsComponentsMut</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#51">Source</a> </span></div><pre class="rust item-decl"><code>pub trait AsComponentsMut<C><div class="where">where
|
||||
C: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div>{
|
||||
// Required method
|
||||
fn <a href="#tymethod.as_components_mut" class="fn">as_components_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut C</a>;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait for casting a mutable reference to a collection of colors into a
|
||||
mutable reference to a collection of color components without copying.</p>
|
||||
<p>This trait is meant as a more convenient alternative to the free functions
|
||||
in <a href="index.html" title="mod cosmic::cosmic_theme::palette::cast"><code>cast</code></a>, to allow method chaining among other things.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::AsComponentsMut, Srgb};
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>array: [<span class="kw">_</span>; <span class="number">2</span>] = [Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="kw">let </span>slice_mut: <span class="kw-2">&mut </span>[<span class="kw">_</span>] = <span class="kw-2">&mut </span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
|
||||
<span class="macro">assert_eq!</span>(array.as_components_mut(), <span class="kw-2">&mut </span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]);
|
||||
<span class="macro">assert_eq!</span>(slice_mut.as_components_mut(), <span class="kw-2">&mut </span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]);
|
||||
<span class="macro">assert_eq!</span>(vec.as_components_mut(), <span class="kw-2">&mut </span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]);</code></pre></div>
|
||||
</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.as_components_mut" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#54">Source</a><h4 class="code-header">fn <a href="#tymethod.as_components_mut" class="fn">as_components_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut C</a></h4></section></summary><div class="docblock"><p>Cast this collection of colors into a mutable collection of color
|
||||
components.</p>
|
||||
</div></details></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-AsComponentsMut%3C%5BT%5D%3E-for-%5BC%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#83">Source</a><a href="#impl-AsComponentsMut%3C%5BT%5D%3E-for-%5BC%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.AsComponentsMut.html" title="trait cosmic::cosmic_theme::palette::cast::AsComponentsMut">AsComponentsMut</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="method.as_components_mut" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#83">Source</a><a href="#method.as_components_mut" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.as_components_mut" class="fn">as_components_mut</a>(&mut self) -> &mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-AsComponentsMut%3C%5BT%5D%3E-for-%5BC;+M%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#83">Source</a><a href="#impl-AsComponentsMut%3C%5BT%5D%3E-for-%5BC;+M%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, const M: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.AsComponentsMut.html" title="trait cosmic::cosmic_theme::palette::cast::AsComponentsMut">AsComponentsMut</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[C; M]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="method.as_components_mut-1" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#83">Source</a><a href="#method.as_components_mut-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.as_components_mut" class="fn">as_components_mut</a>(&mut self) -> &mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-AsComponentsMut%3C%5BT%5D%3E-for-Box%3C%5BC%5D%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#86">Source</a><a href="#impl-AsComponentsMut%3C%5BT%5D%3E-for-Box%3C%5BC%5D%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.AsComponentsMut.html" title="trait cosmic::cosmic_theme::palette::cast::AsComponentsMut">AsComponentsMut</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section><section id="impl-AsComponentsMut%3C%5BT%5D%3E-for-Vec%3CC%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#86">Source</a><a href="#impl-AsComponentsMut%3C%5BT%5D%3E-for-Vec%3CC%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.AsComponentsMut.html" title="trait cosmic::cosmic_theme::palette::cast::AsComponentsMut">AsComponentsMut</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><C><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></div><script src="../../../../trait.impl/palette/cast/as_components_traits/trait.AsComponentsMut.js" data-ignore-extern-crates="std,alloc" async></script></section></div></main></body></html>
|
||||
33
cosmic/cosmic_theme/palette/cast/trait.AsUints.html
Normal file
33
cosmic/cosmic_theme/palette/cast/trait.AsUints.html
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<!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="Trait for casting a reference to a collection of colors into a reference to a collection of unsigned integers without copying."><title>AsUints in cosmic::cosmic_theme::palette::cast - 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="#">AsUints</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.as_uints" title="as_uints">as_uints</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-AsUints%3C%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%5BC;+N%5D" title="[C; N]">[C; N]</a></li><li><a href="#impl-AsUints%3C%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%5BC%5D" title="[C]">[C]</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Trait <span class="trait">AsUints</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#31">Source</a> </span></div><pre class="rust item-decl"><code>pub trait AsUints<A><div class="where">where
|
||||
A: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div>{
|
||||
// Required method
|
||||
fn <a href="#tymethod.as_uints" class="fn">as_uints</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&A</a>;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait for casting a reference to a collection of colors into a reference to
|
||||
a collection of unsigned integers without copying.</p>
|
||||
<p>This trait is meant as a more convenient alternative to the free functions
|
||||
in <a href="index.html" title="mod cosmic::cosmic_theme::palette::cast"><code>cast</code></a>, to allow method chaining among other things.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::AsUints, rgb::PackedArgb, Srgba};
|
||||
|
||||
<span class="kw">let </span>array: [PackedArgb; <span class="number">2</span>] = [
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
];
|
||||
<span class="kw">let </span>slice: <span class="kw-2">&</span>[PackedArgb] = <span class="kw-2">&</span>[
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
];
|
||||
<span class="kw">let </span>vec: Vec<PackedArgb> = <span class="macro">vec!</span>[
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
];
|
||||
|
||||
<span class="macro">assert_eq!</span>(array.as_uints(), <span class="kw-2">&</span>[<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>]);
|
||||
<span class="macro">assert_eq!</span>(slice.as_uints(), <span class="kw-2">&</span>[<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>]);
|
||||
<span class="macro">assert_eq!</span>(vec.as_uints(), <span class="kw-2">&</span>[<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>]);</code></pre></div>
|
||||
</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.as_uints" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#33">Source</a><h4 class="code-header">fn <a href="#tymethod.as_uints" class="fn">as_uints</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&A</a></h4></section></summary><div class="docblock"><p>Cast this collection of colors into a collection of unsigned integers.</p>
|
||||
</div></details></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-AsUints%3C%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%5BC%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#95">Source</a><a href="#impl-AsUints%3C%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%5BC%5D" class="anchor">§</a><h3 class="code-header">impl<'a, C> <a class="trait" href="trait.AsUints.html" title="trait cosmic::cosmic_theme::palette::cast::AsUints">AsUints</a><[<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></h3></section></summary><div class="impl-items"><section id="method.as_uints" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#95">Source</a><a href="#method.as_uints" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.as_uints" class="fn">as_uints</a>(&self) -> &[<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-AsUints%3C%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%5BC;+N%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#95">Source</a><a href="#impl-AsUints%3C%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%5BC;+N%5D" class="anchor">§</a><h3 class="code-header">impl<'a, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.AsUints.html" title="trait cosmic::cosmic_theme::palette::cast::AsUints">AsUints</a><[<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[C; N]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></h3></section></summary><div class="impl-items"><section id="method.as_uints-1" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#95">Source</a><a href="#method.as_uints-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.as_uints" class="fn">as_uints</a>(&self) -> &[<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]</h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-AsUints%3C%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-Box%3C%5BC%5D%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#98">Source</a><a href="#impl-AsUints%3C%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-Box%3C%5BC%5D%3E" class="anchor">§</a><h3 class="code-header">impl<'a, C> <a class="trait" href="trait.AsUints.html" title="trait cosmic::cosmic_theme::palette::cast::AsUints">AsUints</a><[<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>><div class="where">where
|
||||
C: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></h3></section><section id="impl-AsUints%3C%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-Vec%3CC%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#98">Source</a><a href="#impl-AsUints%3C%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-Vec%3CC%3E" class="anchor">§</a><h3 class="code-header">impl<'a, C> <a class="trait" href="trait.AsUints.html" title="trait cosmic::cosmic_theme::palette::cast::AsUints">AsUints</a><[<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><C><div class="where">where
|
||||
C: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></h3></section></div><script src="../../../../trait.impl/palette/cast/as_uints_traits/trait.AsUints.js" data-ignore-extern-crates="std,alloc" async></script></section></div></main></body></html>
|
||||
33
cosmic/cosmic_theme/palette/cast/trait.AsUintsMut.html
Normal file
33
cosmic/cosmic_theme/palette/cast/trait.AsUintsMut.html
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<!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="Trait for casting a mutable reference to a collection of colors into a mutable reference to a collection of unsigned integers without copying."><title>AsUintsMut in cosmic::cosmic_theme::palette::cast - 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="#">AsUints<wbr>Mut</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.as_uints_mut" title="as_uints_mut">as_uints_mut</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-AsUintsMut%3C%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%5BC;+N%5D" title="[C; N]">[C; N]</a></li><li><a href="#impl-AsUintsMut%3C%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%5BC%5D" title="[C]">[C]</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Trait <span class="trait">AsUintsMut</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#64">Source</a> </span></div><pre class="rust item-decl"><code>pub trait AsUintsMut<A><div class="where">where
|
||||
A: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div>{
|
||||
// Required method
|
||||
fn <a href="#tymethod.as_uints_mut" class="fn">as_uints_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut A</a>;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait for casting a mutable reference to a collection of colors into a
|
||||
mutable reference to a collection of unsigned integers without copying.</p>
|
||||
<p>This trait is meant as a more convenient alternative to the free functions
|
||||
in <a href="index.html" title="mod cosmic::cosmic_theme::palette::cast"><code>cast</code></a>, to allow method chaining among other things.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::AsUintsMut, rgb::PackedArgb, Srgba};
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>array: [PackedArgb; <span class="number">2</span>] = [
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
];
|
||||
<span class="kw">let </span>slice_mut: <span class="kw-2">&mut </span>[PackedArgb] = <span class="kw-2">&mut </span>[
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
];
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>vec: Vec<PackedArgb> = <span class="macro">vec!</span>[
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
];
|
||||
|
||||
<span class="macro">assert_eq!</span>(array.as_uints_mut(), <span class="kw-2">&mut </span>[<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>]);
|
||||
<span class="macro">assert_eq!</span>(slice_mut.as_uints_mut(), <span class="kw-2">&mut </span>[<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>]);
|
||||
<span class="macro">assert_eq!</span>(vec.as_uints_mut(), <span class="kw-2">&mut </span>[<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>]);</code></pre></div>
|
||||
</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.as_uints_mut" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#66">Source</a><h4 class="code-header">fn <a href="#tymethod.as_uints_mut" class="fn">as_uints_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut A</a></h4></section></summary><div class="docblock"><p>Cast this collection of colors into a mutable collection of unsigned integers.</p>
|
||||
</div></details></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-AsUintsMut%3C%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%5BC%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#95">Source</a><a href="#impl-AsUintsMut%3C%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%5BC%5D" class="anchor">§</a><h3 class="code-header">impl<'a, C> <a class="trait" href="trait.AsUintsMut.html" title="trait cosmic::cosmic_theme::palette::cast::AsUintsMut">AsUintsMut</a><[<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></h3></section></summary><div class="impl-items"><section id="method.as_uints_mut" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#95">Source</a><a href="#method.as_uints_mut" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.as_uints_mut" class="fn">as_uints_mut</a>(&mut self) -> &mut [<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-AsUintsMut%3C%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%5BC;+N%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#95">Source</a><a href="#impl-AsUintsMut%3C%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%5BC;+N%5D" class="anchor">§</a><h3 class="code-header">impl<'a, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.AsUintsMut.html" title="trait cosmic::cosmic_theme::palette::cast::AsUintsMut">AsUintsMut</a><[<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[C; N]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></h3></section></summary><div class="impl-items"><section id="method.as_uints_mut-1" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#95">Source</a><a href="#method.as_uints_mut-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.as_uints_mut" class="fn">as_uints_mut</a>(&mut self) -> &mut [<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]</h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-AsUintsMut%3C%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-Box%3C%5BC%5D%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#98">Source</a><a href="#impl-AsUintsMut%3C%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-Box%3C%5BC%5D%3E" class="anchor">§</a><h3 class="code-header">impl<'a, C> <a class="trait" href="trait.AsUintsMut.html" title="trait cosmic::cosmic_theme::palette::cast::AsUintsMut">AsUintsMut</a><[<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>><div class="where">where
|
||||
C: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></h3></section><section id="impl-AsUintsMut%3C%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-Vec%3CC%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#98">Source</a><a href="#impl-AsUintsMut%3C%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-Vec%3CC%3E" class="anchor">§</a><h3 class="code-header">impl<'a, C> <a class="trait" href="trait.AsUintsMut.html" title="trait cosmic::cosmic_theme::palette::cast::AsUintsMut">AsUintsMut</a><[<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><C><div class="where">where
|
||||
C: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></h3></section></div><script src="../../../../trait.impl/palette/cast/as_uints_traits/trait.AsUintsMut.js" data-ignore-extern-crates="std,alloc" async></script></section></div></main></body></html>
|
||||
15
cosmic/cosmic_theme/palette/cast/trait.ComponentOrder.html
Normal file
15
cosmic/cosmic_theme/palette/cast/trait.ComponentOrder.html
Normal file
File diff suppressed because one or more lines are too long
41
cosmic/cosmic_theme/palette/cast/trait.ComponentsAs.html
Normal file
41
cosmic/cosmic_theme/palette/cast/trait.ComponentsAs.html
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<!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="Trait for casting a reference to collection of color components into a reference to collection of colors without copying."><title>ComponentsAs in cosmic::cosmic_theme::palette::cast - 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="#">Components<wbr>As</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#panics" title="Panics">Panics</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.components_as" title="components_as">components_as</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Trait <span class="trait">ComponentsAs</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#265">Source</a> </span></div><pre class="rust item-decl"><code>pub trait ComponentsAs<C><div class="where">where
|
||||
C: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div>{
|
||||
// Required method
|
||||
fn <a href="#tymethod.components_as" class="fn">components_as</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&C</a>;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait for casting a reference to collection of color components into a
|
||||
reference to collection of colors without copying.</p>
|
||||
<p>This trait is meant as a more convenient alternative to the free functions
|
||||
in <a href="index.html" title="mod cosmic::cosmic_theme::palette::cast"><code>cast</code></a>, to allow method chaining among other things.</p>
|
||||
<h3 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h3>
|
||||
<p>The cast will panic if the cast fails, such as when the length of the input
|
||||
is not a multiple of the color’s array length.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::ComponentsAs, Srgb};
|
||||
|
||||
<span class="kw">let </span>array: [<span class="kw">_</span>; <span class="number">6</span>] = [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
<span class="kw">let </span>slice: <span class="kw-2">&</span>[<span class="kw">_</span>] = <span class="kw-2">&</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
<span class="kw">let </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&</span>[Srgb<u8>] = array.components_as();
|
||||
<span class="macro">assert_eq!</span>(colors, <span class="kw-2">&</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]);
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&</span>[Srgb<u8>] = slice.components_as();
|
||||
<span class="macro">assert_eq!</span>(colors, <span class="kw-2">&</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]);
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&</span>[Srgb<u8>] = vec.components_as();
|
||||
<span class="macro">assert_eq!</span>(colors, <span class="kw-2">&</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]);</code></pre></div>
|
||||
<p>This panics:</p>
|
||||
|
||||
<div class="example-wrap should_panic"><a href="#" class="tooltip" title="This example panics">ⓘ</a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::ComponentsAs, Srgb};
|
||||
|
||||
<span class="kw">let </span>components = [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>, <span class="number">0</span>, <span class="number">123</span>]; <span class="comment">// Not a multiple of 3
|
||||
</span><span class="kw">let </span>colors: <span class="kw-2">&</span>[Srgb<u8>] = components.components_as();</code></pre></div>
|
||||
</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.components_as" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#272">Source</a><h4 class="code-header">fn <a href="#tymethod.components_as" class="fn">components_as</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&C</a></h4></section></summary><div class="docblock"><p>Cast this collection of color components into a reference to a
|
||||
collection of colors.</p>
|
||||
<h6 id="panics-1"><a class="doc-anchor" href="#panics-1">§</a>Panics</h6>
|
||||
<p>If the conversion can’t be done, such as when the number of items in
|
||||
<code>self</code> isn’t a multiple of the number of components in the color type.</p>
|
||||
</div></details></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-ComponentsAs%3CC%3E-for-T" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#275-279">Source</a><a href="#impl-ComponentsAs%3CC%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, C> <a class="trait" href="trait.ComponentsAs.html" title="trait cosmic::cosmic_theme::palette::cast::ComponentsAs">ComponentsAs</a><C> for T<div class="where">where
|
||||
T: <a class="trait" href="trait.TryComponentsAs.html" title="trait cosmic::cosmic_theme::palette::cast::TryComponentsAs">TryComponentsAs</a><C> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||||
<T as <a class="trait" href="trait.TryComponentsAs.html" title="trait cosmic::cosmic_theme::palette::cast::TryComponentsAs">TryComponentsAs</a><C>>::<a class="associatedtype" href="trait.TryComponentsAs.html#associatedtype.Error" title="type cosmic::cosmic_theme::palette::cast::TryComponentsAs::Error">Error</a>: <a class="trait" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/fmt/trait.Debug.html" title="trait cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::fmt::Debug">Debug</a>,
|
||||
C: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></div><script src="../../../../trait.impl/palette/cast/as_components_traits/trait.ComponentsAs.js" async></script></section></div></main></body></html>
|
||||
41
cosmic/cosmic_theme/palette/cast/trait.ComponentsAsMut.html
Normal file
41
cosmic/cosmic_theme/palette/cast/trait.ComponentsAsMut.html
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<!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="Trait for casting a mutable reference to collection of color components into a mutable reference to collection of colors without copying."><title>ComponentsAsMut in cosmic::cosmic_theme::palette::cast - 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="#">Components<wbr>AsMut</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#panics" title="Panics">Panics</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.components_as_mut" title="components_as_mut">components_as_mut</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Trait <span class="trait">ComponentsAsMut</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#324">Source</a> </span></div><pre class="rust item-decl"><code>pub trait ComponentsAsMut<C><div class="where">where
|
||||
C: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div>{
|
||||
// Required method
|
||||
fn <a href="#tymethod.components_as_mut" class="fn">components_as_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut C</a>;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait for casting a mutable reference to collection of color components into
|
||||
a mutable reference to collection of colors without copying.</p>
|
||||
<p>This trait is meant as a more convenient alternative to the free functions
|
||||
in <a href="index.html" title="mod cosmic::cosmic_theme::palette::cast"><code>cast</code></a>, to allow method chaining among other things.</p>
|
||||
<h3 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h3>
|
||||
<p>The cast will panic if the cast fails, such as when the length of the input
|
||||
is not a multiple of the color’s array length.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::ComponentsAsMut, Srgb};
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>array: [<span class="kw">_</span>; <span class="number">6</span>] = [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
<span class="kw">let </span>slice_mut: <span class="kw-2">&mut </span>[<span class="kw">_</span>] = <span class="kw-2">&mut </span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&mut </span>[Srgb<u8>] = array.components_as_mut();
|
||||
<span class="macro">assert_eq!</span>(colors, <span class="kw-2">&mut </span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]);
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&mut </span>[Srgb<u8>] = slice_mut.components_as_mut();
|
||||
<span class="macro">assert_eq!</span>(colors, <span class="kw-2">&mut </span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]);
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&mut </span>[Srgb<u8>] = vec.components_as_mut();
|
||||
<span class="macro">assert_eq!</span>(colors, <span class="kw-2">&mut </span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]);</code></pre></div>
|
||||
<p>This panics:</p>
|
||||
|
||||
<div class="example-wrap should_panic"><a href="#" class="tooltip" title="This example panics">ⓘ</a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::ComponentsAsMut, Srgb};
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>components = [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>, <span class="number">0</span>, <span class="number">123</span>]; <span class="comment">// Not a multiple of 3
|
||||
</span><span class="kw">let </span>colors: <span class="kw-2">&mut </span>[Srgb<u8>] = components.components_as_mut();</code></pre></div>
|
||||
</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.components_as_mut" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#331">Source</a><h4 class="code-header">fn <a href="#tymethod.components_as_mut" class="fn">components_as_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut C</a></h4></section></summary><div class="docblock"><p>Cast this collection of color components into a mutable reference to a
|
||||
collection of colors.</p>
|
||||
<h6 id="panics-1"><a class="doc-anchor" href="#panics-1">§</a>Panics</h6>
|
||||
<p>If the conversion can’t be done, such as when the number of items in
|
||||
<code>self</code> isn’t a multiple of the number of components in the color type.</p>
|
||||
</div></details></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-ComponentsAsMut%3CC%3E-for-T" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#334-338">Source</a><a href="#impl-ComponentsAsMut%3CC%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, C> <a class="trait" href="trait.ComponentsAsMut.html" title="trait cosmic::cosmic_theme::palette::cast::ComponentsAsMut">ComponentsAsMut</a><C> for T<div class="where">where
|
||||
T: <a class="trait" href="trait.TryComponentsAsMut.html" title="trait cosmic::cosmic_theme::palette::cast::TryComponentsAsMut">TryComponentsAsMut</a><C> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||||
<T as <a class="trait" href="trait.TryComponentsAsMut.html" title="trait cosmic::cosmic_theme::palette::cast::TryComponentsAsMut">TryComponentsAsMut</a><C>>::<a class="associatedtype" href="trait.TryComponentsAsMut.html#associatedtype.Error" title="type cosmic::cosmic_theme::palette::cast::TryComponentsAsMut::Error">Error</a>: <a class="trait" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/fmt/trait.Debug.html" title="trait cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::fmt::Debug">Debug</a>,
|
||||
C: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></div><script src="../../../../trait.impl/palette/cast/as_components_traits/trait.ComponentsAsMut.js" async></script></section></div></main></body></html>
|
||||
31
cosmic/cosmic_theme/palette/cast/trait.ComponentsFrom.html
Normal file
31
cosmic/cosmic_theme/palette/cast/trait.ComponentsFrom.html
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<!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="Trait for casting a collection of color components into a collection of colors without copying."><title>ComponentsFrom in cosmic::cosmic_theme::palette::cast - 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="#">Components<wbr>From</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.components_from" title="components_from">components_from</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>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Trait <span class="trait">ComponentsFrom</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#409">Source</a> </span></div><pre class="rust item-decl"><code>pub trait ComponentsFrom<C> {
|
||||
// Required method
|
||||
fn <a href="#tymethod.components_from" class="fn">components_from</a>(colors: C) -> Self;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait for casting a collection of color components into a collection of
|
||||
colors without copying.</p>
|
||||
<p>This trait is meant as a more convenient alternative to the free functions
|
||||
in <a href="index.html" title="mod cosmic::cosmic_theme::palette::cast"><code>cast</code></a>, to allow method chaining among other things.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::ComponentsFrom, Srgb};
|
||||
|
||||
<span class="kw">let </span>array: [<span class="kw">_</span>; <span class="number">2</span>] = [Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="kw">let </span>slice: <span class="kw-2">&</span>[<span class="kw">_</span>] = <span class="kw-2">&</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="kw">let </span>slice_mut: <span class="kw-2">&mut </span>[<span class="kw">_</span>] = <span class="kw-2">&mut </span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="kw">let </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
|
||||
<span class="macro">assert_eq!</span>(<[<span class="kw">_</span>; <span class="number">6</span>]>::components_from(array), [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]);
|
||||
<span class="macro">assert_eq!</span>(<<span class="kw-2">&</span>[<span class="kw">_</span>]>::components_from(slice), [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]);
|
||||
<span class="macro">assert_eq!</span>(<<span class="kw-2">&mut </span>[<span class="kw">_</span>]>::components_from(slice_mut), [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]);
|
||||
<span class="macro">assert_eq!</span>(Vec::<<span class="kw">_</span>>::components_from(vec), <span class="macro">vec!</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]);</code></pre></div>
|
||||
<p>Owning types can be cast as slices, too:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::ComponentsFrom, Srgb};
|
||||
|
||||
<span class="kw">let </span>array: [<span class="kw">_</span>; <span class="number">2</span>] = [Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
|
||||
<span class="macro">assert_eq!</span>(<<span class="kw-2">&</span>[<span class="kw">_</span>]>::components_from(<span class="kw-2">&</span>array), [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]);
|
||||
<span class="macro">assert_eq!</span>(<<span class="kw-2">&mut </span>[<span class="kw">_</span>]>::components_from(<span class="kw-2">&mut </span>vec), [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]);</code></pre></div>
|
||||
</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.components_from" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#411">Source</a><h4 class="code-header">fn <a href="#tymethod.components_from" class="fn">components_from</a>(colors: C) -> Self</h4></section></summary><div class="docblock"><p>Cast a collection of colors into a collection of color components.</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="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-ComponentsFrom%3CC%3E-for-T" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#414-416">Source</a><a href="#impl-ComponentsFrom%3CC%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, C> <a class="trait" href="trait.ComponentsFrom.html" title="trait cosmic::cosmic_theme::palette::cast::ComponentsFrom">ComponentsFrom</a><C> for T<div class="where">where
|
||||
C: <a class="trait" href="trait.IntoComponents.html" title="trait cosmic::cosmic_theme::palette::cast::IntoComponents">IntoComponents</a><T>,</div></h3></section></div><script src="../../../../trait.impl/palette/cast/from_into_components_traits/trait.ComponentsFrom.js" async></script></section></div></main></body></html>
|
||||
54
cosmic/cosmic_theme/palette/cast/trait.ComponentsInto.html
Normal file
54
cosmic/cosmic_theme/palette/cast/trait.ComponentsInto.html
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
<!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="Trait for casting a collection of color components from a collection of colors without copying."><title>ComponentsInto in cosmic::cosmic_theme::palette::cast - 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="#">Components<wbr>Into</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#panics" title="Panics">Panics</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.components_into" title="components_into">components_into</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Trait <span class="trait">ComponentsInto</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#564">Source</a> </span></div><pre class="rust item-decl"><code>pub trait ComponentsInto<C> {
|
||||
// Required method
|
||||
fn <a href="#tymethod.components_into" class="fn">components_into</a>(self) -> C;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait for casting a collection of color components from a collection of
|
||||
colors without copying.</p>
|
||||
<p>This trait is meant as a more convenient alternative to the free functions
|
||||
in <a href="index.html" title="mod cosmic::cosmic_theme::palette::cast"><code>cast</code></a>, to allow method chaining among other things.</p>
|
||||
<h3 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h3>
|
||||
<p>The cast will panic if the cast fails, such as when the length of the input
|
||||
is not a multiple of the color’s array length.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::ComponentsInto, Srgb};
|
||||
|
||||
<span class="kw">let </span>array: [<span class="kw">_</span>; <span class="number">6</span>] = [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
<span class="kw">let </span>slice: <span class="kw-2">&</span>[<span class="kw">_</span>] = <span class="kw-2">&</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
<span class="kw">let </span>slice_mut: <span class="kw-2">&mut </span>[<span class="kw">_</span>] = <span class="kw-2">&mut </span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
<span class="kw">let </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
|
||||
<span class="kw">let </span>colors: [Srgb<u8>; <span class="number">2</span>] = array.components_into();
|
||||
<span class="macro">assert_eq!</span>(colors, [Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]);
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&</span>[Srgb<u8>] = slice.components_into();
|
||||
<span class="macro">assert_eq!</span>(colors, [Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]);
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&mut </span>[Srgb<u8>] = slice_mut.components_into();
|
||||
<span class="macro">assert_eq!</span>(colors, [Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]);
|
||||
|
||||
<span class="kw">let </span>colors: Vec<Srgb<u8>> = vec.components_into();
|
||||
<span class="macro">assert_eq!</span>(colors, <span class="macro">vec!</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]);</code></pre></div>
|
||||
<p>Owning types can be cast as slices, too:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::ComponentsInto, Srgb};
|
||||
|
||||
<span class="kw">let </span>array: [<span class="kw">_</span>; <span class="number">6</span>] = [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&</span>[Srgb<u8>] = (<span class="kw-2">&</span>array).components_into();
|
||||
<span class="macro">assert_eq!</span>(colors, [Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]);
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&mut </span>[Srgb<u8>] = (<span class="kw-2">&mut </span>vec).components_into();
|
||||
<span class="macro">assert_eq!</span>(colors, [Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]);</code></pre></div>
|
||||
<p>This panics:</p>
|
||||
|
||||
<div class="example-wrap should_panic"><a href="#" class="tooltip" title="This example panics">ⓘ</a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::ComponentsInto, Srgb};
|
||||
|
||||
<span class="kw">let </span>components = <span class="kw-2">&</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>, <span class="number">0</span>, <span class="number">123</span>]; <span class="comment">// Not a multiple of 3
|
||||
</span><span class="kw">let </span>colors: <span class="kw-2">&</span>[Srgb<u8>] = components.components_into();</code></pre></div>
|
||||
</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.components_into" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#570">Source</a><h4 class="code-header">fn <a href="#tymethod.components_into" class="fn">components_into</a>(self) -> C</h4></section></summary><div class="docblock"><p>Cast this collection of color components into a collection of colors.</p>
|
||||
<h6 id="panics-1"><a class="doc-anchor" href="#panics-1">§</a>Panics</h6>
|
||||
<p>If the conversion can’t be done, such as when the number of items in
|
||||
<code>self</code> isn’t a multiple of the number of components in the color type.</p>
|
||||
</div></details></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-ComponentsInto%3CC%3E-for-T" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#573-576">Source</a><a href="#impl-ComponentsInto%3CC%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, C> <a class="trait" href="trait.ComponentsInto.html" title="trait cosmic::cosmic_theme::palette::cast::ComponentsInto">ComponentsInto</a><C> for T<div class="where">where
|
||||
T: <a class="trait" href="trait.TryComponentsInto.html" title="trait cosmic::cosmic_theme::palette::cast::TryComponentsInto">TryComponentsInto</a><C>,
|
||||
<T as <a class="trait" href="trait.TryComponentsInto.html" title="trait cosmic::cosmic_theme::palette::cast::TryComponentsInto">TryComponentsInto</a><C>>::<a class="associatedtype" href="trait.TryComponentsInto.html#associatedtype.Error" title="type cosmic::cosmic_theme::palette::cast::TryComponentsInto::Error">Error</a>: <a class="trait" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/fmt/trait.Debug.html" title="trait cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::fmt::Debug">Debug</a>,</div></h3></section></div><script src="../../../../trait.impl/palette/cast/from_into_components_traits/trait.ComponentsInto.js" async></script></section></div></main></body></html>
|
||||
63
cosmic/cosmic_theme/palette/cast/trait.FromArrays.html
Normal file
63
cosmic/cosmic_theme/palette/cast/trait.FromArrays.html
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<!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="Trait for casting a collection of colors from a collection of arrays without copying."><title>FromArrays in cosmic::cosmic_theme::palette::cast - 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="#">From<wbr>Arrays</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.from_arrays" title="from_arrays">from_arrays</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-FromArrays%3C%26%5B%5BT;+N%5D%5D%3E-for-%26%5BC%5D" title="&'a [C]">&'a [C]</a></li><li><a href="#impl-FromArrays%3C%26%5B%5BT;+N%5D;+M%5D%3E-for-%26%5BC%5D" title="&'a [C]">&'a [C]</a></li><li><a href="#impl-FromArrays%3C%26Box%3C%5B%5BT;+N%5D%5D%3E%3E-for-%26%5BC%5D" title="&'a [C]">&'a [C]</a></li><li><a href="#impl-FromArrays%3C%26Vec%3C%5BT;+N%5D%3E%3E-for-%26%5BC%5D" title="&'a [C]">&'a [C]</a></li><li><a href="#impl-FromArrays%3C%26mut+%5B%5BT;+N%5D%5D%3E-for-%26mut+%5BC%5D" title="&'a mut [C]">&'a mut [C]</a></li><li><a href="#impl-FromArrays%3C%26mut+%5B%5BT;+N%5D;+M%5D%3E-for-%26mut+%5BC%5D" title="&'a mut [C]">&'a mut [C]</a></li><li><a href="#impl-FromArrays%3C%26mut+Box%3C%5B%5BT;+N%5D%5D%3E%3E-for-%26mut+%5BC%5D" title="&'a mut [C]">&'a mut [C]</a></li><li><a href="#impl-FromArrays%3C%26mut+Vec%3C%5BT;+N%5D%3E%3E-for-%26mut+%5BC%5D" title="&'a mut [C]">&'a mut [C]</a></li><li><a href="#impl-FromArrays%3C%5B%5BT;+N%5D;+M%5D%3E-for-%5BC;+M%5D" title="[C; M]">[C; M]</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>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Trait <span class="trait">FromArrays</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#64">Source</a> </span></div><pre class="rust item-decl"><code>pub trait FromArrays<A> {
|
||||
// Required method
|
||||
fn <a href="#tymethod.from_arrays" class="fn">from_arrays</a>(arrays: A) -> Self;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait for casting a collection of colors from a collection of arrays without
|
||||
copying.</p>
|
||||
<p>This trait is meant as a more convenient alternative to the free functions
|
||||
in <a href="index.html" title="mod cosmic::cosmic_theme::palette::cast"><code>cast</code></a>, to allow method chaining among other things.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::FromArrays, Srgb};
|
||||
|
||||
<span class="kw">let </span>array: [<span class="kw">_</span>; <span class="number">2</span>] = [[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]];
|
||||
<span class="kw">let </span>slice: <span class="kw-2">&</span>[<span class="kw">_</span>] = <span class="kw-2">&</span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]];
|
||||
<span class="kw">let </span>slice_mut: <span class="kw-2">&mut </span>[<span class="kw">_</span>] = <span class="kw-2">&mut </span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]];
|
||||
<span class="kw">let </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]];
|
||||
|
||||
<span class="macro">assert_eq!</span>(
|
||||
<[Srgb<u8>; <span class="number">2</span>]>::from_arrays(array),
|
||||
[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]
|
||||
);
|
||||
|
||||
<span class="macro">assert_eq!</span>(
|
||||
<<span class="kw-2">&</span>[Srgb<u8>]>::from_arrays(slice),
|
||||
[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]
|
||||
);
|
||||
|
||||
<span class="macro">assert_eq!</span>(
|
||||
<<span class="kw-2">&mut </span>[Srgb<u8>]>::from_arrays(slice_mut),
|
||||
[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]
|
||||
);
|
||||
|
||||
<span class="macro">assert_eq!</span>(
|
||||
Vec::<Srgb<u8>>::from_arrays(vec),
|
||||
<span class="macro">vec!</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]
|
||||
);</code></pre></div>
|
||||
<p>Owning types can be cast as slices, too:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::FromArrays, Srgb};
|
||||
|
||||
<span class="kw">let </span>array: [<span class="kw">_</span>; <span class="number">2</span>] = [[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]];
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]];
|
||||
|
||||
<span class="macro">assert_eq!</span>(
|
||||
<<span class="kw-2">&</span>[Srgb<u8>]>::from_arrays(<span class="kw-2">&</span>array),
|
||||
[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]
|
||||
);
|
||||
|
||||
<span class="macro">assert_eq!</span>(
|
||||
<<span class="kw-2">&mut </span>[Srgb<u8>]>::from_arrays(<span class="kw-2">&mut </span>vec),
|
||||
[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]
|
||||
);</code></pre></div>
|
||||
</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.from_arrays" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#66">Source</a><h4 class="code-header">fn <a href="#tymethod.from_arrays" class="fn">from_arrays</a>(arrays: A) -> Self</h4></section></summary><div class="docblock"><p>Cast a collection of arrays into an collection of colors.</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-FromArrays%3C%26Box%3C%5B%5BT;+N%5D%5D%3E%3E-for-%26%5BC%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#108">Source</a><a href="#impl-FromArrays%3C%26Box%3C%5B%5BT;+N%5D%5D%3E%3E-for-%26%5BC%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.FromArrays.html" title="trait cosmic::cosmic_theme::palette::cast::FromArrays">FromArrays</a><&'a <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]>> for &'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="method.from_arrays" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#108">Source</a><a href="#method.from_arrays" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.from_arrays" class="fn">from_arrays</a>(arrays: &'a <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]>) -> &'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-FromArrays%3C%26Vec%3C%5BT;+N%5D%3E%3E-for-%26%5BC%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#108">Source</a><a href="#impl-FromArrays%3C%26Vec%3C%5BT;+N%5D%3E%3E-for-%26%5BC%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.FromArrays.html" title="trait cosmic::cosmic_theme::palette::cast::FromArrays">FromArrays</a><&'a <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>> for &'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="method.from_arrays-1" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#108">Source</a><a href="#method.from_arrays-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.from_arrays" class="fn">from_arrays</a>(arrays: &'a <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>) -> &'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-FromArrays%3C%26%5B%5BT;+N%5D%5D%3E-for-%26%5BC%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#105">Source</a><a href="#impl-FromArrays%3C%26%5B%5BT;+N%5D%5D%3E-for-%26%5BC%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.FromArrays.html" title="trait cosmic::cosmic_theme::palette::cast::FromArrays">FromArrays</a><&'a [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]> for &'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="method.from_arrays-2" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#105">Source</a><a href="#method.from_arrays-2" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.from_arrays" class="fn">from_arrays</a>(arrays: &'a [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]) -> &'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-FromArrays%3C%26mut+Box%3C%5B%5BT;+N%5D%5D%3E%3E-for-%26mut+%5BC%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#108">Source</a><a href="#impl-FromArrays%3C%26mut+Box%3C%5B%5BT;+N%5D%5D%3E%3E-for-%26mut+%5BC%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.FromArrays.html" title="trait cosmic::cosmic_theme::palette::cast::FromArrays">FromArrays</a><&'a mut <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]>> for &'a mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="method.from_arrays-3" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#108">Source</a><a href="#method.from_arrays-3" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.from_arrays" class="fn">from_arrays</a>(arrays: &'a mut <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]>) -> &'a mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-FromArrays%3C%26mut+Vec%3C%5BT;+N%5D%3E%3E-for-%26mut+%5BC%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#108">Source</a><a href="#impl-FromArrays%3C%26mut+Vec%3C%5BT;+N%5D%3E%3E-for-%26mut+%5BC%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.FromArrays.html" title="trait cosmic::cosmic_theme::palette::cast::FromArrays">FromArrays</a><&'a mut <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>> for &'a mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="method.from_arrays-4" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#108">Source</a><a href="#method.from_arrays-4" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.from_arrays" class="fn">from_arrays</a>(arrays: &'a mut <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>) -> &'a mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-FromArrays%3C%26mut+%5B%5BT;+N%5D%5D%3E-for-%26mut+%5BC%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#105">Source</a><a href="#impl-FromArrays%3C%26mut+%5B%5BT;+N%5D%5D%3E-for-%26mut+%5BC%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.FromArrays.html" title="trait cosmic::cosmic_theme::palette::cast::FromArrays">FromArrays</a><&'a mut [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]> for &'a mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="method.from_arrays-5" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#105">Source</a><a href="#method.from_arrays-5" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.from_arrays" class="fn">from_arrays</a>(arrays: &'a mut [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]) -> &'a mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-FromArrays%3C%26%5B%5BT;+N%5D;+M%5D%3E-for-%26%5BC%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#105">Source</a><a href="#impl-FromArrays%3C%26%5B%5BT;+N%5D;+M%5D%3E-for-%26%5BC%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, const M: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.FromArrays.html" title="trait cosmic::cosmic_theme::palette::cast::FromArrays">FromArrays</a><&'a [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">M</a>]> for &'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="method.from_arrays-6" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#105">Source</a><a href="#method.from_arrays-6" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.from_arrays" class="fn">from_arrays</a>(arrays: &'a [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">M</a>]) -> &'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-FromArrays%3C%26mut+%5B%5BT;+N%5D;+M%5D%3E-for-%26mut+%5BC%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#105">Source</a><a href="#impl-FromArrays%3C%26mut+%5B%5BT;+N%5D;+M%5D%3E-for-%26mut+%5BC%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, const M: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.FromArrays.html" title="trait cosmic::cosmic_theme::palette::cast::FromArrays">FromArrays</a><&'a mut [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">M</a>]> for &'a mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="method.from_arrays-7" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#105">Source</a><a href="#method.from_arrays-7" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.from_arrays" class="fn">from_arrays</a>(arrays: &'a mut [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">M</a>]) -> &'a mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-FromArrays%3C%5B%5BT;+N%5D;+M%5D%3E-for-%5BC;+M%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#69-71">Source</a><a href="#impl-FromArrays%3C%5B%5BT;+N%5D;+M%5D%3E-for-%5BC;+M%5D" class="anchor">§</a><h3 class="code-header">impl<T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, const M: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.FromArrays.html" title="trait cosmic::cosmic_theme::palette::cast::FromArrays">FromArrays</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">M</a>]> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[C; M]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="method.from_arrays-8" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#74">Source</a><a href="#method.from_arrays-8" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.from_arrays" class="fn">from_arrays</a>(arrays: [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">M</a>]) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[C; M]</a></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-FromArrays%3CBox%3C%5B%5BT;+N%5D%5D%3E%3E-for-Box%3C%5BC%5D%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#111-113">Source</a><a href="#impl-FromArrays%3CBox%3C%5B%5BT;+N%5D%5D%3E%3E-for-Box%3C%5BC%5D%3E" class="anchor">§</a><h3 class="code-header">impl<T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.FromArrays.html" title="trait cosmic::cosmic_theme::palette::cast::FromArrays">FromArrays</a><<a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]>> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section><section id="impl-FromArrays%3CVec%3C%5BT;+N%5D%3E%3E-for-Vec%3CC%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#122-124">Source</a><a href="#impl-FromArrays%3CVec%3C%5BT;+N%5D%3E%3E-for-Vec%3CC%3E" class="anchor">§</a><h3 class="code-header">impl<T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.FromArrays.html" title="trait cosmic::cosmic_theme::palette::cast::FromArrays">FromArrays</a><<a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><C><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></div><script src="../../../../trait.impl/palette/cast/from_into_arrays_traits/trait.FromArrays.js" data-ignore-extern-crates="std,alloc" async></script></section></div></main></body></html>
|
||||
67
cosmic/cosmic_theme/palette/cast/trait.FromComponents.html
Normal file
67
cosmic/cosmic_theme/palette/cast/trait.FromComponents.html
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<!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="Trait for casting a collection of colors from a collection of color components without copying."><title>FromComponents in cosmic::cosmic_theme::palette::cast - 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="#">From<wbr>Components</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#panics" title="Panics">Panics</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.from_components" title="from_components">from_components</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>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Trait <span class="trait">FromComponents</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#247">Source</a> </span></div><pre class="rust item-decl"><code>pub trait FromComponents<C> {
|
||||
// Required method
|
||||
fn <a href="#tymethod.from_components" class="fn">from_components</a>(components: C) -> Self;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait for casting a collection of colors from a collection of color
|
||||
components without copying.</p>
|
||||
<p>This trait is meant as a more convenient alternative to the free functions
|
||||
in <a href="index.html" title="mod cosmic::cosmic_theme::palette::cast"><code>cast</code></a>, to allow method chaining among other things.</p>
|
||||
<h3 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h3>
|
||||
<p>The cast will panic if the cast fails, such as when the length of the input
|
||||
is not a multiple of the color’s array length.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::FromComponents, Srgb};
|
||||
|
||||
<span class="kw">let </span>array: [<span class="kw">_</span>; <span class="number">6</span>] = [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
<span class="kw">let </span>slice: <span class="kw-2">&</span>[<span class="kw">_</span>] = <span class="kw-2">&</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
<span class="kw">let </span>slice_mut: <span class="kw-2">&mut </span>[<span class="kw">_</span>] = <span class="kw-2">&mut </span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
<span class="kw">let </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
|
||||
<span class="macro">assert_eq!</span>(
|
||||
<[Srgb<u8>; <span class="number">2</span>]>::from_components(array),
|
||||
[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]
|
||||
);
|
||||
|
||||
<span class="macro">assert_eq!</span>(
|
||||
<<span class="kw-2">&</span>[Srgb<u8>]>::from_components(slice),
|
||||
[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]
|
||||
);
|
||||
|
||||
<span class="macro">assert_eq!</span>(
|
||||
<<span class="kw-2">&mut </span>[Srgb<u8>]>::from_components(slice_mut),
|
||||
[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]
|
||||
);
|
||||
|
||||
<span class="macro">assert_eq!</span>(
|
||||
Vec::<Srgb<u8>>::from_components(vec),
|
||||
<span class="macro">vec!</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]
|
||||
);</code></pre></div>
|
||||
<p>Owning types can be cast as slices, too:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::FromComponents, Srgb};
|
||||
|
||||
<span class="kw">let </span>array: [<span class="kw">_</span>; <span class="number">6</span>] = [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
|
||||
<span class="macro">assert_eq!</span>(
|
||||
<<span class="kw-2">&</span>[Srgb<u8>]>::from_components(<span class="kw-2">&</span>array),
|
||||
[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]
|
||||
);
|
||||
|
||||
<span class="macro">assert_eq!</span>(
|
||||
<<span class="kw-2">&mut </span>[Srgb<u8>]>::from_components(<span class="kw-2">&mut </span>vec),
|
||||
[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)]
|
||||
);</code></pre></div>
|
||||
<p>This panics:</p>
|
||||
|
||||
<div class="example-wrap should_panic"><a href="#" class="tooltip" title="This example panics">ⓘ</a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::FromComponents, Srgb};
|
||||
|
||||
<span class="kw">let </span>components = <span class="kw-2">&</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>, <span class="number">0</span>, <span class="number">123</span>]; <span class="comment">// Not a multiple of 3
|
||||
</span><<span class="kw-2">&</span>[Srgb<u8>]>::from_components(components);</code></pre></div>
|
||||
</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.from_components" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#254">Source</a><h4 class="code-header">fn <a href="#tymethod.from_components" class="fn">from_components</a>(components: C) -> Self</h4></section></summary><div class="docblock"><p>Cast a collection of color components into an collection of colors.</p>
|
||||
<h6 id="panics-1"><a class="doc-anchor" href="#panics-1">§</a>Panics</h6>
|
||||
<p>If the conversion can’t be done, such as when the number of items in
|
||||
<code>components</code> isn’t a multiple of the number of components in the color
|
||||
type.</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="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-FromComponents%3CC%3E-for-T" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#257-260">Source</a><a href="#impl-FromComponents%3CC%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, C> <a class="trait" href="trait.FromComponents.html" title="trait cosmic::cosmic_theme::palette::cast::FromComponents">FromComponents</a><C> for T<div class="where">where
|
||||
T: <a class="trait" href="trait.TryFromComponents.html" title="trait cosmic::cosmic_theme::palette::cast::TryFromComponents">TryFromComponents</a><C>,
|
||||
<T as <a class="trait" href="trait.TryFromComponents.html" title="trait cosmic::cosmic_theme::palette::cast::TryFromComponents">TryFromComponents</a><C>>::<a class="associatedtype" href="trait.TryFromComponents.html#associatedtype.Error" title="type cosmic::cosmic_theme::palette::cast::TryFromComponents::Error">Error</a>: <a class="trait" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/fmt/trait.Debug.html" title="trait cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::fmt::Debug">Debug</a>,</div></h3></section></div><script src="../../../../trait.impl/palette/cast/from_into_components_traits/trait.FromComponents.js" async></script></section></div></main></body></html>
|
||||
81
cosmic/cosmic_theme/palette/cast/trait.FromUints.html
Normal file
81
cosmic/cosmic_theme/palette/cast/trait.FromUints.html
Normal file
File diff suppressed because one or more lines are too long
41
cosmic/cosmic_theme/palette/cast/trait.IntoArrays.html
Normal file
41
cosmic/cosmic_theme/palette/cast/trait.IntoArrays.html
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<!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="Trait for casting a collection of colors into a collection of arrays without copying."><title>IntoArrays in cosmic::cosmic_theme::palette::cast - 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="#">Into<wbr>Arrays</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.into_arrays" title="into_arrays">into_arrays</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-IntoArrays%3C%26%5B%5BT;+N%5D%5D%3E-for-%26%5BC;+M%5D" title="&'a [C; M]">&'a [C; M]</a></li><li><a href="#impl-IntoArrays%3C%26%5B%5BT;+N%5D%5D%3E-for-%26%5BC%5D" title="&'a [C]">&'a [C]</a></li><li><a href="#impl-IntoArrays%3C%26mut+%5B%5BT;+N%5D%5D%3E-for-%26mut+%5BC;+M%5D" title="&'a mut [C; M]">&'a mut [C; M]</a></li><li><a href="#impl-IntoArrays%3C%26mut+%5B%5BT;+N%5D%5D%3E-for-%26mut+%5BC%5D" title="&'a mut [C]">&'a mut [C]</a></li><li><a href="#impl-IntoArrays%3C%5B%5BT;+N%5D;+M%5D%3E-for-%5BC;+M%5D" title="[C; M]">[C; M]</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Trait <span class="trait">IntoArrays</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#165">Source</a> </span></div><pre class="rust item-decl"><code>pub trait IntoArrays<A> {
|
||||
// Required method
|
||||
fn <a href="#tymethod.into_arrays" class="fn">into_arrays</a>(self) -> A;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait for casting a collection of colors into a collection of arrays without
|
||||
copying.</p>
|
||||
<p>This trait is meant as a more convenient alternative to the free functions
|
||||
in <a href="index.html" title="mod cosmic::cosmic_theme::palette::cast"><code>cast</code></a>, to allow method chaining among other things.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::IntoArrays, Srgb};
|
||||
|
||||
<span class="kw">let </span>array: [<span class="kw">_</span>; <span class="number">2</span>] = [Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="kw">let </span>slice: <span class="kw-2">&</span>[<span class="kw">_</span>] = <span class="kw-2">&</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="kw">let </span>slice_mut: <span class="kw-2">&mut </span>[<span class="kw">_</span>] = <span class="kw-2">&mut </span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="kw">let </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
|
||||
<span class="macro">assert_eq!</span>(array.into_arrays(), [[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]]);
|
||||
<span class="macro">assert_eq!</span>(slice.into_arrays(), [[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]]);
|
||||
<span class="macro">assert_eq!</span>(slice_mut.into_arrays(), [[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]]);
|
||||
<span class="macro">assert_eq!</span>(vec.into_arrays(), <span class="macro">vec!</span>[[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]]);</code></pre></div>
|
||||
<p>Owning types can be cast as slices, too:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::IntoArrays, Srgb};
|
||||
|
||||
<span class="kw">let </span>array: [<span class="kw">_</span>; <span class="number">2</span>] = [Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
|
||||
<span class="macro">assert_eq!</span>((<span class="kw-2">&</span>array).into_arrays(), [[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]]);
|
||||
<span class="macro">assert_eq!</span>((<span class="kw-2">&mut </span>vec).into_arrays(), [[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>], [<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]]);</code></pre></div>
|
||||
</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.into_arrays" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#167">Source</a><h4 class="code-header">fn <a href="#tymethod.into_arrays" class="fn">into_arrays</a>(self) -> A</h4></section></summary><div class="docblock"><p>Cast this collection of colors into a collection of arrays.</p>
|
||||
</div></details></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-IntoArrays%3C%26%5B%5BT;+N%5D%5D%3E-for-%26%5BC%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#206">Source</a><a href="#impl-IntoArrays%3C%26%5B%5BT;+N%5D%5D%3E-for-%26%5BC%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.IntoArrays.html" title="trait cosmic::cosmic_theme::palette::cast::IntoArrays">IntoArrays</a><&'a [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]> for &'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="method.into_arrays" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#206">Source</a><a href="#method.into_arrays" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.into_arrays" class="fn">into_arrays</a>(self) -> &'a [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-IntoArrays%3C%26mut+%5B%5BT;+N%5D%5D%3E-for-%26mut+%5BC%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#206">Source</a><a href="#impl-IntoArrays%3C%26mut+%5B%5BT;+N%5D%5D%3E-for-%26mut+%5BC%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.IntoArrays.html" title="trait cosmic::cosmic_theme::palette::cast::IntoArrays">IntoArrays</a><&'a mut [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]> for &'a mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="method.into_arrays-1" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#206">Source</a><a href="#method.into_arrays-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.into_arrays" class="fn">into_arrays</a>(self) -> &'a mut [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-IntoArrays%3C%26%5B%5BT;+N%5D%5D%3E-for-%26%5BC;+M%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#206">Source</a><a href="#impl-IntoArrays%3C%26%5B%5BT;+N%5D%5D%3E-for-%26%5BC;+M%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, const M: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.IntoArrays.html" title="trait cosmic::cosmic_theme::palette::cast::IntoArrays">IntoArrays</a><&'a [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]> for &'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[C; M]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="method.into_arrays-2" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#206">Source</a><a href="#method.into_arrays-2" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.into_arrays" class="fn">into_arrays</a>(self) -> &'a [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-IntoArrays%3C%26mut+%5B%5BT;+N%5D%5D%3E-for-%26mut+%5BC;+M%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#206">Source</a><a href="#impl-IntoArrays%3C%26mut+%5B%5BT;+N%5D%5D%3E-for-%26mut+%5BC;+M%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, const M: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.IntoArrays.html" title="trait cosmic::cosmic_theme::palette::cast::IntoArrays">IntoArrays</a><&'a mut [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]> for &'a mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[C; M]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="method.into_arrays-3" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#206">Source</a><a href="#method.into_arrays-3" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.into_arrays" class="fn">into_arrays</a>(self) -> &'a mut [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-IntoArrays%3C%5B%5BT;+N%5D;+M%5D%3E-for-%5BC;+M%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#170-172">Source</a><a href="#impl-IntoArrays%3C%5B%5BT;+N%5D;+M%5D%3E-for-%5BC;+M%5D" class="anchor">§</a><h3 class="code-header">impl<T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, const M: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.IntoArrays.html" title="trait cosmic::cosmic_theme::palette::cast::IntoArrays">IntoArrays</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">M</a>]> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[C; M]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="method.into_arrays-4" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#175">Source</a><a href="#method.into_arrays-4" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.into_arrays" class="fn">into_arrays</a>(self) -> [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">M</a>]</h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-IntoArrays%3C%26%5B%5BT;+N%5D%5D%3E-for-%26Box%3C%5BC%5D%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#209">Source</a><a href="#impl-IntoArrays%3C%26%5B%5BT;+N%5D%5D%3E-for-%26Box%3C%5BC%5D%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.IntoArrays.html" title="trait cosmic::cosmic_theme::palette::cast::IntoArrays">IntoArrays</a><&'a [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]> for &'a <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section><section id="impl-IntoArrays%3C%26%5B%5BT;+N%5D%5D%3E-for-%26Vec%3CC%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#209">Source</a><a href="#impl-IntoArrays%3C%26%5B%5BT;+N%5D%5D%3E-for-%26Vec%3CC%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.IntoArrays.html" title="trait cosmic::cosmic_theme::palette::cast::IntoArrays">IntoArrays</a><&'a [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]> for &'a <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><C><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section><section id="impl-IntoArrays%3C%26mut+%5B%5BT;+N%5D%5D%3E-for-%26mut+Box%3C%5BC%5D%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#209">Source</a><a href="#impl-IntoArrays%3C%26mut+%5B%5BT;+N%5D%5D%3E-for-%26mut+Box%3C%5BC%5D%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.IntoArrays.html" title="trait cosmic::cosmic_theme::palette::cast::IntoArrays">IntoArrays</a><&'a mut [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]> for &'a mut <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section><section id="impl-IntoArrays%3C%26mut+%5B%5BT;+N%5D%5D%3E-for-%26mut+Vec%3CC%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#209">Source</a><a href="#impl-IntoArrays%3C%26mut+%5B%5BT;+N%5D%5D%3E-for-%26mut+Vec%3CC%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.IntoArrays.html" title="trait cosmic::cosmic_theme::palette::cast::IntoArrays">IntoArrays</a><&'a mut [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]> for &'a mut <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><C><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section><section id="impl-IntoArrays%3CBox%3C%5B%5BT;+N%5D%5D%3E%3E-for-Box%3C%5BC%5D%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#212-214">Source</a><a href="#impl-IntoArrays%3CBox%3C%5B%5BT;+N%5D%5D%3E%3E-for-Box%3C%5BC%5D%3E" class="anchor">§</a><h3 class="code-header">impl<T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.IntoArrays.html" title="trait cosmic::cosmic_theme::palette::cast::IntoArrays">IntoArrays</a><<a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>]>> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section><section id="impl-IntoArrays%3CVec%3C%5BT;+N%5D%3E%3E-for-Vec%3CC%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_arrays_traits.rs.html#223-225">Source</a><a href="#impl-IntoArrays%3CVec%3C%5BT;+N%5D%3E%3E-for-Vec%3CC%3E" class="anchor">§</a><h3 class="code-header">impl<T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.IntoArrays.html" title="trait cosmic::cosmic_theme::palette::cast::IntoArrays">IntoArrays</a><<a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><C><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></div><script src="../../../../trait.impl/palette/cast/from_into_arrays_traits/trait.IntoArrays.js" data-ignore-extern-crates="std,alloc" async></script></section></div></main></body></html>
|
||||
60
cosmic/cosmic_theme/palette/cast/trait.IntoComponents.html
Normal file
60
cosmic/cosmic_theme/palette/cast/trait.IntoComponents.html
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<!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="Trait for casting a collection of colors into a collection of color components without copying."><title>IntoComponents in cosmic::cosmic_theme::palette::cast - 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="#">Into<wbr>Components</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.into_components" title="into_components">into_components</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-IntoComponents%3C%26%5BT%5D%3E-for-%26%5BC;+N%5D" title="&'a [C; N]">&'a [C; N]</a></li><li><a href="#impl-IntoComponents%3C%26%5BT%5D%3E-for-%26%5BC%5D" title="&'a [C]">&'a [C]</a></li><li><a href="#impl-IntoComponents%3C%26mut+%5BT%5D%3E-for-%26mut+%5BC;+N%5D" title="&'a mut [C; N]">&'a mut [C; N]</a></li><li><a href="#impl-IntoComponents%3C%26mut+%5BT%5D%3E-for-%26mut+%5BC%5D" title="&'a mut [C]">&'a mut [C]</a></li><li><a href="#impl-IntoComponents%3C%5BT;+M%5D%3E-for-%5BC;+N%5D" title="[C; N]">[C; N]</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Trait <span class="trait">IntoComponents</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#301">Source</a> </span></div><pre class="rust item-decl"><code>pub trait IntoComponents<C> {
|
||||
// Required method
|
||||
fn <a href="#tymethod.into_components" class="fn">into_components</a>(self) -> C;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait for casting a collection of colors into a collection of color
|
||||
components without copying.</p>
|
||||
<p>This trait is meant as a more convenient alternative to the free functions
|
||||
in <a href="index.html" title="mod cosmic::cosmic_theme::palette::cast"><code>cast</code></a>, to allow method chaining among other things.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::IntoComponents, Srgb};
|
||||
|
||||
<span class="kw">let </span>array: [<span class="kw">_</span>; <span class="number">2</span>] = [Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="kw">let </span>slice: <span class="kw-2">&</span>[<span class="kw">_</span>] = <span class="kw-2">&</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="kw">let </span>slice_mut: <span class="kw-2">&mut </span>[<span class="kw">_</span>] = <span class="kw-2">&mut </span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="kw">let </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
|
||||
<span class="macro">assert_eq!</span>(array.into_components(), [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]);
|
||||
<span class="macro">assert_eq!</span>(slice.into_components(), [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]);
|
||||
<span class="macro">assert_eq!</span>(slice_mut.into_components(), [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]);
|
||||
<span class="macro">assert_eq!</span>(vec.into_components(), <span class="macro">vec!</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]);</code></pre></div>
|
||||
<p>Owning types can be cast as slices, too:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::IntoComponents, Srgb};
|
||||
|
||||
<span class="kw">let </span>array: [<span class="kw">_</span>; <span class="number">2</span>] = [Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)];
|
||||
|
||||
<span class="macro">assert_eq!</span>((<span class="kw-2">&</span>array).into_components(), [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]);
|
||||
<span class="macro">assert_eq!</span>((<span class="kw-2">&mut </span>vec).into_components(), [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>]);</code></pre></div>
|
||||
</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.into_components" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#303">Source</a><h4 class="code-header">fn <a href="#tymethod.into_components" class="fn">into_components</a>(self) -> C</h4></section></summary><div class="docblock"><p>Cast this collection of colors into a collection of color components.</p>
|
||||
</div></details></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-IntoComponents%3C%26%5BT%5D%3E-for-%26%5BC%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#347">Source</a><a href="#impl-IntoComponents%3C%26%5BT%5D%3E-for-%26%5BC%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C> <a class="trait" href="trait.IntoComponents.html" title="trait cosmic::cosmic_theme::palette::cast::IntoComponents">IntoComponents</a><&'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>> for &'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a><div class="where">where
|
||||
T: 'a,
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,
|
||||
<C as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>: <a class="trait" href="../trait.ArrayExt.html" title="trait cosmic::cosmic_theme::palette::ArrayExt">ArrayExt</a><Item = T>,</div></h3></section></summary><div class="impl-items"><section id="method.into_components" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#347">Source</a><a href="#method.into_components" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.into_components" class="fn">into_components</a>(self) -> &'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-IntoComponents%3C%26mut+%5BT%5D%3E-for-%26mut+%5BC%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#347">Source</a><a href="#impl-IntoComponents%3C%26mut+%5BT%5D%3E-for-%26mut+%5BC%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C> <a class="trait" href="trait.IntoComponents.html" title="trait cosmic::cosmic_theme::palette::cast::IntoComponents">IntoComponents</a><&'a mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>> for &'a mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a><div class="where">where
|
||||
T: 'a,
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,
|
||||
<C as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>: <a class="trait" href="../trait.ArrayExt.html" title="trait cosmic::cosmic_theme::palette::ArrayExt">ArrayExt</a><Item = T>,</div></h3></section></summary><div class="impl-items"><section id="method.into_components-1" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#347">Source</a><a href="#method.into_components-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.into_components" class="fn">into_components</a>(self) -> &'a mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-IntoComponents%3C%26%5BT%5D%3E-for-%26%5BC;+N%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#347">Source</a><a href="#impl-IntoComponents%3C%26%5BT%5D%3E-for-%26%5BC;+N%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.IntoComponents.html" title="trait cosmic::cosmic_theme::palette::cast::IntoComponents">IntoComponents</a><&'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>> for &'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[C; N]</a><div class="where">where
|
||||
T: 'a,
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,
|
||||
<C as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>: <a class="trait" href="../trait.ArrayExt.html" title="trait cosmic::cosmic_theme::palette::ArrayExt">ArrayExt</a><Item = T>,</div></h3></section></summary><div class="impl-items"><section id="method.into_components-2" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#347">Source</a><a href="#method.into_components-2" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.into_components" class="fn">into_components</a>(self) -> &'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-IntoComponents%3C%26mut+%5BT%5D%3E-for-%26mut+%5BC;+N%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#347">Source</a><a href="#impl-IntoComponents%3C%26mut+%5BT%5D%3E-for-%26mut+%5BC;+N%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.IntoComponents.html" title="trait cosmic::cosmic_theme::palette::cast::IntoComponents">IntoComponents</a><&'a mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>> for &'a mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[C; N]</a><div class="where">where
|
||||
T: 'a,
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,
|
||||
<C as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>: <a class="trait" href="../trait.ArrayExt.html" title="trait cosmic::cosmic_theme::palette::ArrayExt">ArrayExt</a><Item = T>,</div></h3></section></summary><div class="impl-items"><section id="method.into_components-3" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#347">Source</a><a href="#method.into_components-3" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.into_components" class="fn">into_components</a>(self) -> &'a mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-IntoComponents%3C%5BT;+M%5D%3E-for-%5BC;+N%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#306-309">Source</a><a href="#impl-IntoComponents%3C%5BT;+M%5D%3E-for-%5BC;+N%5D" class="anchor">§</a><h3 class="code-header">impl<T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, const M: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.IntoComponents.html" title="trait cosmic::cosmic_theme::palette::cast::IntoComponents">IntoComponents</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; M]</a>> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[C; N]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,
|
||||
<C as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>: <a class="trait" href="../trait.ArrayExt.html" title="trait cosmic::cosmic_theme::palette::ArrayExt">ArrayExt</a><Item = T>,</div></h3></section></summary><div class="impl-items"><section id="method.into_components-4" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#312">Source</a><a href="#method.into_components-4" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.into_components" class="fn">into_components</a>(self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; M]</a></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-IntoComponents%3C%26%5BT%5D%3E-for-%26Box%3C%5BC%5D%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#350">Source</a><a href="#impl-IntoComponents%3C%26%5BT%5D%3E-for-%26Box%3C%5BC%5D%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, C> <a class="trait" href="trait.IntoComponents.html" title="trait cosmic::cosmic_theme::palette::cast::IntoComponents">IntoComponents</a><&'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>> for &'a <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>><div class="where">where
|
||||
T: 'a,
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,
|
||||
<C as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>: <a class="trait" href="../trait.ArrayExt.html" title="trait cosmic::cosmic_theme::palette::ArrayExt">ArrayExt</a><Item = T>,</div></h3></section><section id="impl-IntoComponents%3C%26%5BT%5D%3E-for-%26Vec%3CC%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#350">Source</a><a href="#impl-IntoComponents%3C%26%5BT%5D%3E-for-%26Vec%3CC%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, C> <a class="trait" href="trait.IntoComponents.html" title="trait cosmic::cosmic_theme::palette::cast::IntoComponents">IntoComponents</a><&'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>> for &'a <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><C><div class="where">where
|
||||
T: 'a,
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,
|
||||
<C as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>: <a class="trait" href="../trait.ArrayExt.html" title="trait cosmic::cosmic_theme::palette::ArrayExt">ArrayExt</a><Item = T>,</div></h3></section><section id="impl-IntoComponents%3C%26mut+%5BT%5D%3E-for-%26mut+Box%3C%5BC%5D%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#350">Source</a><a href="#impl-IntoComponents%3C%26mut+%5BT%5D%3E-for-%26mut+Box%3C%5BC%5D%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, C> <a class="trait" href="trait.IntoComponents.html" title="trait cosmic::cosmic_theme::palette::cast::IntoComponents">IntoComponents</a><&'a mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>> for &'a mut <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>><div class="where">where
|
||||
T: 'a,
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,
|
||||
<C as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>: <a class="trait" href="../trait.ArrayExt.html" title="trait cosmic::cosmic_theme::palette::ArrayExt">ArrayExt</a><Item = T>,</div></h3></section><section id="impl-IntoComponents%3C%26mut+%5BT%5D%3E-for-%26mut+Vec%3CC%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#350">Source</a><a href="#impl-IntoComponents%3C%26mut+%5BT%5D%3E-for-%26mut+Vec%3CC%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, C> <a class="trait" href="trait.IntoComponents.html" title="trait cosmic::cosmic_theme::palette::cast::IntoComponents">IntoComponents</a><&'a mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>> for &'a mut <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><C><div class="where">where
|
||||
T: 'a,
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,
|
||||
<C as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>: <a class="trait" href="../trait.ArrayExt.html" title="trait cosmic::cosmic_theme::palette::ArrayExt">ArrayExt</a><Item = T>,</div></h3></section><section id="impl-IntoComponents%3CBox%3C%5BT%5D%3E%3E-for-Box%3C%5BC%5D%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#353-356">Source</a><a href="#impl-IntoComponents%3CBox%3C%5BT%5D%3E%3E-for-Box%3C%5BC%5D%3E" class="anchor">§</a><h3 class="code-header">impl<T, C> <a class="trait" href="trait.IntoComponents.html" title="trait cosmic::cosmic_theme::palette::cast::IntoComponents">IntoComponents</a><<a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>>> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,
|
||||
<C as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>: <a class="trait" href="../trait.ArrayExt.html" title="trait cosmic::cosmic_theme::palette::ArrayExt">ArrayExt</a><Item = T>,</div></h3></section><section id="impl-IntoComponents%3CVec%3CT%3E%3E-for-Vec%3CC%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#365-368">Source</a><a href="#impl-IntoComponents%3CVec%3CT%3E%3E-for-Vec%3CC%3E" class="anchor">§</a><h3 class="code-header">impl<T, C> <a class="trait" href="trait.IntoComponents.html" title="trait cosmic::cosmic_theme::palette::cast::IntoComponents">IntoComponents</a><<a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><T>> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><C><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>,
|
||||
<C as <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a>>::<a class="associatedtype" href="trait.ArrayCast.html#associatedtype.Array" title="type cosmic::cosmic_theme::palette::cast::ArrayCast::Array">Array</a>: <a class="trait" href="../trait.ArrayExt.html" title="trait cosmic::cosmic_theme::palette::ArrayExt">ArrayExt</a><Item = T>,</div></h3></section></div><script src="../../../../trait.impl/palette/cast/from_into_components_traits/trait.IntoComponents.js" data-ignore-extern-crates="std,alloc" async></script></section></div></main></body></html>
|
||||
59
cosmic/cosmic_theme/palette/cast/trait.IntoUints.html
Normal file
59
cosmic/cosmic_theme/palette/cast/trait.IntoUints.html
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<!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="Trait for casting a collection of colors into a collection of unsigned integers without copying."><title>IntoUints in cosmic::cosmic_theme::palette::cast - 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="#">Into<wbr>Uints</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.into_uints" title="into_uints">into_uints</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-IntoUints%3C%26%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%26%5BC;+M%5D" title="&'a [C; M]">&'a [C; M]</a></li><li><a href="#impl-IntoUints%3C%26%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%26%5BC%5D" title="&'a [C]">&'a [C]</a></li><li><a href="#impl-IntoUints%3C%26mut+%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%26mut+%5BC;+M%5D" title="&'a mut [C; M]">&'a mut [C; M]</a></li><li><a href="#impl-IntoUints%3C%26mut+%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%26mut+%5BC%5D" title="&'a mut [C]">&'a mut [C]</a></li><li><a href="#impl-IntoUints%3C%5B%3CC+as+UintCast%3E::Uint;+N%5D%3E-for-%5BC;+N%5D" title="[C; N]">[C; N]</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Trait <span class="trait">IntoUints</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_uints_traits.rs.html#201">Source</a> </span></div><pre class="rust item-decl"><code>pub trait IntoUints<U> {
|
||||
// Required method
|
||||
fn <a href="#tymethod.into_uints" class="fn">into_uints</a>(self) -> U;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait for casting a collection of colors into a collection of unsigned
|
||||
integers without copying.</p>
|
||||
<p>This trait is meant as a more convenient alternative to the free functions
|
||||
in <a href="index.html" title="mod cosmic::cosmic_theme::palette::cast"><code>cast</code></a>, to allow method chaining among other things.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::IntoUints, rgb::PackedArgb, Srgba};
|
||||
|
||||
<span class="kw">let </span>array: [PackedArgb; <span class="number">2</span>] = [
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
];
|
||||
<span class="kw">let </span>slice: <span class="kw-2">&</span>[PackedArgb] = <span class="kw-2">&</span>[
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
];
|
||||
<span class="kw">let </span>slice_mut: <span class="kw-2">&mut </span>[PackedArgb] = <span class="kw-2">&mut </span>[
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
];
|
||||
<span class="kw">let </span>vec: Vec<PackedArgb> = <span class="macro">vec!</span>[
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
];
|
||||
|
||||
<span class="macro">assert_eq!</span>(array.into_uints(), [<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>]);
|
||||
<span class="macro">assert_eq!</span>(slice.into_uints(), [<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>]);
|
||||
<span class="macro">assert_eq!</span>(slice_mut.into_uints(), [<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>]);
|
||||
<span class="macro">assert_eq!</span>(vec.into_uints(), <span class="macro">vec!</span>[<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>]);</code></pre></div>
|
||||
<p>Owning types can be cast as slices, too:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::IntoUints, rgb::PackedArgb, Srgba};
|
||||
|
||||
<span class="kw">let </span>array: [PackedArgb; <span class="number">2</span>] = [
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
];
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>vec: Vec<PackedArgb> = <span class="macro">vec!</span>[
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
];
|
||||
|
||||
<span class="macro">assert_eq!</span>((<span class="kw-2">&</span>array).into_uints(), [<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>]);
|
||||
<span class="macro">assert_eq!</span>((<span class="kw-2">&mut </span>vec).into_uints(), [<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>]);</code></pre></div>
|
||||
</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.into_uints" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_uints_traits.rs.html#203">Source</a><h4 class="code-header">fn <a href="#tymethod.into_uints" class="fn">into_uints</a>(self) -> U</h4></section></summary><div class="docblock"><p>Cast this collection of colors into a collection of unsigned integers.</p>
|
||||
</div></details></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-IntoUints%3C%26%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%26%5BC%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_uints_traits.rs.html#242">Source</a><a href="#impl-IntoUints%3C%26%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%26%5BC%5D" class="anchor">§</a><h3 class="code-header">impl<'a, C> <a class="trait" href="trait.IntoUints.html" title="trait cosmic::cosmic_theme::palette::cast::IntoUints">IntoUints</a><&'a [<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]> for &'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></h3></section></summary><div class="impl-items"><section id="method.into_uints" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_uints_traits.rs.html#242">Source</a><a href="#method.into_uints" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.into_uints" class="fn">into_uints</a>(self) -> &'a [<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-IntoUints%3C%26mut+%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%26mut+%5BC%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_uints_traits.rs.html#242">Source</a><a href="#impl-IntoUints%3C%26mut+%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%26mut+%5BC%5D" class="anchor">§</a><h3 class="code-header">impl<'a, C> <a class="trait" href="trait.IntoUints.html" title="trait cosmic::cosmic_theme::palette::cast::IntoUints">IntoUints</a><&'a mut [<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]> for &'a mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></h3></section></summary><div class="impl-items"><section id="method.into_uints-1" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_uints_traits.rs.html#242">Source</a><a href="#method.into_uints-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.into_uints" class="fn">into_uints</a>(self) -> &'a mut [<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-IntoUints%3C%26%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%26%5BC;+M%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_uints_traits.rs.html#242">Source</a><a href="#impl-IntoUints%3C%26%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%26%5BC;+M%5D" class="anchor">§</a><h3 class="code-header">impl<'a, C, const M: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.IntoUints.html" title="trait cosmic::cosmic_theme::palette::cast::IntoUints">IntoUints</a><&'a [<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]> for &'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[C; M]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></h3></section></summary><div class="impl-items"><section id="method.into_uints-2" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_uints_traits.rs.html#242">Source</a><a href="#method.into_uints-2" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.into_uints" class="fn">into_uints</a>(self) -> &'a [<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-IntoUints%3C%26mut+%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%26mut+%5BC;+M%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_uints_traits.rs.html#242">Source</a><a href="#impl-IntoUints%3C%26mut+%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%26mut+%5BC;+M%5D" class="anchor">§</a><h3 class="code-header">impl<'a, C, const M: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.IntoUints.html" title="trait cosmic::cosmic_theme::palette::cast::IntoUints">IntoUints</a><&'a mut [<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]> for &'a mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[C; M]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></h3></section></summary><div class="impl-items"><section id="method.into_uints-3" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_uints_traits.rs.html#242">Source</a><a href="#method.into_uints-3" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.into_uints" class="fn">into_uints</a>(self) -> &'a mut [<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-IntoUints%3C%5B%3CC+as+UintCast%3E::Uint;+N%5D%3E-for-%5BC;+N%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_uints_traits.rs.html#206-208">Source</a><a href="#impl-IntoUints%3C%5B%3CC+as+UintCast%3E::Uint;+N%5D%3E-for-%5BC;+N%5D" class="anchor">§</a><h3 class="code-header">impl<C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.IntoUints.html" title="trait cosmic::cosmic_theme::palette::cast::IntoUints">IntoUints</a><[<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">N</a>]> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[C; N]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></h3></section></summary><div class="impl-items"><section id="method.into_uints-4" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_uints_traits.rs.html#211">Source</a><a href="#method.into_uints-4" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.into_uints" class="fn">into_uints</a>(self) -> [<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">N</a>]</h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-IntoUints%3C%26%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%26Box%3C%5BC%5D%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_uints_traits.rs.html#245">Source</a><a href="#impl-IntoUints%3C%26%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%26Box%3C%5BC%5D%3E" class="anchor">§</a><h3 class="code-header">impl<'a, C> <a class="trait" href="trait.IntoUints.html" title="trait cosmic::cosmic_theme::palette::cast::IntoUints">IntoUints</a><&'a [<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]> for &'a <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>><div class="where">where
|
||||
C: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></h3></section><section id="impl-IntoUints%3C%26%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%26Vec%3CC%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_uints_traits.rs.html#245">Source</a><a href="#impl-IntoUints%3C%26%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%26Vec%3CC%3E" class="anchor">§</a><h3 class="code-header">impl<'a, C> <a class="trait" href="trait.IntoUints.html" title="trait cosmic::cosmic_theme::palette::cast::IntoUints">IntoUints</a><&'a [<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]> for &'a <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><C><div class="where">where
|
||||
C: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></h3></section><section id="impl-IntoUints%3C%26mut+%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%26mut+Box%3C%5BC%5D%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_uints_traits.rs.html#245">Source</a><a href="#impl-IntoUints%3C%26mut+%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%26mut+Box%3C%5BC%5D%3E" class="anchor">§</a><h3 class="code-header">impl<'a, C> <a class="trait" href="trait.IntoUints.html" title="trait cosmic::cosmic_theme::palette::cast::IntoUints">IntoUints</a><&'a mut [<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]> for &'a mut <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>><div class="where">where
|
||||
C: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></h3></section><section id="impl-IntoUints%3C%26mut+%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%26mut+Vec%3CC%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_uints_traits.rs.html#245">Source</a><a href="#impl-IntoUints%3C%26mut+%5B%3CC+as+UintCast%3E::Uint%5D%3E-for-%26mut+Vec%3CC%3E" class="anchor">§</a><h3 class="code-header">impl<'a, C> <a class="trait" href="trait.IntoUints.html" title="trait cosmic::cosmic_theme::palette::cast::IntoUints">IntoUints</a><&'a mut [<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]> for &'a mut <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><C><div class="where">where
|
||||
C: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></h3></section><section id="impl-IntoUints%3CBox%3C%5B%3CC+as+UintCast%3E::Uint%5D%3E%3E-for-Box%3C%5BC%5D%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_uints_traits.rs.html#248-250">Source</a><a href="#impl-IntoUints%3CBox%3C%5B%3CC+as+UintCast%3E::Uint%5D%3E%3E-for-Box%3C%5BC%5D%3E" class="anchor">§</a><h3 class="code-header">impl<C> <a class="trait" href="trait.IntoUints.html" title="trait cosmic::cosmic_theme::palette::cast::IntoUints">IntoUints</a><<a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><[<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]>> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>><div class="where">where
|
||||
C: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></h3></section><section id="impl-IntoUints%3CVec%3C%3CC+as+UintCast%3E::Uint%3E%3E-for-Vec%3CC%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_uints_traits.rs.html#259-261">Source</a><a href="#impl-IntoUints%3CVec%3C%3CC+as+UintCast%3E::Uint%3E%3E-for-Vec%3CC%3E" class="anchor">§</a><h3 class="code-header">impl<C> <a class="trait" href="trait.IntoUints.html" title="trait cosmic::cosmic_theme::palette::cast::IntoUints">IntoUints</a><<a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>>> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><C><div class="where">where
|
||||
C: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></h3></section></div><script src="../../../../trait.impl/palette/cast/from_into_uints_traits/trait.IntoUints.js" data-ignore-extern-crates="std,alloc" async></script></section></div></main></body></html>
|
||||
50
cosmic/cosmic_theme/palette/cast/trait.TryComponentsAs.html
Normal file
50
cosmic/cosmic_theme/palette/cast/trait.TryComponentsAs.html
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<!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="Trait for trying to cast a reference to collection of color components into a reference to collection of colors without copying."><title>TryComponentsAs in cosmic::cosmic_theme::palette::cast - 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="#">TryComponents<wbr>As</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#errors" title="Errors">Errors</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Error" title="Error">Error</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.try_components_as" title="try_components_as">try_components_as</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-TryComponentsAs%3C%5BC%5D%3E-for-%5BT;+M%5D" title="[T; M]">[T; M]</a></li><li><a href="#impl-TryComponentsAs%3C%5BC%5D%3E-for-%5BT%5D" title="[T]">[T]</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Trait <span class="trait">TryComponentsAs</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#127">Source</a> </span></div><pre class="rust item-decl"><code>pub trait TryComponentsAs<C><div class="where">where
|
||||
C: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div>{
|
||||
type <a href="#associatedtype.Error" class="associatedtype">Error</a>;
|
||||
|
||||
// Required method
|
||||
fn <a href="#tymethod.try_components_as" class="fn">try_components_as</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&C</a>, Self::<a class="associatedtype" href="trait.TryComponentsAs.html#associatedtype.Error" title="type cosmic::cosmic_theme::palette::cast::TryComponentsAs::Error">Error</a>>;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait for trying to cast a reference to collection of color components into
|
||||
a reference to collection of colors without copying.</p>
|
||||
<p>This trait is meant as a more convenient alternative to the free functions
|
||||
in <a href="index.html" title="mod cosmic::cosmic_theme::palette::cast"><code>cast</code></a>, to allow method chaining among other things.</p>
|
||||
<h3 id="errors"><a class="doc-anchor" href="#errors">§</a>Errors</h3>
|
||||
<p>The cast will return an error if the cast fails, such as when the length of
|
||||
the input is not a multiple of the color’s array length.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::TryComponentsAs, Srgb};
|
||||
|
||||
<span class="kw">let </span>array: [<span class="kw">_</span>; <span class="number">6</span>] = [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
<span class="kw">let </span>slice: <span class="kw-2">&</span>[<span class="kw">_</span>] = <span class="kw-2">&</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
<span class="kw">let </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
|
||||
<span class="kw">let </span>colors: <span class="prelude-ty">Result</span><<span class="kw-2">&</span>[Srgb<u8>], <span class="kw">_</span>> = array.try_components_as();
|
||||
<span class="macro">assert_eq!</span>(colors, <span class="prelude-val">Ok</span>(<span class="kw-2">&</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)][..]));
|
||||
|
||||
<span class="kw">let </span>colors: <span class="prelude-ty">Result</span><<span class="kw-2">&</span>[Srgb<u8>], <span class="kw">_</span>> = slice.try_components_as();
|
||||
<span class="macro">assert_eq!</span>(colors, <span class="prelude-val">Ok</span>(<span class="kw-2">&</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)][..]));
|
||||
|
||||
<span class="kw">let </span>colors: <span class="prelude-ty">Result</span><<span class="kw-2">&</span>[Srgb<u8>], <span class="kw">_</span>> = vec.try_components_as();
|
||||
<span class="macro">assert_eq!</span>(colors, <span class="prelude-val">Ok</span>(<span class="kw-2">&</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)][..]));</code></pre></div>
|
||||
<p>This produces an error:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::TryComponentsAs, Srgb};
|
||||
|
||||
<span class="kw">let </span>components = [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>]; <span class="comment">// Not a multiple of 3
|
||||
</span><span class="kw">let </span>colors: <span class="prelude-ty">Result</span><<span class="kw-2">&</span>[Srgb<u8>], <span class="kw">_</span>> = components.try_components_as();
|
||||
<span class="macro">assert!</span>(colors.is_err());</code></pre></div>
|
||||
</div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Error" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#129">Source</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a></h4></section></summary><div class="docblock"><p>The error for when <code>try_components_as</code> fails to cast.</p>
|
||||
</div></details></div><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.try_components_as" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#137">Source</a><h4 class="code-header">fn <a href="#tymethod.try_components_as" class="fn">try_components_as</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&C</a>, Self::<a class="associatedtype" href="trait.TryComponentsAs.html#associatedtype.Error" title="type cosmic::cosmic_theme::palette::cast::TryComponentsAs::Error">Error</a>></h4></section></summary><div class="docblock"><p>Try to cast this collection of color components into a reference to a
|
||||
collection of colors.</p>
|
||||
<p>Return an error if the conversion can’t be done, such as when the number
|
||||
of items in <code>self</code> isn’t a multiple of the number of components in the
|
||||
color type.</p>
|
||||
</div></details></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-TryComponentsAs%3C%5BC%5D%3E-for-%5BT%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#222">Source</a><a href="#impl-TryComponentsAs%3C%5BC%5D%3E-for-%5BT%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.TryComponentsAs.html" title="trait cosmic::cosmic_theme::palette::cast::TryComponentsAs">TryComponentsAs</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#222">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <a class="struct" href="struct.SliceCastError.html" title="struct cosmic::cosmic_theme::palette::cast::SliceCastError">SliceCastError</a></h4></section><section id="method.try_components_as" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#222">Source</a><a href="#method.try_components_as" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.try_components_as" class="fn">try_components_as</a>(
|
||||
&self,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>, <<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a> as <a class="trait" href="trait.TryComponentsAs.html" title="trait cosmic::cosmic_theme::palette::cast::TryComponentsAs">TryComponentsAs</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>>>::<a class="associatedtype" href="trait.TryComponentsAs.html#associatedtype.Error" title="type cosmic::cosmic_theme::palette::cast::TryComponentsAs::Error">Error</a>></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryComponentsAs%3C%5BC%5D%3E-for-%5BT;+M%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#222">Source</a><a href="#impl-TryComponentsAs%3C%5BC%5D%3E-for-%5BT;+M%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, const M: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.TryComponentsAs.html" title="trait cosmic::cosmic_theme::palette::cast::TryComponentsAs">TryComponentsAs</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; M]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-2" class="associatedtype trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#222">Source</a><a href="#associatedtype.Error-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <a class="struct" href="struct.SliceCastError.html" title="struct cosmic::cosmic_theme::palette::cast::SliceCastError">SliceCastError</a></h4></section><section id="method.try_components_as-1" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#222">Source</a><a href="#method.try_components_as-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.try_components_as" class="fn">try_components_as</a>(
|
||||
&self,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>, <<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; M]</a> as <a class="trait" href="trait.TryComponentsAs.html" title="trait cosmic::cosmic_theme::palette::cast::TryComponentsAs">TryComponentsAs</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>>>::<a class="associatedtype" href="trait.TryComponentsAs.html#associatedtype.Error" title="type cosmic::cosmic_theme::palette::cast::TryComponentsAs::Error">Error</a>></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-TryComponentsAs%3C%5BC%5D%3E-for-Box%3C%5BT%5D%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#225">Source</a><a href="#impl-TryComponentsAs%3C%5BC%5D%3E-for-Box%3C%5BT%5D%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.TryComponentsAs.html" title="trait cosmic::cosmic_theme::palette::cast::TryComponentsAs">TryComponentsAs</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-3" class="associatedtype trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#225">Source</a><a href="#associatedtype.Error-3" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <a class="struct" href="struct.SliceCastError.html" title="struct cosmic::cosmic_theme::palette::cast::SliceCastError">SliceCastError</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryComponentsAs%3C%5BC%5D%3E-for-Vec%3CT%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#225">Source</a><a href="#impl-TryComponentsAs%3C%5BC%5D%3E-for-Vec%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.TryComponentsAs.html" title="trait cosmic::cosmic_theme::palette::cast::TryComponentsAs">TryComponentsAs</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><T><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-4" class="associatedtype trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#225">Source</a><a href="#associatedtype.Error-4" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <a class="struct" href="struct.SliceCastError.html" title="struct cosmic::cosmic_theme::palette::cast::SliceCastError">SliceCastError</a></h4></section></div></details></div><script src="../../../../trait.impl/palette/cast/as_components_traits/trait.TryComponentsAs.js" data-ignore-extern-crates="std,alloc" async></script></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
<!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="Trait for trying to cast a mutable reference to collection of color components into a mutable reference to collection of colors without copying."><title>TryComponentsAsMut in cosmic::cosmic_theme::palette::cast - 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="#">TryComponents<wbr>AsMut</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#errors" title="Errors">Errors</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Error" title="Error">Error</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.try_components_as_mut" title="try_components_as_mut">try_components_as_mut</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-TryComponentsAsMut%3C%5BC%5D%3E-for-%5BT;+M%5D" title="[T; M]">[T; M]</a></li><li><a href="#impl-TryComponentsAsMut%3C%5BC%5D%3E-for-%5BT%5D" title="[T]">[T]</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Trait <span class="trait">TryComponentsAsMut</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#179">Source</a> </span></div><pre class="rust item-decl"><code>pub trait TryComponentsAsMut<C><div class="where">where
|
||||
C: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div>{
|
||||
type <a href="#associatedtype.Error" class="associatedtype">Error</a>;
|
||||
|
||||
// Required method
|
||||
fn <a href="#tymethod.try_components_as_mut" class="fn">try_components_as_mut</a>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut C</a>, Self::<a class="associatedtype" href="trait.TryComponentsAsMut.html#associatedtype.Error" title="type cosmic::cosmic_theme::palette::cast::TryComponentsAsMut::Error">Error</a>>;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait for trying to cast a mutable reference to collection of color
|
||||
components into a mutable reference to collection of colors without copying.</p>
|
||||
<p>This trait is meant as a more convenient alternative to the free functions
|
||||
in <a href="index.html" title="mod cosmic::cosmic_theme::palette::cast"><code>cast</code></a>, to allow method chaining among other things.</p>
|
||||
<h3 id="errors"><a class="doc-anchor" href="#errors">§</a>Errors</h3>
|
||||
<p>The cast will return an error if the cast fails, such as when the length of
|
||||
the input is not a multiple of the color’s array length.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::TryComponentsAsMut, Srgb};
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>array: [<span class="kw">_</span>; <span class="number">6</span>] = [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
<span class="kw">let </span>slice_mut: <span class="kw-2">&mut </span>[<span class="kw">_</span>] = <span class="kw-2">&mut </span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
|
||||
<span class="kw">let </span>colors: <span class="prelude-ty">Result</span><<span class="kw-2">&mut </span>[Srgb<u8>], <span class="kw">_</span>> = array.try_components_as_mut();
|
||||
<span class="macro">assert_eq!</span>(colors, <span class="prelude-val">Ok</span>(<span class="kw-2">&mut </span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)][..]));
|
||||
|
||||
<span class="kw">let </span>colors: <span class="prelude-ty">Result</span><<span class="kw-2">&mut </span>[Srgb<u8>], <span class="kw">_</span>> = slice_mut.try_components_as_mut();
|
||||
<span class="macro">assert_eq!</span>(colors, <span class="prelude-val">Ok</span>(<span class="kw-2">&mut </span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)][..]));
|
||||
|
||||
<span class="kw">let </span>colors: <span class="prelude-ty">Result</span><<span class="kw-2">&mut </span>[Srgb<u8>], <span class="kw">_</span>> = vec.try_components_as_mut();
|
||||
<span class="macro">assert_eq!</span>(colors, <span class="prelude-val">Ok</span>(<span class="kw-2">&mut </span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)][..]));</code></pre></div>
|
||||
<p>This produces an error:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::TryComponentsAsMut, Srgb};
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>components = [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>]; <span class="comment">// Not a multiple of 3
|
||||
</span><span class="kw">let </span>colors: <span class="prelude-ty">Result</span><<span class="kw-2">&mut </span>[Srgb<u8>], <span class="kw">_</span>> = components.try_components_as_mut();
|
||||
<span class="macro">assert!</span>(colors.is_err());</code></pre></div>
|
||||
</div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Error" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#181">Source</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a></h4></section></summary><div class="docblock"><p>The error for when <code>try_components_as_mut</code> fails to cast.</p>
|
||||
</div></details></div><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.try_components_as_mut" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#189">Source</a><h4 class="code-header">fn <a href="#tymethod.try_components_as_mut" class="fn">try_components_as_mut</a>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut C</a>, Self::<a class="associatedtype" href="trait.TryComponentsAsMut.html#associatedtype.Error" title="type cosmic::cosmic_theme::palette::cast::TryComponentsAsMut::Error">Error</a>></h4></section></summary><div class="docblock"><p>Try to cast this collection of color components into a mutable reference
|
||||
to a collection of colors.</p>
|
||||
<p>Return an error if the conversion can’t be done, such as when the number
|
||||
of items in <code>self</code> isn’t a multiple of the number of components in the
|
||||
color type.</p>
|
||||
</div></details></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-TryComponentsAsMut%3C%5BC%5D%3E-for-%5BT%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#222">Source</a><a href="#impl-TryComponentsAsMut%3C%5BC%5D%3E-for-%5BT%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.TryComponentsAsMut.html" title="trait cosmic::cosmic_theme::palette::cast::TryComponentsAsMut">TryComponentsAsMut</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#222">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <a class="struct" href="struct.SliceCastError.html" title="struct cosmic::cosmic_theme::palette::cast::SliceCastError">SliceCastError</a></h4></section><section id="method.try_components_as_mut" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#222">Source</a><a href="#method.try_components_as_mut" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.try_components_as_mut" class="fn">try_components_as_mut</a>(
|
||||
&mut self,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>, <<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a> as <a class="trait" href="trait.TryComponentsAsMut.html" title="trait cosmic::cosmic_theme::palette::cast::TryComponentsAsMut">TryComponentsAsMut</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>>>::<a class="associatedtype" href="trait.TryComponentsAsMut.html#associatedtype.Error" title="type cosmic::cosmic_theme::palette::cast::TryComponentsAsMut::Error">Error</a>></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryComponentsAsMut%3C%5BC%5D%3E-for-%5BT;+M%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#222">Source</a><a href="#impl-TryComponentsAsMut%3C%5BC%5D%3E-for-%5BT;+M%5D" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, const M: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.TryComponentsAsMut.html" title="trait cosmic::cosmic_theme::palette::cast::TryComponentsAsMut">TryComponentsAsMut</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; M]</a><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-2" class="associatedtype trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#222">Source</a><a href="#associatedtype.Error-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <a class="struct" href="struct.SliceCastError.html" title="struct cosmic::cosmic_theme::palette::cast::SliceCastError">SliceCastError</a></h4></section><section id="method.try_components_as_mut-1" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#222">Source</a><a href="#method.try_components_as_mut-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.try_components_as_mut" class="fn">try_components_as_mut</a>(
|
||||
&mut self,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>, <<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; M]</a> as <a class="trait" href="trait.TryComponentsAsMut.html" title="trait cosmic::cosmic_theme::palette::cast::TryComponentsAsMut">TryComponentsAsMut</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>>>::<a class="associatedtype" href="trait.TryComponentsAsMut.html#associatedtype.Error" title="type cosmic::cosmic_theme::palette::cast::TryComponentsAsMut::Error">Error</a>></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-TryComponentsAsMut%3C%5BC%5D%3E-for-Box%3C%5BT%5D%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#225">Source</a><a href="#impl-TryComponentsAsMut%3C%5BC%5D%3E-for-Box%3C%5BT%5D%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.TryComponentsAsMut.html" title="trait cosmic::cosmic_theme::palette::cast::TryComponentsAsMut">TryComponentsAsMut</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-3" class="associatedtype trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#225">Source</a><a href="#associatedtype.Error-3" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <a class="struct" href="struct.SliceCastError.html" title="struct cosmic::cosmic_theme::palette::cast::SliceCastError">SliceCastError</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryComponentsAsMut%3C%5BC%5D%3E-for-Vec%3CT%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#225">Source</a><a href="#impl-TryComponentsAsMut%3C%5BC%5D%3E-for-Vec%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.TryComponentsAsMut.html" title="trait cosmic::cosmic_theme::palette::cast::TryComponentsAsMut">TryComponentsAsMut</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><T><div class="where">where
|
||||
C: <a class="trait" href="trait.ArrayCast.html" title="trait cosmic::cosmic_theme::palette::cast::ArrayCast">ArrayCast</a><Array = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[T; N]</a>>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-4" class="associatedtype trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_components_traits.rs.html#225">Source</a><a href="#associatedtype.Error-4" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <a class="struct" href="struct.SliceCastError.html" title="struct cosmic::cosmic_theme::palette::cast::SliceCastError">SliceCastError</a></h4></section></div></details></div><script src="../../../../trait.impl/palette/cast/as_components_traits/trait.TryComponentsAsMut.js" data-ignore-extern-crates="std,alloc" async></script></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
<!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="Trait for trying to cast a collection of color components from a collection of colors without copying."><title>TryComponentsInto in cosmic::cosmic_theme::palette::cast - 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="#">TryComponents<wbr>Into</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#errors" title="Errors">Errors</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Error" title="Error">Error</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.try_components_into" title="try_components_into">try_components_into</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>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Trait <span class="trait">TryComponentsInto</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#494">Source</a> </span></div><pre class="rust item-decl"><code>pub trait TryComponentsInto<C>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> {
|
||||
type <a href="#associatedtype.Error" class="associatedtype">Error</a>;
|
||||
|
||||
// Required method
|
||||
fn <a href="#tymethod.try_components_into" class="fn">try_components_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><C, Self::<a class="associatedtype" href="trait.TryComponentsInto.html#associatedtype.Error" title="type cosmic::cosmic_theme::palette::cast::TryComponentsInto::Error">Error</a>>;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait for trying to cast a collection of color components from a collection
|
||||
of colors without copying.</p>
|
||||
<p>This trait is meant as a more convenient alternative to the free functions
|
||||
in <a href="index.html" title="mod cosmic::cosmic_theme::palette::cast"><code>cast</code></a>, to allow method chaining among other things.</p>
|
||||
<h3 id="errors"><a class="doc-anchor" href="#errors">§</a>Errors</h3>
|
||||
<p>The cast will return an error if the cast fails, such as when the length of
|
||||
the input is not a multiple of the color’s array length.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::TryComponentsInto, Srgb};
|
||||
|
||||
<span class="kw">let </span>array: [<span class="kw">_</span>; <span class="number">6</span>] = [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
<span class="kw">let </span>slice: <span class="kw-2">&</span>[<span class="kw">_</span>] = <span class="kw-2">&</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
<span class="kw">let </span>slice_mut: <span class="kw-2">&mut </span>[<span class="kw">_</span>] = <span class="kw-2">&mut </span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
<span class="kw">let </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
|
||||
<span class="macro">assert_eq!</span>(
|
||||
array.try_components_into(),
|
||||
<span class="prelude-val">Ok</span>([Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)])
|
||||
);
|
||||
|
||||
<span class="macro">assert_eq!</span>(
|
||||
slice.try_components_into(),
|
||||
<span class="prelude-val">Ok</span>([Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)].as_ref())
|
||||
);
|
||||
|
||||
<span class="macro">assert_eq!</span>(
|
||||
slice_mut.try_components_into(),
|
||||
<span class="prelude-val">Ok</span>([Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)].as_mut())
|
||||
);
|
||||
|
||||
<span class="macro">assert_eq!</span>(
|
||||
vec.try_components_into(),
|
||||
<span class="prelude-val">Ok</span>(<span class="macro">vec!</span>[Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)])
|
||||
);</code></pre></div>
|
||||
<p>Owning types can be cast as slices, too:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::TryComponentsInto, Srgb};
|
||||
|
||||
<span class="kw">let </span>array: [<span class="kw">_</span>; <span class="number">6</span>] = [<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>];
|
||||
|
||||
<span class="macro">assert_eq!</span>(
|
||||
(<span class="kw-2">&</span>array).try_components_into(),
|
||||
<span class="prelude-val">Ok</span>([Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)].as_ref())
|
||||
);
|
||||
|
||||
<span class="macro">assert_eq!</span>(
|
||||
(<span class="kw-2">&mut </span>vec).try_components_into(),
|
||||
<span class="prelude-val">Ok</span>([Srgb::new(<span class="number">64u8</span>, <span class="number">139</span>, <span class="number">10</span>), Srgb::new(<span class="number">93</span>, <span class="number">18</span>, <span class="number">214</span>)].as_mut())
|
||||
);</code></pre></div>
|
||||
<p>This produces an error:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::TryComponentsInto, Srgb};
|
||||
|
||||
<span class="kw">let </span>components = <span class="kw-2">&</span>[<span class="number">64</span>, <span class="number">139</span>, <span class="number">10</span>, <span class="number">93</span>, <span class="number">18</span>]; <span class="comment">// Not a multiple of 3
|
||||
</span><span class="kw">let </span>colors: <span class="prelude-ty">Result</span><<span class="kw-2">&</span>[Srgb<u8>], <span class="kw">_</span>> = components.try_components_into();
|
||||
<span class="macro">assert!</span>(colors.is_err());</code></pre></div>
|
||||
</div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Error" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#496">Source</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a></h4></section></summary><div class="docblock"><p>The error for when <code>try_into_colors</code> fails to cast.</p>
|
||||
</div></details></div><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.try_components_into" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#504">Source</a><h4 class="code-header">fn <a href="#tymethod.try_components_into" class="fn">try_components_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><C, Self::<a class="associatedtype" href="trait.TryComponentsInto.html#associatedtype.Error" title="type cosmic::cosmic_theme::palette::cast::TryComponentsInto::Error">Error</a>></h4></section></summary><div class="docblock"><p>Try to cast this collection of color components into a collection of
|
||||
colors.</p>
|
||||
<p>Return an error if the conversion can’t be done, such as when the number
|
||||
of items in <code>self</code> isn’t a multiple of the number of components in the
|
||||
color type.</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="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-TryComponentsInto%3CC%3E-for-T" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#584-586">Source</a><a href="#impl-TryComponentsInto%3CC%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, C> <a class="trait" href="trait.TryComponentsInto.html" title="trait cosmic::cosmic_theme::palette::cast::TryComponentsInto">TryComponentsInto</a><C> for T<div class="where">where
|
||||
C: <a class="trait" href="trait.TryFromComponents.html" title="trait cosmic::cosmic_theme::palette::cast::TryFromComponents">TryFromComponents</a><T>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_components_traits.rs.html#588">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <C as <a class="trait" href="trait.TryFromComponents.html" title="trait cosmic::cosmic_theme::palette::cast::TryFromComponents">TryFromComponents</a><T>>::<a class="associatedtype" href="trait.TryFromComponents.html#associatedtype.Error" title="type cosmic::cosmic_theme::palette::cast::TryFromComponents::Error">Error</a></h4></section></div></details></div><script src="../../../../trait.impl/palette/cast/from_into_components_traits/trait.TryComponentsInto.js" async></script></section></div></main></body></html>
|
||||
116
cosmic/cosmic_theme/palette/cast/trait.TryFromComponents.html
Normal file
116
cosmic/cosmic_theme/palette/cast/trait.TryFromComponents.html
Normal file
File diff suppressed because one or more lines are too long
30
cosmic/cosmic_theme/palette/cast/trait.UintCast.html
Normal file
30
cosmic/cosmic_theme/palette/cast/trait.UintCast.html
Normal file
File diff suppressed because one or more lines are too long
47
cosmic/cosmic_theme/palette/cast/trait.UintsAs.html
Normal file
47
cosmic/cosmic_theme/palette/cast/trait.UintsAs.html
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<!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="Trait for casting a reference to a collection of unsigned integers into a reference to a collection of colors without copying."><title>UintsAs in cosmic::cosmic_theme::palette::cast - 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="#">UintsAs</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.uints_as" title="uints_as">uints_as</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-UintsAs%3C%5BC%5D%3E-for-%5B%3CC+as+UintCast%3E::Uint;+N%5D" title="[<C as UintCast>::Uint; N]">[<C as UintCast>::Uint; N]</a></li><li><a href="#impl-UintsAs%3C%5BC%5D%3E-for-%5B%3CC+as+UintCast%3E::Uint%5D" title="[<C as UintCast>::Uint]">[<C as UintCast>::Uint]</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Trait <span class="trait">UintsAs</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#142">Source</a> </span></div><pre class="rust item-decl"><code>pub trait UintsAs<C><div class="where">where
|
||||
C: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div>{
|
||||
// Required method
|
||||
fn <a href="#tymethod.uints_as" class="fn">uints_as</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&C</a>;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait for casting a reference to a collection of unsigned integers into a
|
||||
reference to a collection of colors without copying.</p>
|
||||
<p>This trait is meant as a more convenient alternative to the free functions
|
||||
in <a href="index.html" title="mod cosmic::cosmic_theme::palette::cast"><code>cast</code></a>, to allow method chaining among other things.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::UintsAs, rgb::PackedArgb, Srgba};
|
||||
|
||||
<span class="kw">let </span>array: [<span class="kw">_</span>; <span class="number">2</span>] = [<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>];
|
||||
<span class="kw">let </span>slice: <span class="kw-2">&</span>[<span class="kw">_</span>] = <span class="kw-2">&</span>[<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>];
|
||||
<span class="kw">let </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>];
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&</span>[PackedArgb] = array.uints_as();
|
||||
<span class="macro">assert_eq!</span>(
|
||||
colors,
|
||||
<span class="kw-2">&</span>[
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
]
|
||||
);
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&</span>[PackedArgb] = slice.uints_as();
|
||||
<span class="macro">assert_eq!</span>(
|
||||
colors,
|
||||
<span class="kw-2">&</span>[
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
]
|
||||
);
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&</span>[PackedArgb] = vec.uints_as();
|
||||
<span class="macro">assert_eq!</span>(
|
||||
colors,
|
||||
<span class="kw-2">&</span>[
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
]
|
||||
);</code></pre></div>
|
||||
</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.uints_as" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#144">Source</a><h4 class="code-header">fn <a href="#tymethod.uints_as" class="fn">uints_as</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&C</a></h4></section></summary><div class="docblock"><p>Cast this collection of unsigned integers into a collection of colors.</p>
|
||||
</div></details></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-UintsAs%3C%5BC%5D%3E-for-%5B%3CC+as+UintCast%3E::Uint%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#220">Source</a><a href="#impl-UintsAs%3C%5BC%5D%3E-for-%5B%3CC+as+UintCast%3E::Uint%5D" class="anchor">§</a><h3 class="code-header">impl<'a, C> <a class="trait" href="trait.UintsAs.html" title="trait cosmic::cosmic_theme::palette::cast::UintsAs">UintsAs</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>> for [<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]<div class="where">where
|
||||
C: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></h3></section></summary><div class="impl-items"><section id="method.uints_as" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#220">Source</a><a href="#method.uints_as" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.uints_as" class="fn">uints_as</a>(&self) -> &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-UintsAs%3C%5BC%5D%3E-for-%5B%3CC+as+UintCast%3E::Uint;+N%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#220">Source</a><a href="#impl-UintsAs%3C%5BC%5D%3E-for-%5B%3CC+as+UintCast%3E::Uint;+N%5D" class="anchor">§</a><h3 class="code-header">impl<'a, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.UintsAs.html" title="trait cosmic::cosmic_theme::palette::cast::UintsAs">UintsAs</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>> for [<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">N</a>]<div class="where">where
|
||||
C: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></h3></section></summary><div class="impl-items"><section id="method.uints_as-1" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#220">Source</a><a href="#method.uints_as-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.uints_as" class="fn">uints_as</a>(&self) -> &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-UintsAs%3C%5BC%5D%3E-for-Box%3C%5B%3CC+as+UintCast%3E::Uint%5D%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#223">Source</a><a href="#impl-UintsAs%3C%5BC%5D%3E-for-Box%3C%5B%3CC+as+UintCast%3E::Uint%5D%3E" class="anchor">§</a><h3 class="code-header">impl<'a, C> <a class="trait" href="trait.UintsAs.html" title="trait cosmic::cosmic_theme::palette::cast::UintsAs">UintsAs</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><[<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]><div class="where">where
|
||||
C: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></h3></section><section id="impl-UintsAs%3C%5BC%5D%3E-for-Vec%3C%3CC+as+UintCast%3E::Uint%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#223">Source</a><a href="#impl-UintsAs%3C%5BC%5D%3E-for-Vec%3C%3CC+as+UintCast%3E::Uint%3E" class="anchor">§</a><h3 class="code-header">impl<'a, C> <a class="trait" href="trait.UintsAs.html" title="trait cosmic::cosmic_theme::palette::cast::UintsAs">UintsAs</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>><div class="where">where
|
||||
C: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></h3></section></div><script src="../../../../trait.impl/palette/cast/as_uints_traits/trait.UintsAs.js" data-ignore-extern-crates="std,alloc" async></script></section></div></main></body></html>
|
||||
47
cosmic/cosmic_theme/palette/cast/trait.UintsAsMut.html
Normal file
47
cosmic/cosmic_theme/palette/cast/trait.UintsAsMut.html
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<!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="Trait for casting a mutable reference to a collection of unsigned integers into a mutable reference to a collection of colors without copying."><title>UintsAsMut in cosmic::cosmic_theme::palette::cast - 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="#">Uints<wbr>AsMut</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.uints_as_mut" title="uints_as_mut">uints_as_mut</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-UintsAsMut%3C%5BC%5D%3E-for-%5B%3CC+as+UintCast%3E::Uint;+N%5D" title="[<C as UintCast>::Uint; N]">[<C as UintCast>::Uint; N]</a></li><li><a href="#impl-UintsAsMut%3C%5BC%5D%3E-for-%5B%3CC+as+UintCast%3E::Uint%5D" title="[<C as UintCast>::Uint]">[<C as UintCast>::Uint]</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Trait <span class="trait">UintsAsMut</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#189">Source</a> </span></div><pre class="rust item-decl"><code>pub trait UintsAsMut<C><div class="where">where
|
||||
C: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div>{
|
||||
// Required method
|
||||
fn <a href="#tymethod.uints_as_mut" class="fn">uints_as_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut C</a>;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait for casting a mutable reference to a collection of unsigned integers
|
||||
into a mutable reference to a collection of colors without copying.</p>
|
||||
<p>This trait is meant as a more convenient alternative to the free functions
|
||||
in <a href="index.html" title="mod cosmic::cosmic_theme::palette::cast"><code>cast</code></a>, to allow method chaining among other things.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::UintsAsMut, rgb::PackedArgb, Srgba};
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>array: [<span class="kw">_</span>; <span class="number">2</span>] = [<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>];
|
||||
<span class="kw">let </span>slice_mut: <span class="kw-2">&mut </span>[<span class="kw">_</span>] = <span class="kw-2">&mut </span>[<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>];
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>];
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&mut </span>[PackedArgb] = array.uints_as_mut();
|
||||
<span class="macro">assert_eq!</span>(
|
||||
colors,
|
||||
<span class="kw-2">&mut </span>[
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
]
|
||||
);
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&mut </span>[PackedArgb] = slice_mut.uints_as_mut();
|
||||
<span class="macro">assert_eq!</span>(
|
||||
colors,
|
||||
<span class="kw-2">&mut </span>[
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
]
|
||||
);
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&mut </span>[PackedArgb] = vec.uints_as_mut();
|
||||
<span class="macro">assert_eq!</span>(
|
||||
colors,
|
||||
<span class="kw-2">&mut </span>[
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
]
|
||||
);</code></pre></div>
|
||||
</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.uints_as_mut" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#191">Source</a><h4 class="code-header">fn <a href="#tymethod.uints_as_mut" class="fn">uints_as_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut C</a></h4></section></summary><div class="docblock"><p>Cast this collection of unsigned integers into a mutable collection of colors.</p>
|
||||
</div></details></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-UintsAsMut%3C%5BC%5D%3E-for-%5B%3CC+as+UintCast%3E::Uint%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#220">Source</a><a href="#impl-UintsAsMut%3C%5BC%5D%3E-for-%5B%3CC+as+UintCast%3E::Uint%5D" class="anchor">§</a><h3 class="code-header">impl<'a, C> <a class="trait" href="trait.UintsAsMut.html" title="trait cosmic::cosmic_theme::palette::cast::UintsAsMut">UintsAsMut</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>> for [<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]<div class="where">where
|
||||
C: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></h3></section></summary><div class="impl-items"><section id="method.uints_as_mut" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#220">Source</a><a href="#method.uints_as_mut" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.uints_as_mut" class="fn">uints_as_mut</a>(&mut self) -> &mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-UintsAsMut%3C%5BC%5D%3E-for-%5B%3CC+as+UintCast%3E::Uint;+N%5D" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#220">Source</a><a href="#impl-UintsAsMut%3C%5BC%5D%3E-for-%5B%3CC+as+UintCast%3E::Uint;+N%5D" class="anchor">§</a><h3 class="code-header">impl<'a, C, const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>> <a class="trait" href="trait.UintsAsMut.html" title="trait cosmic::cosmic_theme::palette::cast::UintsAsMut">UintsAsMut</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>> for [<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">N</a>]<div class="where">where
|
||||
C: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></h3></section></summary><div class="impl-items"><section id="method.uints_as_mut-1" class="method trait-impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#220">Source</a><a href="#method.uints_as_mut-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.uints_as_mut" class="fn">uints_as_mut</a>(&mut self) -> &mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-UintsAsMut%3C%5BC%5D%3E-for-Box%3C%5B%3CC+as+UintCast%3E::Uint%5D%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#223">Source</a><a href="#impl-UintsAsMut%3C%5BC%5D%3E-for-Box%3C%5B%3CC+as+UintCast%3E::Uint%5D%3E" class="anchor">§</a><h3 class="code-header">impl<'a, C> <a class="trait" href="trait.UintsAsMut.html" title="trait cosmic::cosmic_theme::palette::cast::UintsAsMut">UintsAsMut</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/boxed/struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><[<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>]><div class="where">where
|
||||
C: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></h3></section><section id="impl-UintsAsMut%3C%5BC%5D%3E-for-Vec%3C%3CC+as+UintCast%3E::Uint%3E" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/as_uints_traits.rs.html#223">Source</a><a href="#impl-UintsAsMut%3C%5BC%5D%3E-for-Vec%3C%3CC+as+UintCast%3E::Uint%3E" class="anchor">§</a><h3 class="code-header">impl<'a, C> <a class="trait" href="trait.UintsAsMut.html" title="trait cosmic::cosmic_theme::palette::cast::UintsAsMut">UintsAsMut</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[C]</a>> for <a class="struct" href="../../../cctk/sctk/reexports/client/backend/smallvec/alloc/vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec">Vec</a><<C as <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>>::<a class="associatedtype" href="trait.UintCast.html#associatedtype.Uint" title="type cosmic::cosmic_theme::palette::cast::UintCast::Uint">Uint</a>><div class="where">where
|
||||
C: <a class="trait" href="trait.UintCast.html" title="trait cosmic::cosmic_theme::palette::cast::UintCast">UintCast</a>,</div></h3></section></div><script src="../../../../trait.impl/palette/cast/as_uints_traits/trait.UintsAsMut.js" data-ignore-extern-crates="std,alloc" async></script></section></div></main></body></html>
|
||||
49
cosmic/cosmic_theme/palette/cast/trait.UintsFrom.html
Normal file
49
cosmic/cosmic_theme/palette/cast/trait.UintsFrom.html
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<!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="Trait for casting a collection of unsigned integers from a collection of colors without copying."><title>UintsFrom in cosmic::cosmic_theme::palette::cast - 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="#">Uints<wbr>From</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.uints_from" title="uints_from">uints_from</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>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Trait <span class="trait">UintsFrom</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_uints_traits.rs.html#320">Source</a> </span></div><pre class="rust item-decl"><code>pub trait UintsFrom<C> {
|
||||
// Required method
|
||||
fn <a href="#tymethod.uints_from" class="fn">uints_from</a>(colors: C) -> Self;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait for casting a collection of unsigned integers from a collection of
|
||||
colors without copying.</p>
|
||||
<p>This trait is meant as a more convenient alternative to the free functions
|
||||
in <a href="index.html" title="mod cosmic::cosmic_theme::palette::cast"><code>cast</code></a>, to allow method chaining among other things.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::UintsFrom, rgb::PackedArgb, Srgba};
|
||||
|
||||
<span class="kw">let </span>array: [PackedArgb; <span class="number">2</span>] = [
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
];
|
||||
<span class="kw">let </span>slice: <span class="kw-2">&</span>[PackedArgb] = <span class="kw-2">&</span>[
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
];
|
||||
<span class="kw">let </span>slice_mut: <span class="kw-2">&mut </span>[PackedArgb] = <span class="kw-2">&mut </span>[
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
];
|
||||
<span class="kw">let </span>vec: Vec<PackedArgb> = <span class="macro">vec!</span>[
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
];
|
||||
|
||||
<span class="macro">assert_eq!</span>(<[<span class="kw">_</span>; <span class="number">2</span>]>::uints_from(array), [<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>]);
|
||||
<span class="macro">assert_eq!</span>(<<span class="kw-2">&</span>[<span class="kw">_</span>]>::uints_from(slice), [<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>]);
|
||||
<span class="macro">assert_eq!</span>(<<span class="kw-2">&mut </span>[<span class="kw">_</span>]>::uints_from(slice_mut), [<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>]);
|
||||
<span class="macro">assert_eq!</span>(Vec::<<span class="kw">_</span>>::uints_from(vec), <span class="macro">vec!</span>[<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>]);</code></pre></div>
|
||||
<p>Owning types can be cast as slices, too:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::UintsFrom, rgb::PackedArgb, Srgba};
|
||||
|
||||
<span class="kw">let </span>array: [PackedArgb; <span class="number">2</span>] = [
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
];
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>vec: Vec<PackedArgb> = <span class="macro">vec!</span>[
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
];
|
||||
|
||||
<span class="macro">assert_eq!</span>(<<span class="kw-2">&</span>[<span class="kw">_</span>]>::uints_from(<span class="kw-2">&</span>array), [<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>]);
|
||||
<span class="macro">assert_eq!</span>(<<span class="kw-2">&mut </span>[<span class="kw">_</span>]>::uints_from(<span class="kw-2">&mut </span>vec), [<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>]);</code></pre></div>
|
||||
</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.uints_from" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_uints_traits.rs.html#322">Source</a><h4 class="code-header">fn <a href="#tymethod.uints_from" class="fn">uints_from</a>(colors: C) -> Self</h4></section></summary><div class="docblock"><p>Cast a collection of colors into a collection of unsigned integers.</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="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-UintsFrom%3CC%3E-for-U" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_uints_traits.rs.html#325-327">Source</a><a href="#impl-UintsFrom%3CC%3E-for-U" class="anchor">§</a><h3 class="code-header">impl<C, U> <a class="trait" href="trait.UintsFrom.html" title="trait cosmic::cosmic_theme::palette::cast::UintsFrom">UintsFrom</a><C> for U<div class="where">where
|
||||
C: <a class="trait" href="trait.IntoUints.html" title="trait cosmic::cosmic_theme::palette::cast::IntoUints">IntoUints</a><U>,</div></h3></section></div><script src="../../../../trait.impl/palette/cast/from_into_uints_traits/trait.UintsFrom.js" async></script></section></div></main></body></html>
|
||||
59
cosmic/cosmic_theme/palette/cast/trait.UintsInto.html
Normal file
59
cosmic/cosmic_theme/palette/cast/trait.UintsInto.html
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<!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="Trait for casting a collection of unsigned integers into a collection of colors without copying."><title>UintsInto in cosmic::cosmic_theme::palette::cast - 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="#">Uints<wbr>Into</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.uints_into" title="uints_into">uints_into</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette::<wbr>cast</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">cosmic_theme</a>::<wbr><a href="../index.html">palette</a>::<wbr><a href="index.html">cast</a></div><h1>Trait <span class="trait">UintsInto</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_uints_traits.rs.html#396">Source</a> </span></div><pre class="rust item-decl"><code>pub trait UintsInto<C> {
|
||||
// Required method
|
||||
fn <a href="#tymethod.uints_into" class="fn">uints_into</a>(self) -> C;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait for casting a collection of unsigned integers into a collection of
|
||||
colors without copying.</p>
|
||||
<p>This trait is meant as a more convenient alternative to the free functions
|
||||
in <a href="index.html" title="mod cosmic::cosmic_theme::palette::cast"><code>cast</code></a>, to allow method chaining among other things.</p>
|
||||
<h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::UintsInto, rgb::PackedArgb, Srgba};
|
||||
|
||||
<span class="kw">let </span>array: [<span class="kw">_</span>; <span class="number">2</span>] = [<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>];
|
||||
<span class="kw">let </span>slice: <span class="kw-2">&</span>[<span class="kw">_</span>] = <span class="kw-2">&</span>[<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>];
|
||||
<span class="kw">let </span>slice_mut: <span class="kw-2">&mut </span>[<span class="kw">_</span>] = <span class="kw-2">&mut </span>[<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>];
|
||||
<span class="kw">let </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>];
|
||||
|
||||
<span class="kw">let </span>colors: [PackedArgb; <span class="number">2</span>] = array.uints_into();
|
||||
<span class="macro">assert_eq!</span>(colors, [
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
]);
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&</span>[PackedArgb] = slice.uints_into();
|
||||
<span class="macro">assert_eq!</span>(colors, [
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
]);
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&mut </span>[PackedArgb] = slice_mut.uints_into();
|
||||
<span class="macro">assert_eq!</span>(colors, [
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
]);
|
||||
|
||||
<span class="kw">let </span>colors: Vec<PackedArgb> = vec.uints_into();
|
||||
<span class="macro">assert_eq!</span>(colors, <span class="macro">vec!</span>[
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
]);</code></pre></div>
|
||||
<p>Owning types can be cast as slices, too:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::{cast::UintsInto, rgb::PackedArgb, Srgba};
|
||||
|
||||
<span class="kw">let </span>array: [<span class="kw">_</span>; <span class="number">2</span>] = [<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>];
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>vec: Vec<<span class="kw">_</span>> = <span class="macro">vec!</span>[<span class="number">0xFF17C64C</span>, <span class="number">0xFF5D12D6</span>];
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&</span>[PackedArgb] = (<span class="kw-2">&</span>array).uints_into();
|
||||
<span class="macro">assert_eq!</span>(colors, [
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
]);
|
||||
|
||||
<span class="kw">let </span>colors: <span class="kw-2">&mut </span>[PackedArgb] = (<span class="kw-2">&mut </span>vec).uints_into();
|
||||
<span class="macro">assert_eq!</span>(colors, [
|
||||
Srgba::new(<span class="number">0x17</span>, <span class="number">0xC6</span>, <span class="number">0x4C</span>, <span class="number">0xFF</span>).into(),
|
||||
Srgba::new(<span class="number">0x5D</span>, <span class="number">0x12</span>, <span class="number">0xD6</span>, <span class="number">0xFF</span>).into()
|
||||
]);</code></pre></div>
|
||||
</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.uints_into" class="method"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_uints_traits.rs.html#398">Source</a><h4 class="code-header">fn <a href="#tymethod.uints_into" class="fn">uints_into</a>(self) -> C</h4></section></summary><div class="docblock"><p>Cast this collection of unsigned integers into a collection of colors.</p>
|
||||
</div></details></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-UintsInto%3CC%3E-for-U" class="impl"><a class="src rightside" href="https://docs.rs/palette/0.7.6/src/palette/cast/from_into_uints_traits.rs.html#401-403">Source</a><a href="#impl-UintsInto%3CC%3E-for-U" class="anchor">§</a><h3 class="code-header">impl<C, U> <a class="trait" href="trait.UintsInto.html" title="trait cosmic::cosmic_theme::palette::cast::UintsInto">UintsInto</a><C> for U<div class="where">where
|
||||
C: <a class="trait" href="trait.FromUints.html" title="trait cosmic::cosmic_theme::palette::cast::FromUints">FromUints</a><U>,</div></h3></section></div><script src="../../../../trait.impl/palette/cast/from_into_uints_traits/trait.UintsInto.js" async></script></section></div></main></body></html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue