<!DOCTYPE html><htmllang="en"><head><metacharset="utf-8"><metaname="viewport"content="width=device-width, initial-scale=1.0"><metaname="generator"content="rustdoc"><metaname="description"content="A fixed capacity `String`"><title>String in arduboy_rust::prelude - Rust</title><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><linkrel="stylesheet"href="../../static.files/normalize-76eba96aa4d2e634.css"><linkrel="stylesheet"href="../../static.files/rustdoc-cb6f1f67f1bcd037.css"id="mainThemeStyle"><metaname="rustdoc-vars"data-root-path="../../"data-static-root-path="../../static.files/"data-current-crate="arduboy_rust"data-themes=""data-resource-suffix=""data-rustdoc-version="1.73.0-nightly (8131b9774 2023-08-02)"data-channel="nightly"data-search-js="search-6dfdfced5eff6596.js"data-settings-js="settings-de11bff964e9d4e5.js"data-settings-css="settings-8c76f75bfb6bd192.css"data-theme-light-css="light-6d2c9675f3d09c26.css"data-theme-dark-css="dark-45ceb8f2e522f4d1.css"data-theme-ayu-css="ayu-fd19013d6ce078bf.css"><scriptsrc="../../static.files/storage-db41da1a38ea3cb8.js"></script><scriptdefersrc="sidebar-items.js"></script><scriptdefersrc="../../static.files/main-0795b7d26be81095.js"></script><noscript><linkrel="stylesheet"media="(prefers-color-scheme:light)"href="../../static.files/light-6d2c9675f3d09c26.css"><linkrel="stylesheet"media="(prefers-color-scheme:dark)"href="../../static.files/dark-45ceb8f2e522f4d1.css"><linkrel="stylesheet"href="../../static.files/noscript-cffde32267a19fd6.css"></noscript><linkrel="alternate icon"type="image/png"href="../../static.files/favicon-16x16-8b506e7a72182f1c.png"><linkrel="alternate icon"type="image/png"href="../../static.files/favicon-32x32-422f7d1d52889060.png"><linkrel="icon"type="image/svg+xml"href="../../static.files/favicon-2c020d218678b618.svg"></head><bodyclass="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><navclass="mobile-topbar"><buttonclass="sidebar-menu-toggle">☰</button><aclass="logo-container"href="../../arduboy_rust/index.html"><imgclass="rust-logo"src="../../static.files/rust-logo-151179464ae7ed46.svg"alt="logo"></a><h2></h2></nav><navclass="sidebar"><aclass="logo-container"href="../../arduboy_rust/index.html"><imgclass="rust-logo"src="../../static.files/rust-logo-151179464ae7ed46.svg"alt="logo"></a><h2class="location"><ahref="#">String</a></h2><divclass="sidebar-elems"><section><h3><ahref="#implementations">Methods</a></h3><ulclass="block"><li><ahref="#method.as_mut_str">as_mut_str</a></li><li><ahref="#method.as_mut_vec">as_mut_vec</a></li><li><ahref="#method.as_str">as_str</a></li><li><ahref="#method.capacity">capacity</a></li><li><ahref="#method.clear">clear</a></li><li><ahref="#method.into_bytes">into_bytes</a></li><li><ahref="#method.new">new</a></li><li><ahref="#method.pop">pop</a></li><li><ahref="#method.push">push</a></li><li><ahref="#method.push_str">push_str</a></li><li><ahref="#method.truncate">truncate</a></li></ul><h3><ahref="#deref-methods-str">Methods from Deref<Target=str></a></h3><ulclass="block"><li><ahref="#method.as_ascii">as_ascii</a></li><li><ahref="#method.as_bytes">as_bytes</a></li><li><ahref="#method.as_bytes_mut">as_bytes_mut
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.into_bytes"class="method"><aclass="src rightside"href="../../src/heapless/string.rs.html#51">source</a><h4class="code-header">pub fn <ahref="#method.into_bytes"class="fn">into_bytes</a>(self) -><aclass="struct"href="../heapless/struct.Vec.html"title="struct arduboy_rust::heapless::Vec">Vec</a><u8, N></h4></section></summary><divclass="docblock"><p>Converts a <code>String</code> into a byte vector.</p>
<p>This consumes the <code>String</code>, so we do not need to copy its contents.</p>
<spanclass="comment">// s.push('c'); // <- cannot borrow `s` as mutable because it is also borrowed as immutable</span></code></pre></div>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.as_mut_str"class="method"><aclass="src rightside"href="../../src/heapless/string.rs.html#89">source</a><h4class="code-header">pub fn <ahref="#method.as_mut_str"class="fn">as_mut_str</a>(&mut self) ->&mut str</h4></section></summary><divclass="docblock"><p>Converts a <code>String</code> into a mutable string slice.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.as_mut_vec"class="method"><aclass="src rightside"href="../../src/heapless/string.rs.html#117">source</a><h4class="code-header">pub unsafe fn <ahref="#method.as_mut_vec"class="fn">as_mut_vec</a>(&mut self) ->&mut <aclass="struct"href="../heapless/struct.Vec.html"title="struct arduboy_rust::heapless::Vec">Vec</a><u8, N></h4></section></summary><divclass="docblock"><p>Returns a mutable reference to the contents of this <code>String</code>.</p>
<h5id="safety"><ahref="#safety">Safety</a></h5>
<p>This function is unsafe because it does not check that the bytes passed
to it are valid UTF-8. If this constraint is violated, it may cause
memory unsafety issues with future users of the <code>String</code>, as the rest of
the library assumes that <code>String</code>s are valid UTF-8.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.push_str"class="method"><aclass="src rightside"href="../../src/heapless/string.rs.html#139">source</a><h4class="code-header">pub fn <ahref="#method.push_str"class="fn">push_str</a>(&mut self, string: &str) -> Result<(), ()></h4></section></summary><divclass="docblock"><p>Appends a given string slice onto the end of this <code>String</code>.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.capacity"class="method"><aclass="src rightside"href="../../src/heapless/string.rs.html#156">source</a><h4class="code-header">pub fn <ahref="#method.capacity"class="fn">capacity</a>(&self) -> usize</h4></section></summary><divclass="docblock"><p>Returns the maximum number of elements the String can hold</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.push"class="method"><aclass="src rightside"href="../../src/heapless/string.rs.html#182">source</a><h4class="code-header">pub fn <ahref="#method.push"class="fn">push</a>(&mut self, c: char) -> Result<(), ()></h4></section></summary><divclass="docblock"><p>Appends the given <ahref="../../std/primitive.char.html"><code>char</code></a> to the end of this <code>String</code>.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.truncate"class="method"><aclass="src rightside"href="../../src/heapless/string.rs.html#219">source</a><h4class="code-header">pub fn <ahref="#method.truncate"class="fn">truncate</a>(&mut self, new_len: usize)</h4></section></summary><divclass="docblock"><p>Shortens this <code>String</code> to the specified length.</p>
<p>If <code>new_len</code> is greater than the string’s current length, this has no
effect.</p>
<p>Note that this method has no effect on the allocated capacity
of the string</p>
<h5id="panics"><ahref="#panics">Panics</a></h5>
<p>Panics if <code>new_len</code> does not lie on a <ahref="../../std/primitive.char.html"><code>char</code></a> boundary.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.pop"class="method"><aclass="src rightside"href="../../src/heapless/string.rs.html#247">source</a><h4class="code-header">pub fn <ahref="#method.pop"class="fn">pop</a>(&mut self) -> Option<char></h4></section></summary><divclass="docblock"><p>Removes the last character from the string buffer and returns it.</p>
<p>Returns <ahref="../../std/option/enum.Option.html#variant.None"><code>None</code></a> if this <code>String</code> is empty.</p>
</div></details></div></details></div><h2id="deref-methods-str"class="small-section-header"><span>Methods from Deref<Target = str></span><ahref="#deref-methods-str"class="anchor">§</a></h2><divid="deref-methods-str-1"class="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.len"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.len"class="fn">len</a>(&self) -> usize</h4></section></summary><divclass="docblock"><p>Returns the length of <code>self</code>.</p>
<p>This length is in bytes, not <ahref="prim@char"><code>char</code></a>s or graphemes. In other words,
it might not be what a human considers the length of the string.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.is_empty"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.is_empty"class="fn">is_empty</a>(&self) -> bool</h4></section></summary><divclass="docblock"><p>Returns <code>true</code> if <code>self</code> has a length of zero bytes.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.is_char_boundary"class="method"><spanclass="since rightside"title="Stable since Rust version 1.9.0">1.9.0</span><h4class="code-header">pub fn <ahref="#method.is_char_boundary"class="fn">is_char_boundary</a>(&self, index: usize) -> bool</h4></section></summary><divclass="docblock"><p>Checks that <code>index</code>-th byte is the first byte in a UTF-8 code point
sequence or the end of the string.</p>
<p>The start and end of the string (when <code>index == self.len()</code>) are
considered to be boundaries.</p>
<p>Returns <code>false</code> if <code>index</code> is greater than <code>self.len()</code>.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.floor_char_boundary"class="method"><h4class="code-header">pub fn <ahref="#method.floor_char_boundary"class="fn">floor_char_boundary</a>(&self, index: usize) -> usize</h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>round_char_boundary</code>)</span></div></span></summary><divclass="docblock"><p>Finds the closest <code>x</code> not exceeding <code>index</code> where <code>is_char_boundary(x)</code> is <code>true</code>.</p>
<p>This method can help you truncate a string so that it’s still valid UTF-8, but doesn’t
exceed a given number of bytes. Note that this is done purely at the character level
and can still visually split graphemes, even though the underlying characters aren’t
split. For example, the emoji 🧑🔬 (scientist) could be split so that the string only
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.ceil_char_boundary"class="method"><h4class="code-header">pub fn <ahref="#method.ceil_char_boundary"class="fn">ceil_char_boundary</a>(&self, index: usize) -> usize</h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>round_char_boundary</code>)</span></div></span></summary><divclass="docblock"><p>Finds the closest <code>x</code> not below <code>index</code> where <code>is_char_boundary(x)</code> is <code>true</code>.</p>
<p>This method is the natural complement to <ahref="str::floor_char_boundary"><code>floor_char_boundary</code></a>. See that method
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.as_bytes"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.as_bytes"class="fn">as_bytes</a>(&self) ->&[u8]</h4></section></summary><divclass="docblock"><p>Converts a string slice to a byte slice. To convert the byte slice back
into a string slice, use the [<code>from_utf8</code>] function.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.as_bytes_mut"class="method"><spanclass="since rightside"title="Stable since Rust version 1.20.0">1.20.0</span><h4class="code-header">pub unsafe fn <ahref="#method.as_bytes_mut"class="fn">as_bytes_mut</a>(&mut self) ->&mut [u8]</h4></section></summary><divclass="docblock"><p>Converts a mutable string slice to a mutable byte slice.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.as_ptr"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.as_ptr"class="fn">as_ptr</a>(&self) -> *const u8</h4></section></summary><divclass="docblock"><p>Converts a string slice to a raw pointer.</p>
<p>As string slices are a slice of bytes, the raw pointer points to a
[<code>u8</code>]. This pointer will be pointing to the first byte of the string
slice.</p>
<p>The caller must ensure that the returned pointer is never written to.
If you need to mutate the contents of the string slice, use <ahref="str::as_mut_ptr"><code>as_mut_ptr</code></a>.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.as_mut_ptr"class="method"><spanclass="since rightside"title="Stable since Rust version 1.36.0">1.36.0</span><h4class="code-header">pub fn <ahref="#method.as_mut_ptr"class="fn">as_mut_ptr</a>(&mut self) -> *mut u8</h4></section></summary><divclass="docblock"><p>Converts a mutable string slice to a raw pointer.</p>
<p>As string slices are a slice of bytes, the raw pointer points to a
[<code>u8</code>]. This pointer will be pointing to the first byte of the string
slice.</p>
<p>It is your responsibility to make sure that the string slice only gets
modified in a way that it remains valid UTF-8.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.get"class="method"><spanclass="since rightside"title="Stable since Rust version 1.20.0">1.20.0</span><h4class="code-header">pub fn <ahref="#method.get"class="fn">get</a><I>(&self, i: I) -> Option<&<I as SliceIndex<str>>::Output><spanclass="where fmt-newline">where
I: SliceIndex<str>,</span></h4></section></summary><divclass="docblock"><p>Returns a subslice of <code>str</code>.</p>
<p>This is the non-panicking alternative to indexing the <code>str</code>. Returns
[<code>None</code>] whenever equivalent indexing operation would panic.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.get_mut"class="method"><spanclass="since rightside"title="Stable since Rust version 1.20.0">1.20.0</span><h4class="code-header">pub fn <ahref="#method.get_mut"class="fn">get_mut</a><I>(
&mut self,
i: I
) -> Option<&mut <I as SliceIndex<str>>::Output><spanclass="where fmt-newline">where
I: SliceIndex<str>,</span></h4></section></summary><divclass="docblock"><p>Returns a mutable subslice of <code>str</code>.</p>
<p>This is the non-panicking alternative to indexing the <code>str</code>. Returns
[<code>None</code>] whenever equivalent indexing operation would panic.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.get_unchecked_mut"class="method"><spanclass="since rightside"title="Stable since Rust version 1.20.0">1.20.0</span><h4class="code-header">pub unsafe fn <ahref="#method.get_unchecked_mut"class="fn">get_unchecked_mut</a><I>(
&mut self,
i: I
) ->&mut <I as SliceIndex<str>>::Output<spanclass="where fmt-newline">where
I: SliceIndex<str>,</span></h4></section></summary><divclass="docblock"><p>Returns a mutable, unchecked subslice of <code>str</code>.</p>
<p>This is the unchecked alternative to indexing the <code>str</code>.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.slice_unchecked"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub unsafe fn <ahref="#method.slice_unchecked"class="fn">slice_unchecked</a>(&self, begin: usize, end: usize) ->&str</h4></section><spanclass="item-info"><divclass="stab deprecated"><spanclass="emoji">👎</span><span>Deprecated since 1.29.0: use <code>get_unchecked(begin..end)</code> instead</span></div></span></summary><divclass="docblock"><p>Creates a string slice from another string slice, bypassing safety
checks.</p>
<p>This is generally not recommended, use with caution! For a safe
alternative see [<code>str</code>] and <ahref="crate::ops::Index"><code>Index</code></a>.</p>
<p>This new slice goes from <code>begin</code> to <code>end</code>, including <code>begin</code> but
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.slice_mut_unchecked"class="method"><spanclass="since rightside"title="Stable since Rust version 1.5.0">1.5.0</span><h4class="code-header">pub unsafe fn <ahref="#method.slice_mut_unchecked"class="fn">slice_mut_unchecked</a>(
&mut self,
begin: usize,
end: usize
) ->&mut str</h4></section><spanclass="item-info"><divclass="stab deprecated"><spanclass="emoji">👎</span><span>Deprecated since 1.29.0: use <code>get_unchecked_mut(begin..end)</code> instead</span></div></span></summary><divclass="docblock"><p>Creates a string slice from another string slice, bypassing safety
checks.
This is generally not recommended, use with caution! For a safe
alternative see [<code>str</code>] and <ahref="crate::ops::IndexMut"><code>IndexMut</code></a>.</p>
<p>This new slice goes from <code>begin</code> to <code>end</code>, including <code>begin</code> but
excluding <code>end</code>.</p>
<p>To get an immutable string slice instead, see the
<p>Callers of this function are responsible that three preconditions are
satisfied:</p>
<ul>
<li><code>begin</code> must not exceed <code>end</code>.</li>
<li><code>begin</code> and <code>end</code> must be byte positions within the string slice.</li>
<li><code>begin</code> and <code>end</code> must lie on UTF-8 sequence boundaries.</li>
</ul>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.split_at"class="method"><spanclass="since rightside"title="Stable since Rust version 1.4.0">1.4.0</span><h4class="code-header">pub fn <ahref="#method.split_at"class="fn">split_at</a>(&self, mid: usize) -> (&str, &str)</h4></section></summary><divclass="docblock"><p>Divide one string slice into two at an index.</p>
<p>The argument, <code>mid</code>, should be a byte offset from the start of the
string. It must also be on the boundary of a UTF-8 code point.</p>
<p>The two slices returned go from the start of the string slice to <code>mid</code>,
and from <code>mid</code> to the end of the string slice.</p>
<p>To get mutable string slices instead, see the <ahref="str::split_at_mut"><code>split_at_mut</code></a>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.split_at_mut"class="method"><spanclass="since rightside"title="Stable since Rust version 1.4.0">1.4.0</span><h4class="code-header">pub fn <ahref="#method.split_at_mut"class="fn">split_at_mut</a>(&mut self, mid: usize) -> (&mut str, &mut str)</h4></section></summary><divclass="docblock"><p>Divide one mutable string slice into two at an index.</p>
<p>The argument, <code>mid</code>, should be a byte offset from the start of the
string. It must also be on the boundary of a UTF-8 code point.</p>
<p>The two slices returned go from the start of the string slice to <code>mid</code>,
and from <code>mid</code> to the end of the string slice.</p>
<p>To get immutable string slices instead, see the <ahref="str::split_at"><code>split_at</code></a> method.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.chars"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.chars"class="fn">chars</a>(&self) -> Chars<'_></h4></section></summary><divclass="docblock"><p>Returns an iterator over the <ahref="prim@char"><code>char</code></a>s of a string slice.</p>
<p>As a string slice consists of valid UTF-8, we can iterate through a
string slice by <ahref="prim@char"><code>char</code></a>. This method returns such an iterator.</p>
<p>It’s important to remember that <ahref="prim@char"><code>char</code></a> represents a Unicode Scalar
Value, and might not match your idea of what a ‘character’ is. Iteration
over grapheme clusters may be what you actually want. This functionality
is not provided by Rust’s standard library, check crates.io instead.</p>
<spanclass="macro">assert_eq!</span>(<spanclass="prelude-val">Some</span>(<spanclass="string">'y'</span>), chars.next()); <spanclass="comment">// not 'y̆'
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.char_indices"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.char_indices"class="fn">char_indices</a>(&self) -> CharIndices<'_></h4></section></summary><divclass="docblock"><p>Returns an iterator over the <ahref="prim@char"><code>char</code></a>s of a string slice, and their
positions.</p>
<p>As a string slice consists of valid UTF-8, we can iterate through a
string slice by <ahref="prim@char"><code>char</code></a>. This method returns an iterator of both
these <ahref="prim@char"><code>char</code></a>s, as well as their byte positions.</p>
<p>The iterator yields tuples. The position is first, the <ahref="prim@char"><code>char</code></a> is
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.bytes"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.bytes"class="fn">bytes</a>(&self) -> Bytes<'_></h4></section></summary><divclass="docblock"><p>An iterator over the bytes of a string slice.</p>
<p>As a string slice consists of a sequence of bytes, we can iterate
through a string slice by byte. This method returns such an iterator.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.split_whitespace"class="method"><spanclass="since rightside"title="Stable since Rust version 1.1.0">1.1.0</span><h4class="code-header">pub fn <ahref="#method.split_whitespace"class="fn">split_whitespace</a>(&self) -> SplitWhitespace<'_></h4></section></summary><divclass="docblock"><p>Splits a string slice by whitespace.</p>
<p>The iterator returned will return string slices that are sub-slices of
the original string slice, separated by any amount of whitespace.</p>
<p>‘Whitespace’ is defined according to the terms of the Unicode Derived
Core Property <code>White_Space</code>. If you only want to split on ASCII whitespace
instead, use <ahref="str::split_ascii_whitespace"><code>split_ascii_whitespace</code></a>.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.split_ascii_whitespace"class="method"><spanclass="since rightside"title="Stable since Rust version 1.34.0">1.34.0</span><h4class="code-header">pub fn <ahref="#method.split_ascii_whitespace"class="fn">split_ascii_whitespace</a>(&self) -> SplitAsciiWhitespace<'_></h4></section></summary><divclass="docblock"><p>Splits a string slice by ASCII whitespace.</p>
<p>The iterator returned will return string slices that are sub-slices of
the original string slice, separated by any amount of ASCII whitespace.</p>
<p>To split by Unicode <code>Whitespace</code> instead, use <ahref="str::split_whitespace"><code>split_whitespace</code></a>.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.lines"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.lines"class="fn">lines</a>(&self) -> Lines<'_></h4></section></summary><divclass="docblock"><p>An iterator over the lines of a string, as string slices.</p>
<p>Lines are split at line endings that are either newlines (<code>\n</code>) or
sequences of a carriage return followed by a line feed (<code>\r\n</code>).</p>
<p>Line terminators are not included in the lines returned by the iterator.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.lines_any"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.lines_any"class="fn">lines_any</a>(&self) -> LinesAny<'_></h4></section><spanclass="item-info"><divclass="stab deprecated"><spanclass="emoji">👎</span><span>Deprecated since 1.4.0: use lines() instead now</span></div></span></summary><divclass="docblock"><p>An iterator over the lines of a string.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.encode_utf16"class="method"><spanclass="since rightside"title="Stable since Rust version 1.8.0">1.8.0</span><h4class="code-header">pub fn <ahref="#method.encode_utf16"class="fn">encode_utf16</a>(&self) -> EncodeUtf16<'_></h4></section></summary><divclass="docblock"><p>Returns an iterator of <code>u16</code> over the string encoded as UTF-16.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.contains"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.contains"class="fn">contains</a><'a, P>(&'a self, pat: P) -> bool<spanclass="where fmt-newline">where
P: Pattern<'a>,</span></h4></section></summary><divclass="docblock"><p>Returns <code>true</code> if the given pattern matches a sub-slice of
this string slice.</p>
<p>Returns <code>false</code> if it does not.</p>
<p>The <ahref="self::pattern">pattern</a> can be a <code>&str</code>, <ahref="prim@char"><code>char</code></a>, a slice of <ahref="prim@char"><code>char</code></a>s, or a
function or closure that determines if a character matches.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.starts_with"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.starts_with"class="fn">starts_with</a><'a, P>(&'a self, pat: P) -> bool<spanclass="where fmt-newline">where
P: Pattern<'a>,</span></h4></section></summary><divclass="docblock"><p>Returns <code>true</code> if the given pattern matches a prefix of this
string slice.</p>
<p>Returns <code>false</code> if it does not.</p>
<p>The <ahref="self::pattern">pattern</a> can be a <code>&str</code>, <ahref="prim@char"><code>char</code></a>, a slice of <ahref="prim@char"><code>char</code></a>s, or a
function or closure that determines if a character matches.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.ends_with"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.ends_with"class="fn">ends_with</a><'a, P>(&'a self, pat: P) -> bool<spanclass="where fmt-newline">where
P: Pattern<'a>,
<P as Pattern<'a>>::Searcher: ReverseSearcher<'a>,</span></h4></section></summary><divclass="docblock"><p>Returns <code>true</code> if the given pattern matches a suffix of this
string slice.</p>
<p>Returns <code>false</code> if it does not.</p>
<p>The <ahref="self::pattern">pattern</a> can be a <code>&str</code>, <ahref="prim@char"><code>char</code></a>, a slice of <ahref="prim@char"><code>char</code></a>s, or a
function or closure that determines if a character matches.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.find"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.find"class="fn">find</a><'a, P>(&'a self, pat: P) -> Option<usize><spanclass="where fmt-newline">where
P: Pattern<'a>,</span></h4></section></summary><divclass="docblock"><p>Returns the byte index of the first character of this string slice that
matches the pattern.</p>
<p>Returns [<code>None</code>] if the pattern doesn’t match.</p>
<p>The <ahref="self::pattern">pattern</a> can be a <code>&str</code>, <ahref="prim@char"><code>char</code></a>, a slice of <ahref="prim@char"><code>char</code></a>s, or a
function or closure that determines if a character matches.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.rfind"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.rfind"class="fn">rfind</a><'a, P>(&'a self, pat: P) -> Option<usize><spanclass="where fmt-newline">where
P: Pattern<'a>,
<P as Pattern<'a>>::Searcher: ReverseSearcher<'a>,</span></h4></section></summary><divclass="docblock"><p>Returns the byte index for the first character of the last match of the pattern in
this string slice.</p>
<p>Returns [<code>None</code>] if the pattern doesn’t match.</p>
<p>The <ahref="self::pattern">pattern</a> can be a <code>&str</code>, <ahref="prim@char"><code>char</code></a>, a slice of <ahref="prim@char"><code>char</code></a>s, or a
function or closure that determines if a character matches.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.split"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.split"class="fn">split</a><'a, P>(&'a self, pat: P) -> Split<'a, P><spanclass="where fmt-newline">where
P: Pattern<'a>,</span></h4></section></summary><divclass="docblock"><p>An iterator over substrings of this string slice, separated by
characters matched by a pattern.</p>
<p>The <ahref="self::pattern">pattern</a> can be a <code>&str</code>, <ahref="prim@char"><code>char</code></a>, a slice of <ahref="prim@char"><code>char</code></a>s, or a
function or closure that determines if a character matches.</p>
<divclass="example-wrap"><preclass="rust rust-example-rendered"><code><spanclass="kw">let </span>v: Vec<<spanclass="kw-2">&</span>str> = <spanclass="string">"Mary had a little lamb"</span>.split(<spanclass="string">''</span>).collect();
<p>Contiguous separators can lead to possibly surprising behavior
when whitespace is used as the separator. This code is correct:</p>
<divclass="example-wrap"><preclass="rust rust-example-rendered"><code><spanclass="kw">let </span>x = <spanclass="string">" a b c"</span>.to_string();
<divclass="example-wrap ignore"><ahref="#"class="tooltip"title="This example is not tested">ⓘ</a><preclass="rust rust-example-rendered"><code><spanclass="macro">assert_eq!</span>(d, <spanclass="kw-2">&</span>[<spanclass="string">"a"</span>, <spanclass="string">"b"</span>, <spanclass="string">"c"</span>]);</code></pre></div>
<p>Use <ahref="str::split_whitespace"><code>split_whitespace</code></a> for this behavior.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.split_inclusive"class="method"><spanclass="since rightside"title="Stable since Rust version 1.51.0">1.51.0</span><h4class="code-header">pub fn <ahref="#method.split_inclusive"class="fn">split_inclusive</a><'a, P>(&'a self, pat: P) -> SplitInclusive<'a, P><spanclass="where fmt-newline">where
P: Pattern<'a>,</span></h4></section></summary><divclass="docblock"><p>An iterator over substrings of this string slice, separated by
characters matched by a pattern. Differs from the iterator produced by
<code>split</code> in that <code>split_inclusive</code> leaves the matched part as the
terminator of the substring.</p>
<p>The <ahref="self::pattern">pattern</a> can be a <code>&str</code>, <ahref="prim@char"><code>char</code></a>, a slice of <ahref="prim@char"><code>char</code></a>s, or a
function or closure that determines if a character matches.</p>
<divclass="example-wrap"><preclass="rust rust-example-rendered"><code><spanclass="kw">let </span>v: Vec<<spanclass="kw-2">&</span>str> = <spanclass="string">"Mary had a little lamb\nlittle lamb\nlittle lamb."
<spanclass="macro">assert_eq!</span>(v, [<spanclass="string">"Mary had a little lamb\n"</span>, <spanclass="string">"little lamb\n"</span>, <spanclass="string">"little lamb."</span>]);</code></pre></div>
<p>If the last element of the string is matched,
that element will be considered the terminator of the preceding substring.
That substring will be the last item returned by the iterator.</p>
<divclass="example-wrap"><preclass="rust rust-example-rendered"><code><spanclass="kw">let </span>v: Vec<<spanclass="kw-2">&</span>str> = <spanclass="string">"Mary had a little lamb\nlittle lamb\nlittle lamb.\n"
<spanclass="macro">assert_eq!</span>(v, [<spanclass="string">"Mary had a little lamb\n"</span>, <spanclass="string">"little lamb\n"</span>, <spanclass="string">"little lamb.\n"</span>]);</code></pre></div>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.rsplit"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.rsplit"class="fn">rsplit</a><'a, P>(&'a self, pat: P) -> RSplit<'a, P><spanclass="where fmt-newline">where
P: Pattern<'a>,
<P as Pattern<'a>>::Searcher: ReverseSearcher<'a>,</span></h4></section></summary><divclass="docblock"><p>An iterator over substrings of the given string slice, separated by
characters matched by a pattern and yielded in reverse order.</p>
<p>The <ahref="self::pattern">pattern</a> can be a <code>&str</code>, <ahref="prim@char"><code>char</code></a>, a slice of <ahref="prim@char"><code>char</code></a>s, or a
function or closure that determines if a character matches.</p>
<divclass="example-wrap"><preclass="rust rust-example-rendered"><code><spanclass="kw">let </span>v: Vec<<spanclass="kw-2">&</span>str> = <spanclass="string">"Mary had a little lamb"</span>.rsplit(<spanclass="string">''</span>).collect();
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.split_terminator"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.split_terminator"class="fn">split_terminator</a><'a, P>(&'a self, pat: P) -> SplitTerminator<'a, P><spanclass="where fmt-newline">where
P: Pattern<'a>,</span></h4></section></summary><divclass="docblock"><p>An iterator over substrings of the given string slice, separated by
characters matched by a pattern.</p>
<p>The <ahref="self::pattern">pattern</a> can be a <code>&str</code>, <ahref="prim@char"><code>char</code></a>, a slice of <ahref="prim@char"><code>char</code></a>s, or a
function or closure that determines if a character matches.</p>
<p>Equivalent to <ahref="str::split"><code>split</code></a>, except that the trailing substring
is skipped if empty.</p>
<p>This method can be used for string data that is <em>terminated</em>,
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.rsplit_terminator"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.rsplit_terminator"class="fn">rsplit_terminator</a><'a, P>(&'a self, pat: P) -> RSplitTerminator<'a, P><spanclass="where fmt-newline">where
P: Pattern<'a>,
<P as Pattern<'a>>::Searcher: ReverseSearcher<'a>,</span></h4></section></summary><divclass="docblock"><p>An iterator over substrings of <code>self</code>, separated by characters
matched by a pattern and yielded in reverse order.</p>
<p>The <ahref="self::pattern">pattern</a> can be a <code>&str</code>, <ahref="prim@char"><code>char</code></a>, a slice of <ahref="prim@char"><code>char</code></a>s, or a
function or closure that determines if a character matches.</p>
<p>Equivalent to <ahref="str::split"><code>split</code></a>, except that the trailing substring is
skipped if empty.</p>
<p>This method can be used for string data that is <em>terminated</em>,
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.splitn"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.splitn"class="fn">splitn</a><'a, P>(&'a self, n: usize, pat: P) -> SplitN<'a, P><spanclass="where fmt-newline">where
P: Pattern<'a>,</span></h4></section></summary><divclass="docblock"><p>An iterator over substrings of the given string slice, separated by a
pattern, restricted to returning at most <code>n</code> items.</p>
<p>If <code>n</code> substrings are returned, the last substring (the <code>n</code>th substring)
will contain the remainder of the string.</p>
<p>The <ahref="self::pattern">pattern</a> can be a <code>&str</code>, <ahref="prim@char"><code>char</code></a>, a slice of <ahref="prim@char"><code>char</code></a>s, or a
function or closure that determines if a character matches.</p>
<divclass="example-wrap"><preclass="rust rust-example-rendered"><code><spanclass="kw">let </span>v: Vec<<spanclass="kw-2">&</span>str> = <spanclass="string">"Mary had a little lambda"</span>.splitn(<spanclass="number">3</span>, <spanclass="string">''</span>).collect();
<spanclass="macro">assert_eq!</span>(v, [<spanclass="string">"Mary"</span>, <spanclass="string">"had"</span>, <spanclass="string">"a little lambda"</span>]);
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.rsplitn"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.rsplitn"class="fn">rsplitn</a><'a, P>(&'a self, n: usize, pat: P) -> RSplitN<'a, P><spanclass="where fmt-newline">where
P: Pattern<'a>,
<P as Pattern<'a>>::Searcher: ReverseSearcher<'a>,</span></h4></section></summary><divclass="docblock"><p>An iterator over substrings of this string slice, separated by a
pattern, starting from the end of the string, restricted to returning
at most <code>n</code> items.</p>
<p>If <code>n</code> substrings are returned, the last substring (the <code>n</code>th substring)
will contain the remainder of the string.</p>
<p>The <ahref="self::pattern">pattern</a> can be a <code>&str</code>, <ahref="prim@char"><code>char</code></a>, a slice of <ahref="prim@char"><code>char</code></a>s, or a
function or closure that determines if a character matches.</p>
<divclass="example-wrap"><preclass="rust rust-example-rendered"><code><spanclass="kw">let </span>v: Vec<<spanclass="kw-2">&</span>str> = <spanclass="string">"Mary had a little lamb"</span>.rsplitn(<spanclass="number">3</span>, <spanclass="string">''</span>).collect();
<spanclass="macro">assert_eq!</span>(v, [<spanclass="string">"lamb"</span>, <spanclass="string">"little"</span>, <spanclass="string">"Mary had a"</span>]);
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.rsplit_once"class="method"><spanclass="since rightside"title="Stable since Rust version 1.52.0">1.52.0</span><h4class="code-header">pub fn <ahref="#method.rsplit_once"class="fn">rsplit_once</a><'a, P>(&'a self, delimiter: P) -> Option<(&'a str, &'a str)><spanclass="where fmt-newline">where
P: Pattern<'a>,
<P as Pattern<'a>>::Searcher: ReverseSearcher<'a>,</span></h4></section></summary><divclass="docblock"><p>Splits the string on the last occurrence of the specified delimiter and
returns prefix before delimiter and suffix after delimiter.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.matches"class="method"><spanclass="since rightside"title="Stable since Rust version 1.2.0">1.2.0</span><h4class="code-header">pub fn <ahref="#method.matches"class="fn">matches</a><'a, P>(&'a self, pat: P) -> Matches<'a, P><spanclass="where fmt-newline">where
P: Pattern<'a>,</span></h4></section></summary><divclass="docblock"><p>An iterator over the disjoint matches of a pattern within the given string
slice.</p>
<p>The <ahref="self::pattern">pattern</a> can be a <code>&str</code>, <ahref="prim@char"><code>char</code></a>, a slice of <ahref="prim@char"><code>char</code></a>s, or a
function or closure that determines if a character matches.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.rmatches"class="method"><spanclass="since rightside"title="Stable since Rust version 1.2.0">1.2.0</span><h4class="code-header">pub fn <ahref="#method.rmatches"class="fn">rmatches</a><'a, P>(&'a self, pat: P) -> RMatches<'a, P><spanclass="where fmt-newline">where
P: Pattern<'a>,
<P as Pattern<'a>>::Searcher: ReverseSearcher<'a>,</span></h4></section></summary><divclass="docblock"><p>An iterator over the disjoint matches of a pattern within this string slice,
yielded in reverse order.</p>
<p>The <ahref="self::pattern">pattern</a> can be a <code>&str</code>, <ahref="prim@char"><code>char</code></a>, a slice of <ahref="prim@char"><code>char</code></a>s, or a
function or closure that determines if a character matches.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.match_indices"class="method"><spanclass="since rightside"title="Stable since Rust version 1.5.0">1.5.0</span><h4class="code-header">pub fn <ahref="#method.match_indices"class="fn">match_indices</a><'a, P>(&'a self, pat: P) -> MatchIndices<'a, P><spanclass="where fmt-newline">where
P: Pattern<'a>,</span></h4></section></summary><divclass="docblock"><p>An iterator over the disjoint matches of a pattern within this string
slice as well as the index that the match starts at.</p>
<p>For matches of <code>pat</code> within <code>self</code> that overlap, only the indices
corresponding to the first match are returned.</p>
<p>The <ahref="self::pattern">pattern</a> can be a <code>&str</code>, <ahref="prim@char"><code>char</code></a>, a slice of <ahref="prim@char"><code>char</code></a>s, or a
function or closure that determines if a character matches.</p>
<spanclass="macro">assert_eq!</span>(v, [(<spanclass="number">0</span>, <spanclass="string">"aba"</span>)]); <spanclass="comment">// only the first `aba`</span></code></pre></div>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.rmatch_indices"class="method"><spanclass="since rightside"title="Stable since Rust version 1.5.0">1.5.0</span><h4class="code-header">pub fn <ahref="#method.rmatch_indices"class="fn">rmatch_indices</a><'a, P>(&'a self, pat: P) -> RMatchIndices<'a, P><spanclass="where fmt-newline">where
P: Pattern<'a>,
<P as Pattern<'a>>::Searcher: ReverseSearcher<'a>,</span></h4></section></summary><divclass="docblock"><p>An iterator over the disjoint matches of a pattern within <code>self</code>,
yielded in reverse order along with the index of the match.</p>
<p>For matches of <code>pat</code> within <code>self</code> that overlap, only the indices
corresponding to the last match are returned.</p>
<p>The <ahref="self::pattern">pattern</a> can be a <code>&str</code>, <ahref="prim@char"><code>char</code></a>, a slice of <ahref="prim@char"><code>char</code></a>s, or a
function or closure that determines if a character matches.</p>
<spanclass="macro">assert_eq!</span>(v, [(<spanclass="number">2</span>, <spanclass="string">"aba"</span>)]); <spanclass="comment">// only the last `aba`</span></code></pre></div>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.trim"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.trim"class="fn">trim</a>(&self) ->&str</h4></section></summary><divclass="docblock"><p>Returns a string slice with leading and trailing whitespace removed.</p>
<p>‘Whitespace’ is defined according to the terms of the Unicode Derived
Core Property <code>White_Space</code>, which includes newlines.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.trim_start"class="method"><spanclass="since rightside"title="Stable since Rust version 1.30.0">1.30.0</span><h4class="code-header">pub fn <ahref="#method.trim_start"class="fn">trim_start</a>(&self) ->&str</h4></section></summary><divclass="docblock"><p>Returns a string slice with leading whitespace removed.</p>
<p>‘Whitespace’ is defined according to the terms of the Unicode Derived
Core Property <code>White_Space</code>, which includes newlines.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.trim_end"class="method"><spanclass="since rightside"title="Stable since Rust version 1.30.0">1.30.0</span><h4class="code-header">pub fn <ahref="#method.trim_end"class="fn">trim_end</a>(&self) ->&str</h4></section></summary><divclass="docblock"><p>Returns a string slice with trailing whitespace removed.</p>
<p>‘Whitespace’ is defined according to the terms of the Unicode Derived
Core Property <code>White_Space</code>, which includes newlines.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.trim_left"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.trim_left"class="fn">trim_left</a>(&self) ->&str</h4></section><spanclass="item-info"><divclass="stab deprecated"><spanclass="emoji">👎</span><span>Deprecated since 1.33.0: superseded by <code>trim_start</code></span></div></span></summary><divclass="docblock"><p>Returns a string slice with leading whitespace removed.</p>
<p>‘Whitespace’ is defined according to the terms of the Unicode Derived
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.trim_right"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.trim_right"class="fn">trim_right</a>(&self) ->&str</h4></section><spanclass="item-info"><divclass="stab deprecated"><spanclass="emoji">👎</span><span>Deprecated since 1.33.0: superseded by <code>trim_end</code></span></div></span></summary><divclass="docblock"><p>Returns a string slice with trailing whitespace removed.</p>
<p>‘Whitespace’ is defined according to the terms of the Unicode Derived
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.trim_matches"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.trim_matches"class="fn">trim_matches</a><'a, P>(&'a self, pat: P) ->&'a str<spanclass="where fmt-newline">where
P: Pattern<'a>,
<P as Pattern<'a>>::Searcher: DoubleEndedSearcher<'a>,</span></h4></section></summary><divclass="docblock"><p>Returns a string slice with all prefixes and suffixes that match a
pattern repeatedly removed.</p>
<p>The <ahref="self::pattern">pattern</a> can be a <ahref="prim@char"><code>char</code></a>, a slice of <ahref="prim@char"><code>char</code></a>s, or a function
or closure that determines if a character matches.</p>
<divclass="example-wrap"><preclass="rust rust-example-rendered"><code><spanclass="macro">assert_eq!</span>(<spanclass="string">"1foo1barXX"</span>.trim_matches(|c| c == <spanclass="string">'1'</span>|| c == <spanclass="string">'X'</span>), <spanclass="string">"foo1bar"</span>);</code></pre></div>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.trim_start_matches"class="method"><spanclass="since rightside"title="Stable since Rust version 1.30.0">1.30.0</span><h4class="code-header">pub fn <ahref="#method.trim_start_matches"class="fn">trim_start_matches</a><'a, P>(&'a self, pat: P) ->&'a str<spanclass="where fmt-newline">where
P: Pattern<'a>,</span></h4></section></summary><divclass="docblock"><p>Returns a string slice with all prefixes that match a pattern
repeatedly removed.</p>
<p>The <ahref="self::pattern">pattern</a> can be a <code>&str</code>, <ahref="prim@char"><code>char</code></a>, a slice of <ahref="prim@char"><code>char</code></a>s, or a
function or closure that determines if a character matches.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.strip_prefix"class="method"><spanclass="since rightside"title="Stable since Rust version 1.45.0">1.45.0</span><h4class="code-header">pub fn <ahref="#method.strip_prefix"class="fn">strip_prefix</a><'a, P>(&'a self, prefix: P) -> Option<&'a str><spanclass="where fmt-newline">where
P: Pattern<'a>,</span></h4></section></summary><divclass="docblock"><p>Returns a string slice with the prefix removed.</p>
<p>If the string starts with the pattern <code>prefix</code>, returns substring after the prefix, wrapped
in <code>Some</code>. Unlike <code>trim_start_matches</code>, this method removes the prefix exactly once.</p>
<p>If the string does not start with <code>prefix</code>, returns <code>None</code>.</p>
<p>The <ahref="self::pattern">pattern</a> can be a <code>&str</code>, <ahref="prim@char"><code>char</code></a>, a slice of <ahref="prim@char"><code>char</code></a>s, or a
function or closure that determines if a character matches.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.strip_suffix"class="method"><spanclass="since rightside"title="Stable since Rust version 1.45.0">1.45.0</span><h4class="code-header">pub fn <ahref="#method.strip_suffix"class="fn">strip_suffix</a><'a, P>(&'a self, suffix: P) -> Option<&'a str><spanclass="where fmt-newline">where
P: Pattern<'a>,
<P as Pattern<'a>>::Searcher: ReverseSearcher<'a>,</span></h4></section></summary><divclass="docblock"><p>Returns a string slice with the suffix removed.</p>
<p>If the string ends with the pattern <code>suffix</code>, returns the substring before the suffix,
wrapped in <code>Some</code>. Unlike <code>trim_end_matches</code>, this method removes the suffix exactly once.</p>
<p>If the string does not end with <code>suffix</code>, returns <code>None</code>.</p>
<p>The <ahref="self::pattern">pattern</a> can be a <code>&str</code>, <ahref="prim@char"><code>char</code></a>, a slice of <ahref="prim@char"><code>char</code></a>s, or a
function or closure that determines if a character matches.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.trim_end_matches"class="method"><spanclass="since rightside"title="Stable since Rust version 1.30.0">1.30.0</span><h4class="code-header">pub fn <ahref="#method.trim_end_matches"class="fn">trim_end_matches</a><'a, P>(&'a self, pat: P) ->&'a str<spanclass="where fmt-newline">where
P: Pattern<'a>,
<P as Pattern<'a>>::Searcher: ReverseSearcher<'a>,</span></h4></section></summary><divclass="docblock"><p>Returns a string slice with all suffixes that match a pattern
repeatedly removed.</p>
<p>The <ahref="self::pattern">pattern</a> can be a <code>&str</code>, <ahref="prim@char"><code>char</code></a>, a slice of <ahref="prim@char"><code>char</code></a>s, or a
function or closure that determines if a character matches.</p>
<divclass="example-wrap"><preclass="rust rust-example-rendered"><code><spanclass="macro">assert_eq!</span>(<spanclass="string">"1fooX"</span>.trim_end_matches(|c| c == <spanclass="string">'1'</span>|| c == <spanclass="string">'X'</span>), <spanclass="string">"1foo"</span>);</code></pre></div>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.trim_left_matches"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.trim_left_matches"class="fn">trim_left_matches</a><'a, P>(&'a self, pat: P) ->&'a str<spanclass="where fmt-newline">where
P: Pattern<'a>,</span></h4></section><spanclass="item-info"><divclass="stab deprecated"><spanclass="emoji">👎</span><span>Deprecated since 1.33.0: superseded by <code>trim_start_matches</code></span></div></span></summary><divclass="docblock"><p>Returns a string slice with all prefixes that match a pattern
repeatedly removed.</p>
<p>The <ahref="self::pattern">pattern</a> can be a <code>&str</code>, <ahref="prim@char"><code>char</code></a>, a slice of <ahref="prim@char"><code>char</code></a>s, or a
function or closure that determines if a character matches.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.trim_right_matches"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.trim_right_matches"class="fn">trim_right_matches</a><'a, P>(&'a self, pat: P) ->&'a str<spanclass="where fmt-newline">where
P: Pattern<'a>,
<P as Pattern<'a>>::Searcher: ReverseSearcher<'a>,</span></h4></section><spanclass="item-info"><divclass="stab deprecated"><spanclass="emoji">👎</span><span>Deprecated since 1.33.0: superseded by <code>trim_end_matches</code></span></div></span></summary><divclass="docblock"><p>Returns a string slice with all suffixes that match a pattern
repeatedly removed.</p>
<p>The <ahref="self::pattern">pattern</a> can be a <code>&str</code>, <ahref="prim@char"><code>char</code></a>, a slice of <ahref="prim@char"><code>char</code></a>s, or a
function or closure that determines if a character matches.</p>
<divclass="example-wrap"><preclass="rust rust-example-rendered"><code><spanclass="macro">assert_eq!</span>(<spanclass="string">"1fooX"</span>.trim_right_matches(|c| c == <spanclass="string">'1'</span>|| c == <spanclass="string">'X'</span>), <spanclass="string">"1foo"</span>);</code></pre></div>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.parse"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.parse"class="fn">parse</a><F>(&self) -> Result<F, <F as FromStr>::Err><spanclass="where fmt-newline">where
F: FromStr,</span></h4></section></summary><divclass="docblock"><p>Parses this string slice into another type.</p>
<p>Because <code>parse</code> is so general, it can cause problems with type
inference. As such, <code>parse</code> is one of the few times you’ll see
the syntax affectionately known as the ‘turbofish’: <code>::<></code>. This
helps the inference algorithm understand specifically which type
you’re trying to parse into.</p>
<p><code>parse</code> can parse into any type that implements the [<code>FromStr</code>] trait.</p>
<h5id="errors"><ahref="#errors">Errors</a></h5>
<p>Will return <ahref="FromStr::Err"><code>Err</code></a> if it’s not possible to parse this string slice into
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.is_ascii"class="method"><spanclass="since rightside"title="Stable since Rust version 1.23.0">1.23.0</span><h4class="code-header">pub fn <ahref="#method.is_ascii"class="fn">is_ascii</a>(&self) -> bool</h4></section></summary><divclass="docblock"><p>Checks if all characters in this string are within the ASCII range.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.as_ascii"class="method"><h4class="code-header">pub fn <ahref="#method.as_ascii"class="fn">as_ascii</a>(&self) -> Option<&[AsciiChar]></h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>ascii_char</code>)</span></div></span></summary><divclass="docblock"><p>If this string slice <ahref="Self::is_ascii"><code>is_ascii</code></a>, returns it as a slice
of <ahref="%60ascii::Char%60">ASCII characters</a>, otherwise returns <code>None</code>.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.eq_ignore_ascii_case"class="method"><spanclass="since rightside"title="Stable since Rust version 1.23.0">1.23.0</span><h4class="code-header">pub fn <ahref="#method.eq_ignore_ascii_case"class="fn">eq_ignore_ascii_case</a>(&self, other: &str) -> bool</h4></section></summary><divclass="docblock"><p>Checks that two strings are an ASCII case-insensitive match.</p>
<p>Same as <code>to_ascii_lowercase(a) == to_ascii_lowercase(b)</code>,
but without allocating and copying temporaries.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.make_ascii_uppercase"class="method"><spanclass="since rightside"title="Stable since Rust version 1.23.0">1.23.0</span><h4class="code-header">pub fn <ahref="#method.make_ascii_uppercase"class="fn">make_ascii_uppercase</a>(&mut self)</h4></section></summary><divclass="docblock"><p>Converts this string to its ASCII upper case equivalent in-place.</p>
<p>ASCII letters ‘a’ to ‘z’ are mapped to ‘A’ to ‘Z’,
but non-ASCII letters are unchanged.</p>
<p>To return a new uppercased value without modifying the existing one, use
<divclass="example-wrap"><preclass="rust rust-example-rendered"><code><spanclass="kw">let </span><spanclass="kw-2">mut </span>s = String::from(<spanclass="string">"Grüße, Jürgen ❤"</span>);
s.make_ascii_uppercase();
<spanclass="macro">assert_eq!</span>(<spanclass="string">"GRüßE, JüRGEN ❤"</span>, s);</code></pre></div>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.make_ascii_lowercase"class="method"><spanclass="since rightside"title="Stable since Rust version 1.23.0">1.23.0</span><h4class="code-header">pub fn <ahref="#method.make_ascii_lowercase"class="fn">make_ascii_lowercase</a>(&mut self)</h4></section></summary><divclass="docblock"><p>Converts this string to its ASCII lower case equivalent in-place.</p>
<p>ASCII letters ‘A’ to ‘Z’ are mapped to ‘a’ to ‘z’,
but non-ASCII letters are unchanged.</p>
<p>To return a new lowercased value without modifying the existing one, use
<divclass="example-wrap"><preclass="rust rust-example-rendered"><code><spanclass="kw">let </span><spanclass="kw-2">mut </span>s = String::from(<spanclass="string">"GRÜßE, JÜRGEN ❤"</span>);
s.make_ascii_lowercase();
<spanclass="macro">assert_eq!</span>(<spanclass="string">"grÜße, jÜrgen ❤"</span>, s);</code></pre></div>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.escape_debug"class="method"><spanclass="since rightside"title="Stable since Rust version 1.34.0">1.34.0</span><h4class="code-header">pub fn <ahref="#method.escape_debug"class="fn">escape_debug</a>(&self) -> EscapeDebug<'_></h4></section></summary><divclass="docblock"><p>Return an iterator that escapes each char in <code>self</code> with [<code>char::escape_debug</code>].</p>
<p>Note: only extended grapheme codepoints that begin the string will be
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.escape_default"class="method"><spanclass="since rightside"title="Stable since Rust version 1.34.0">1.34.0</span><h4class="code-header">pub fn <ahref="#method.escape_default"class="fn">escape_default</a>(&self) -> EscapeDefault<'_></h4></section></summary><divclass="docblock"><p>Return an iterator that escapes each char in <code>self</code> with [<code>char::escape_default</code>].</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.escape_unicode"class="method"><spanclass="since rightside"title="Stable since Rust version 1.34.0">1.34.0</span><h4class="code-header">pub fn <ahref="#method.escape_unicode"class="fn">escape_unicode</a>(&self) -> EscapeUnicode<'_></h4></section></summary><divclass="docblock"><p>Return an iterator that escapes each char in <code>self</code> with [<code>char::escape_unicode</code>].</p>
</div></details></div><h2id="trait-implementations"class="small-section-header">Trait Implementations<ahref="#trait-implementations"class="anchor">§</a></h2><divid="trait-implementations-list"><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-AsRef%3C%5Bu8%5D%3E-for-String%3CN%3E"class="impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#405">source</a><ahref="#impl-AsRef%3C%5Bu8%5D%3E-for-String%3CN%3E"class="anchor">§</a><h3class="code-header">impl<const N: usize> AsRef<[u8]> for <aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.as_ref-1"class="method trait-impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#407">source</a><ahref="#method.as_ref-1"class="anchor">§</a><h4class="code-header">fn <aclass="fn">as_ref</a>(&self) ->&[u8]</h4></section></summary><divclass='docblock'>Converts this type into a shared reference of the (usually inferred) input type.</div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-AsRef%3Cstr%3E-for-String%3CN%3E"class="impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#398">source</a><ahref="#impl-AsRef%3Cstr%3E-for-String%3CN%3E"class="anchor">§</a><h3class="code-header">impl<const N: usize> AsRef<str> for <aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.as_ref"class="method trait-impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#400">source</a><ahref="#method.as_ref"class="anchor">§</a><h4class="code-header">fn <aclass="fn">as_ref</a>(&self) ->&str</h4></section></summary><divclass='docblock'>Converts this type into a shared reference of the (usually inferred) input type.</div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Clone-for-String%3CN%3E"class="impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#340">source</a><ahref="#impl-Clone-for-String%3CN%3E"class="anchor">§</a><h3class="code-header">impl<const N: usize> Clone for <aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.clone"class="method trait-impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#341">source</a><ahref="#method.clone"class="anchor">§</a><h4class="code-header">fn <aclass="fn">clone</a>(&self) -><aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N></h4></section></summary><divclass='docblock'>Returns a copy of the value. <a>Read more</a></div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.clone_from"class="method trait-impl"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><ahref="#method.clone_from"class="anchor">§</a><h4class="code-header">fn <aclass="fn">clone_from</a>(&mut self, source: &Self)</h4></section></summary><divclass='docblock'>Performs copy-assignment from <code>source</code>. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Debug-for-String%3CN%3E"class="impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#348">source</a><ahref="#impl-Debug-for-String%3CN%3E"class="anchor">§</a><h3class="code-header">impl<const N: usize> Debug for <aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String
T: IntoIterator<Item = &'a char>,</span></h4></section></summary><divclass='docblock'>Creates a value from an iterator. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-FromIterator%3C%26'a+str%3E-for-String%3CN%3E"class="impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#330">source</a><ahref="#impl-FromIterator%3C%26'a+str%3E-for-String%3CN%3E"class="anchor">§</a><h3class="code-header">impl<'a, const N: usize> FromIterator<&'a str> for <aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.from_iter-1"class="method trait-impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#331">source</a><ahref="#method.from_iter-1"class="anchor">§</a><h4class="code-header">fn <aclass="fn">from_iter</a><T>(iter: T) -><aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N><spanclass="where fmt-newline">where
T: IntoIterator<Item = &'a str>,</span></h4></section></summary><divclass='docblock'>Creates a value from an iterator. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-FromIterator%3Cchar%3E-for-String%3CN%3E"class="impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#310">source</a><ahref="#impl-FromIterator%3Cchar%3E-for-String%3CN%3E"class="anchor">§</a><h3class="code-header">impl<const N: usize> FromIterator<char> for <aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.from_iter"class="method trait-impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#311">source</a><ahref="#method.from_iter"class="anchor">§</a><h4class="code-header">fn <aclass="fn">from_iter</a><T>(iter: T) -><aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N><spanclass="where fmt-newline">where
T: IntoIterator<Item = char>,</span></h4></section></summary><divclass='docblock'>Creates a value from an iterator. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-FromStr-for-String%3CN%3E"class="impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#300">source</a><ahref="#impl-FromStr-for-String%3CN%3E"class="anchor">§</a><h3class="code-header">impl<const N: usize> FromStr for <aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Err"class="associatedtype trait-impl"><ahref="#associatedtype.Err"class="anchor">§</a><h4class="code-header">type <aclass="associatedtype">Err</a> = ()</h4></section></summary><divclass='docblock'>The associated error which can be returned from parsing.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.from_str"class="method trait-impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#303">source</a><ahref="#method.from_str"class="anchor">§</a><h4class="code-header">fn <aclass="fn">from_str</a>(s: &str) -> Result<<aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N>, <<aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N> as FromStr>::Err></h4></section></summary><divclass='docblock'>Parses a string <code>s</code> to return a value of this type. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Hash-for-String%3CN%3E"class="impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#360">source</a><ahref="#impl-Hash-for-String%3CN%3E"class="anchor">§</a><h3class="code-header">impl<const N: usize> Hash for <aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.hash"class="method trait-impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#362">source</a><ahref="#method.hash"class="anchor">§</a><h4class="code-header">fn <aclass="fn">hash</a><H>(&self, hasher: &mut H)<spanclass="where fmt-newline">where
H: Hasher,</span></h4></section></summary><divclass='docblock'>Feeds this value into the given [<code>Hasher</code>]. <a>Read more</a></div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.hash_slice"class="method trait-impl"><spanclass="since rightside"title="Stable since Rust version 1.3.0">1.3.0</span><ahref="#method.hash_slice"class="anchor">§</a><h4class="code-header">fn <aclass="fn">hash_slice</a><H>(data: &[Self], state: &mut H)<spanclass="where fmt-newline">where
H: Hasher,
Self: Sized,</span></h4></section></summary><divclass='docblock'>Feeds a slice of this type into the given [<code>Hasher</code>]. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Hash-for-String%3CN%3E-1"class="impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#367">source</a><ahref="#impl-Hash-for-String%3CN%3E-1"class="anchor">§</a><h3class="code-header">impl<const N: usize><aclass="trait"href="../../hash32/trait.Hash.html"title="trait hash32::Hash">Hash</a> for <aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.hash-1"class="method trait-impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#369">source</a><ahref="#method.hash-1"class="anchor">§</a><h4class="code-header">fn <ahref="../../hash32/trait.Hash.html#tymethod.hash"class="fn">hash</a><H>(&self, hasher: &mut H)<spanclass="where fmt-newline">where
H: <aclass="trait"href="../../hash32/trait.Hasher.html"title="trait hash32::Hasher">Hasher</a>,</span></h4></section></summary><divclass='docblock'>Feeds this value into the given <code>Hasher</code>.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.hash_slice-1"class="method trait-impl"><aclass="src rightside"href="../../src/hash32/lib.rs.html#192-195">source</a><ahref="#method.hash_slice-1"class="anchor">§</a><h4class="code-header">fn <ahref="../../hash32/trait.Hash.html#method.hash_slice"class="fn">hash_slice</a><H>(data: &[Self], state: &mut H)<spanclass="where fmt-newline">where
Self: Sized,</span></h4></section></summary><divclass='docblock'>Feeds a slice of this type into the given <code>Hasher</code>.</div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Ord-for-String%3CN%3E"class="impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#479">source</a><ahref="#impl-Ord-for-String%3CN%3E"class="anchor">§</a><h3class="code-header">impl<const N: usize> Ord for <aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.cmp"class="method trait-impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#481">source</a><ahref="#method.cmp"class="anchor">§</a><h4class="code-header">fn <aclass="fn">cmp</a>(&self, other: &<aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N>) -> Ordering</h4></section></summary><divclass='docblock'>This method returns an [<code>Ordering</code>] between <code>self</code> and <code>other</code>. <a>Read more</a></div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.max"class="method trait-impl"><spanclass="since rightside"title="Stable since Rust version 1.21.0">1.21.0</span><ahref="#method.max"class="anchor">§</a><h4class="code-header">fn <aclass="fn">max</a>(self, other: Self) -> Self<spanclass="where fmt-newline">where
Self: Sized,</span></h4></section></summary><divclass='docblock'>Compares and returns the maximum of two values. <a>Read more</a></div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.min"class="method trait-impl"><spanclass="since rightside"title="Stable since Rust version 1.21.0">1.21.0</span><ahref="#method.min"class="anchor">§</a><h4class="code-header">fn <aclass="fn">min</a>(self, other: Self) -> Self<spanclass="where fmt-newline">where
Self: Sized,</span></h4></section></summary><divclass='docblock'>Compares and returns the minimum of two values. <a>Read more</a></div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.clamp"class="method trait-impl"><spanclass="since rightside"title="Stable since Rust version 1.50.0">1.50.0</span><ahref="#method.clamp"class="anchor">§</a><h4class="code-header">fn <aclass="fn">clamp</a>(self, min: Self, max: Self) -> Self<spanclass="where fmt-newline">where
Self: Sized + PartialOrd<Self>,</span></h4></section></summary><divclass='docblock'>Restrict a value to a certain interval. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-PartialEq%3C%26str%3E-for-String%3CN%3E"class="impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#435">source</a><ahref="#impl-PartialEq%3C%26str%3E-for-String%3CN%3E"class="anchor">§</a><h3class="code-header">impl<const N: usize> PartialEq<&str> for <aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.eq-2"class="method trait-impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#437">source</a><ahref="#method.eq-2"class="anchor">§</a><h4class="code-header">fn <aclass="fn">eq</a>(&self, other: &&str) -> bool</h4></section></summary><divclass='docblock'>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used
by <code>==</code>.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.ne-2"class="method trait-impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#441">source</a><ahref="#method.ne-2"class="anchor">§</a><h4class="code-header">fn <aclass="fn">ne</a>(&self, other: &&str) -> bool</h4></section></summary><divclass='docblock'>This method tests for <code>!=</code>. The default implementation is almost always
sufficient, and should not be overridden without very good reason.</div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-PartialEq%3CString%3CN%3E%3E-for-%26str"class="impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#459">source</a><ahref="#impl-PartialEq%3CString%3CN%3E%3E-for-%26str"class="anchor">§</a><h3class="code-header">impl<const N: usize> PartialEq<<aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N>> for &str</h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.eq-4"class="method trait-impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#461">source</a><ahref="#method.eq-4"class="anchor">§</a><h4class="code-header">fn <aclass="fn">eq</a>(&self, other: &<aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N>) -> bool</h4></section></summary><divclass='docblock'>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used
by <code>==</code>.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.ne-4"class="method trait-impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#465">source</a><ahref="#method.ne-4"class="anchor">§</a><h4class="code-header">fn <aclass="fn">ne</a>(&self, other: &<aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N>) -> bool</h4></section></summary><divclass='docblock'>This method tests for <code>!=</code>. The default implementation is almost always
sufficient, and should not be overridden without very good reason.</div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-PartialEq%3CString%3CN%3E%3E-for-str"class="impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#447">source</a><ahref="#impl-PartialEq%3CString%3CN%3E%3E-for-str"class="anchor">§</a><h3class="code-header">impl<const N: usize> PartialEq<<aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N>> for str</h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.eq-1"class="method trait-impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#449">source</a><ahref="#method.eq-1"class="anchor">§</a><h4class="code-header">fn <aclass="fn">eq</a>(&self, other: &<aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N>) -> bool</h4></section></summary><divclass='docblock'>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used
by <code>==</code>.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.ne-1"class="method trait-impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#453">source</a><ahref="#method.ne-1"class="anchor">§</a><h4class="code-header">fn <aclass="fn">ne</a>(&self, other: &<aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N>) -> bool</h4></section></summary><divclass='docblock'>This method tests for <code>!=</code>. The default implementation is almost always
sufficient, and should not be overridden without very good reason.</div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-PartialEq%3CString%3CN2%3E%3E-for-String%3CN1%3E"class="impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#412">source</a><ahref="#impl-PartialEq%3CString%3CN2%3E%3E-for-String%3CN1%3E"class="anchor">§</a><h3class="code-header">impl<const N1: usize, const N2: usize> PartialEq<<aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N2>> for <aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N1></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.eq"class="method trait-impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#413">source</a><ahref="#method.eq"class="anchor">§</a><h4class="code-header">fn <aclass="fn">eq</a>(&self, rhs: &<aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N2>) -> bool</h4></section></summary><divclass='docblock'>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used
by <code>==</code>.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.ne"class="method trait-impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#417">source</a><ahref="#method.ne"class="anchor">§</a><h4class="code-header">fn <aclass="fn">ne</a>(&self, rhs: &<aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N2>) -> bool</h4></section></summary><divclass='docblock'>This method tests for <code>!=</code>. The default implementation is almost always
sufficient, and should not be overridden without very good reason.</div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-PartialEq%3Cstr%3E-for-String%3CN%3E"class="impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#423">source</a><ahref="#impl-PartialEq%3Cstr%3E-for-String%3CN%3E"class="anchor">§</a><h3class="code-header">impl<const N: usize> PartialEq<str> for <aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.eq-3"class="method trait-impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#425">source</a><ahref="#method.eq-3"class="anchor">§</a><h4class="code-header">fn <aclass="fn">eq</a>(&self, other: &str) -> bool</h4></section></summary><divclass='docblock'>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used
by <code>==</code>.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.ne-3"class="method trait-impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#429">source</a><ahref="#method.ne-3"class="anchor">§</a><h4class="code-header">fn <aclass="fn">ne</a>(&self, other: &str) -> bool</h4></section></summary><divclass='docblock'>This method tests for <code>!=</code>. The default implementation is almost always
sufficient, and should not be overridden without very good reason.</div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-PartialOrd%3CString%3CN2%3E%3E-for-String%3CN1%3E"class="impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#472">source</a><ahref="#impl-PartialOrd%3CString%3CN2%3E%3E-for-String%3CN1%3E"class="anchor">§</a><h3class="code-header">impl<const N1: usize, const N2: usize> PartialOrd<<aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N2>> for <aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N1></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.partial_cmp"class="method trait-impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#474">source</a><ahref="#method.partial_cmp"class="anchor">§</a><h4class="code-header">fn <aclass="fn">partial_cmp</a>(&self, other: &<aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N2>) -> Option<Ordering></h4></section></summary><divclass='docblock'>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a>Read more</a></div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.lt"class="method trait-impl"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><ahref="#method.lt"class="anchor">§</a><h4class="code-header">fn <aclass="fn">lt</a>(&self, other: &Rhs) -> bool</h4></section></summary><divclass='docblock'>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a>Read more</a></div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.le"class="method trait-impl"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><ahref="#method.le"class="anchor">§</a><h4class="code-header">fn <aclass="fn">le</a>(&self, other: &Rhs) -> bool</h4></section></summary><divclass='docblock'>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code>
operator. <a>Read more</a></div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.gt"class="method trait-impl"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><ahref="#method.gt"class="anchor">§</a><h4class="code-header">fn <aclass="fn">gt</a>(&self, other: &Rhs) -> bool</h4></section></summary><divclass='docblock'>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a>Read more</a></div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.ge"class="method trait-impl"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><ahref="#method.ge"class="anchor">§</a><h4class="code-header">fn <aclass="fn">ge</a>(&self, other: &Rhs) -> bool</h4></section></summary><divclass='docblock'>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code>
succeeded. <a>Read more</a></div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.write_char"class="method trait-impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#379">source</a><ahref="#method.write_char"class="anchor">§</a><h4class="code-header">fn <aclass="fn">write_char</a>(&mut self, c: char) -> Result<(), Error></h4></section></summary><divclass='docblock'>Writes a [<code>char</code>] into this writer, returning whether the write succeeded. <a>Read more</a></div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.write_fmt"class="method trait-impl"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><ahref="#method.write_fmt"class="anchor">§</a><h4class="code-header">fn <aclass="fn">write_fmt</a>(&mut self, args: Arguments<'_>) -> Result<(), Error></h4></section></summary><divclass='docblock'>Glue for usage of the [<code>write!</code>] macro with implementors of this trait. <a>Read more</a></div></details></div></details><sectionid="impl-Eq-for-String%3CN%3E"class="impl"><aclass="src rightside"href="../../src/heapless/string.rs.html#470">source</a><ahref="#impl-Eq-for-String%3CN%3E"class="anchor">§</a><h3class="code-header">impl<const N: usize> Eq for <aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N></h3></section></div><h2id="synthetic-implementations"class="small-section-header">Auto Trait Implementations<ahref="#synthetic-implementations"class="anchor">§</a></h2><divid="synthetic-implementations-list"><sectionid="impl-RefUnwindSafe-for-String%3CN%3E"class="impl"><ahref="#impl-RefUnwindSafe-for-String%3CN%3E"class="anchor">§</a><h3class="code-header">impl<const N: usize> RefUnwindSafe for <aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N></h3></section><sectionid="impl-Send-for-String%3CN%3E"class="impl"><ahref="#impl-Send-for-String%3CN%3E"class="anchor">§</a><h3class="code-header">impl<const N: usize> Send for <aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N></h3></section><sectionid="impl-Sync-for-String%3CN%3E"class="impl"><ahref="#impl-Sync-for-String%3CN%3E"class="anchor">§</a><h3class="code-header">impl<const N: usize> Sync for <aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N></h3></section><sectionid="impl-Unpin-for-String%3CN%3E"class="impl"><ahref="#impl-Unpin-for-String%3CN%3E"class="anchor">§</a><h3class="code-header">impl<const N: usize> Unpin for <aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N></h3></section><sectionid="impl-UnwindSafe-for-String%3CN%3E"class="impl"><ahref="#impl-UnwindSafe-for-String%3CN%3E"class="anchor">§</a><h3class="code-header">impl<const N: usize> UnwindSafe for <aclass="struct"href="../heapless/struct.String.html"title="struct arduboy_rust::heapless::String">String</a><N></h3></section></div><h2id="blanket-implementations"class="small-section-header">Blanket Implementations<ahref="#blanket-implementations"class="anchor">§</a></h2><divid="blanket-implementations-list"><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-Any-for-String%3CN%3E"class="impl"><ahref="#impl-Any-for-String%3CN%3E"class="anchor">§</a><h3class="code-header">impl<T> Any for T<spanclass="where fmt-newline">where
T: 'static + ?Sized,</span></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.type_id"class="method trait-impl"><ahref="#method.type_id"class="anchor">§</a><h4class="code-header">fn <aclass="fn">type_id</a>(&self) -> TypeId</h4></section></summary><divclass='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-Borrow%3CT%3E-for-String%3CN%3E"class="impl"><ahref="#impl-Borrow%3CT%3E-for-String%3CN%3E"class="anchor">§</a><h3class="code-header">impl<T> Borrow<T> for T<spanclass="where fmt-newline">where
T: ?Sized,</span></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.borrow"class="method trait-impl"><ahref="#method.borrow"class="anchor">§</a><h4class="code-header">fn <aclass="fn">borrow</a>(&self) ->&T</h4></section></summary><divclass='docblock'>Immutably borrows from an owned value. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-BorrowMut%3CT%3E-for-String%3CN%3E"class="impl"><ahref="#impl-BorrowMut%3CT%3E-for-String%3CN%3E"class="anchor">§</a><h3class="code-header">impl<T> BorrowMut<T> for T<spanclass="where fmt-newline">where
T: ?Sized,</span></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.borrow_mut"class="method trait-impl"><ahref="#method.borrow_mut"class="anchor">§</a><h4class="code-header">fn <aclass="fn">borrow_mut</a>(&mut self) ->&mut T</h4></section></summary><divclass='docblock'>Mutably borrows from an owned value. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-From%3CT%3E-for-String%3CN%3E"class="impl"><ahref="#impl-From%3CT%3E-for-String%3CN%3E"class="anchor">§</a><h3class="code-header">impl<T> From<T> for T</h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.from-9"class="method trait-impl"><ahref="#method.from-9"class="anchor">§</a><h4class="code-header">fn <aclass="fn">from</a>(t: T) -> T</h4></section></summary><divclass="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-Into%3CU%3E-for-String%3CN%3E"class="impl"><ahref="#impl-Into%3CU%3E-for-String%3CN%3E"class="anchor">§</a><h3class="code-header">impl<T, U> Into<U> for T<spanclass="where fmt-newline">where
U: Into<T>,</span></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Error-1"class="associatedtype trait-impl"><ahref="#associatedtype.Error-1"class="anchor">§</a><h4class="code-header">type <aclass="associatedtype">Error</a> = Infallible</h4></section></summary><divclass='docblock'>The type returned in the event of a conversion error.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.try_from"class="method trait-impl"><ahref="#method.try_from"class="anchor">§</a><h4class="code-header">fn <aclass="fn">try_from</a>(value: U) -> Result<T, <T as TryFrom<U>>::Error></h4></section></summary><divclass='docblock'>Performs the conversion.</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-TryInto%3CU%3E-for-String%3CN%3E"class="impl"><ahref="#impl-TryInto%3CU%3E-for-String%3CN%3E"class="anchor">§</a><h3class="code-header">impl<T, U> TryInto<U> for T<spanclass="where fmt-newline">where
U: TryFrom<T>,</span></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Error"class="associatedtype trait-impl"><ahref="#associatedtype.Error"class="anchor">§</a><h4class="code-header">type <aclass="associatedtype">Error</a> = <U as TryFrom<T>>::Error</h4></section></summary><divclass='docblock'>The type returned in the event of a conversion error.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.try_into"class="method trait-impl"><ahref="#method.try_into"class="anchor">§</a><h4class="code-header">fn <aclass="fn">try_into</a>(self) -> Result<U, <U as TryFrom<T>>::Error></h4></section></summary><divclass='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main></body></html>