31 lines
No EOL
16 KiB
HTML
31 lines
No EOL
16 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A type capable of highlighting text."><title>Highlighter in cosmic::iced::widget::text - 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="#">Highlighter</a></h2><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Highlight" title="Highlight">Highlight</a></li><li><a href="#associatedtype.Iterator" title="Iterator">Iterator</a></li><li><a href="#associatedtype.Settings" title="Settings">Settings</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.change_line" title="change_line">change_line</a></li><li><a href="#tymethod.current_line" title="current_line">current_line</a></li><li><a href="#tymethod.highlight_line" title="highlight_line">highlight_line</a></li><li><a href="#tymethod.new" title="new">new</a></li><li><a href="#tymethod.update" title="update">update</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>iced::<wbr>widget::<wbr>text</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../index.html">cosmic</a>::<wbr><a href="../../index.html">iced</a>::<wbr><a href="../index.html">widget</a>::<wbr><a href="index.html">text</a></div><h1>Trait <span class="trait">Highlighter</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>pub trait Highlighter: 'static {
|
|
type <a href="#associatedtype.Settings" class="associatedtype">Settings</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>;
|
|
type <a href="#associatedtype.Highlight" class="associatedtype">Highlight</a>;
|
|
type <a href="#associatedtype.Iterator" class="associatedtype">Iterator</a><'a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = (<a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.Range.html" title="struct core::ops::range::Range">Range</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>, Self::<a class="associatedtype" href="trait.Highlighter.html#associatedtype.Highlight" title="type cosmic::iced::widget::text::Highlighter::Highlight">Highlight</a>)>
|
|
<span class="where">where Self: 'a</span>;
|
|
|
|
// Required methods
|
|
fn <a href="#tymethod.new" class="fn">new</a>(settings: &Self::<a class="associatedtype" href="trait.Highlighter.html#associatedtype.Settings" title="type cosmic::iced::widget::text::Highlighter::Settings">Settings</a>) -> Self;
|
|
<span class="item-spacer"></span> fn <a href="#tymethod.update" class="fn">update</a>(&mut self, new_settings: &Self::<a class="associatedtype" href="trait.Highlighter.html#associatedtype.Settings" title="type cosmic::iced::widget::text::Highlighter::Settings">Settings</a>);
|
|
<span class="item-spacer"></span> fn <a href="#tymethod.change_line" class="fn">change_line</a>(&mut self, line: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>);
|
|
<span class="item-spacer"></span> fn <a href="#tymethod.highlight_line" class="fn">highlight_line</a>(&mut self, line: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> Self::<a class="associatedtype" href="trait.Highlighter.html#associatedtype.Iterator" title="type cosmic::iced::widget::text::Highlighter::Iterator">Iterator</a><'_>;
|
|
<span class="item-spacer"></span> fn <a href="#tymethod.current_line" class="fn">current_line</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>;
|
|
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A type capable of highlighting text.</p>
|
|
<p>A <a href="trait.Highlighter.html" title="trait cosmic::iced::widget::text::Highlighter"><code>Highlighter</code></a> highlights lines in sequence. When a line changes,
|
|
it must be notified and the lines after the changed one must be fed
|
|
again to the <a href="trait.Highlighter.html" title="trait cosmic::iced::widget::text::Highlighter"><code>Highlighter</code></a>.</p>
|
|
</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.Settings" class="method"><h4 class="code-header">type <a href="#associatedtype.Settings" class="associatedtype">Settings</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a></h4></section></summary><div class="docblock"><p>The settings to configure the <a href="trait.Highlighter.html" title="trait cosmic::iced::widget::text::Highlighter"><code>Highlighter</code></a>.</p>
|
|
</div></details><details class="toggle" open><summary><section id="associatedtype.Highlight" class="method"><h4 class="code-header">type <a href="#associatedtype.Highlight" class="associatedtype">Highlight</a></h4></section></summary><div class="docblock"><p>The output of the <a href="trait.Highlighter.html" title="trait cosmic::iced::widget::text::Highlighter"><code>Highlighter</code></a>.</p>
|
|
</div></details><details class="toggle" open><summary><section id="associatedtype.Iterator" class="method"><h4 class="code-header">type <a href="#associatedtype.Iterator" class="associatedtype">Iterator</a><'a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = (<a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.Range.html" title="struct core::ops::range::Range">Range</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>, Self::<a class="associatedtype" href="trait.Highlighter.html#associatedtype.Highlight" title="type cosmic::iced::widget::text::Highlighter::Highlight">Highlight</a>)>
|
|
<span class="where">where
|
|
Self: 'a</span></h4></section></summary><div class="docblock"><p>The highlight iterator type.</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.new" class="method"><h4 class="code-header">fn <a href="#tymethod.new" class="fn">new</a>(settings: &Self::<a class="associatedtype" href="trait.Highlighter.html#associatedtype.Settings" title="type cosmic::iced::widget::text::Highlighter::Settings">Settings</a>) -> Self</h4></section></summary><div class="docblock"><p>Creates a new <a href="trait.Highlighter.html" title="trait cosmic::iced::widget::text::Highlighter"><code>Highlighter</code></a> from its <a href="trait.Highlighter.html#associatedtype.Settings" title="associated type iced_core::text::highlighter::Highlighter::Settings::Settings"><code>Self::Settings</code></a>.</p>
|
|
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.update" class="method"><h4 class="code-header">fn <a href="#tymethod.update" class="fn">update</a>(&mut self, new_settings: &Self::<a class="associatedtype" href="trait.Highlighter.html#associatedtype.Settings" title="type cosmic::iced::widget::text::Highlighter::Settings">Settings</a>)</h4></section></summary><div class="docblock"><p>Updates the <a href="trait.Highlighter.html" title="trait cosmic::iced::widget::text::Highlighter"><code>Highlighter</code></a> with some new <a href="trait.Highlighter.html#associatedtype.Settings" title="associated type iced_core::text::highlighter::Highlighter::Settings::Settings"><code>Self::Settings</code></a>.</p>
|
|
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.change_line" class="method"><h4 class="code-header">fn <a href="#tymethod.change_line" class="fn">change_line</a>(&mut self, line: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Notifies the <a href="trait.Highlighter.html" title="trait cosmic::iced::widget::text::Highlighter"><code>Highlighter</code></a> that the line at the given index has changed.</p>
|
|
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.highlight_line" class="method"><h4 class="code-header">fn <a href="#tymethod.highlight_line" class="fn">highlight_line</a>(&mut self, line: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> Self::<a class="associatedtype" href="trait.Highlighter.html#associatedtype.Iterator" title="type cosmic::iced::widget::text::Highlighter::Iterator">Iterator</a><'_></h4></section></summary><div class="docblock"><p>Highlights the given line.</p>
|
|
<p>If a line changed prior to this, the first line provided here will be the
|
|
line that changed.</p>
|
|
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.current_line" class="method"><h4 class="code-header">fn <a href="#tymethod.current_line" class="fn">current_line</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Returns the current line of the <a href="trait.Highlighter.html" title="trait cosmic::iced::widget::text::Highlighter"><code>Highlighter</code></a>.</p>
|
|
<p>If <code>change_line</code> has been called, this will normally be the least index
|
|
that changed.</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-Highlighter-for-PlainText" class="impl"><a href="#impl-Highlighter-for-PlainText" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Highlighter.html" title="trait cosmic::iced::widget::text::Highlighter">Highlighter</a> for <a class="struct" href="../../daemon/program/graphics/core/text/highlighter/struct.PlainText.html" title="struct cosmic::iced::daemon::program::graphics::core::text::highlighter::PlainText">PlainText</a></h3></section></summary><div class="impl-items"><section id="associatedtype.Settings-1" class="associatedtype trait-impl"><a href="#associatedtype.Settings-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Settings" class="associatedtype">Settings</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a></h4></section><section id="associatedtype.Highlight-1" class="associatedtype trait-impl"><a href="#associatedtype.Highlight-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Highlight" class="associatedtype">Highlight</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a></h4></section><section id="associatedtype.Iterator-1" class="associatedtype trait-impl"><a href="#associatedtype.Iterator-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Iterator" class="associatedtype">Iterator</a><'a> = <a class="struct" href="https://doc.rust-lang.org/nightly/core/iter/sources/empty/struct.Empty.html" title="struct core::iter::sources::empty::Empty">Empty</a><(<a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.Range.html" title="struct core::ops::range::Range">Range</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>, <<a class="struct" href="../../daemon/program/graphics/core/text/highlighter/struct.PlainText.html" title="struct cosmic::iced::daemon::program::graphics::core::text::highlighter::PlainText">PlainText</a> as <a class="trait" href="trait.Highlighter.html" title="trait cosmic::iced::widget::text::Highlighter">Highlighter</a>>::<a class="associatedtype" href="trait.Highlighter.html#associatedtype.Highlight" title="type cosmic::iced::widget::text::Highlighter::Highlight">Highlight</a>)></h4></section></div></details></div><script src="../../../../trait.impl/iced_core/text/highlighter/trait.Highlighter.js" data-ignore-extern-crates="iced_core" async></script></section></div></main></body></html> |