| <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `RegionAssumptions` struct in crate `hir_ty`."><title>RegionAssumptions in hir_ty::next_solver - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-0c87338a.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="hir_ty" data-themes="" data-resource-suffix="" data-rustdoc-version="1.99.1 (58cf8f9c3 2026-10-13)" data-channel="1.99.1" data-search-js="search-cf4fc35e.js" data-stringdex-js="stringdex-b5109af9.js" data-settings-js="settings-170eb4bf.js" ><script src="../../static.files/storage-41dd4d93.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-417ebf0a.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-9f56287d.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc struct"><a class="skip-main-content" href="#main-content">Skip to main content</a><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">RegionAssumptions</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../hir_ty/index.html">hir_ty</a><span class="version">0.0.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Region<wbr>Assumptions</a></h2><h3><a href="#fields">Fields</a></h3><ul class="block structfield"><li><a href="#structfield.interned" title="interned">interned</a></li></ul><h3><a href="#implementations">Associated Functions</a></h3><ul class="block method"><li><a href="#method.empty" title="empty">empty</a></li><li><a href="#method.new_from_slice" title="new_from_slice">new_from_slice</a></li><li><a href="#method.new_from_slice_no_empty_check" title="new_from_slice_no_empty_check">new_from_slice_no_empty_check</a></li><li><a href="#method.new_from_iter" title="new_from_iter">new_from_iter</a></li></ul><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.as_slice" title="as_slice">as_slice</a></li><li><a href="#method.is_empty" title="is_empty">is_empty</a></li><li><a href="#method.iter" title="iter">iter</a></li><li><a href="#method.len" title="len">len</a></li><li><a href="#method.store" title="store">store</a></li></ul><h3><a href="#deref-methods-%5BOutlivesPredicate%3C'db,+GenericArg%3C'db%3E%3E%5D">Methods from Deref<<wbr>Target=[<wbr>Outlives<wbr>Predicate<'db, Generic<wbr>Arg<'db>>]></a></h3><ul class="block deref-methods"><li><a href="#method.align_to" title="align_to">align_to</a></li><li><a href="#method.array_windows" title="array_windows">array_windows</a></li><li><a href="#method.as_array" title="as_array">as_array</a></li><li><a href="#method.as_ascii" title="as_ascii">as_ascii</a></li><li><a href="#method.as_ascii_unchecked" title="as_ascii_unchecked">as_ascii_unchecked</a></li><li><a href="#method.as_bytes" title="as_bytes">as_bytes</a></li><li><a href="#method.as_bytes-1" title="as_bytes">as_bytes</a></li><li><a href="#method.as_chunks" title="as_chunks">as_chunks</a></li><li><a href="#method.as_chunks_unchecked" title="as_chunks_unchecked">as_chunks_unchecked</a></li><li><a href="#method.as_flattened" title="as_flattened">as_flattened</a></li><li><a href="#method.as_ptr" title="as_ptr">as_ptr</a></li><li><a href="#method.as_ptr_range" title="as_ptr_range">as_ptr_range</a></li><li><a href="#method.as_rchunks" title="as_rchunks">as_rchunks</a></li><li><a href="#method.as_simd" title="as_simd">as_simd</a></li><li><a href="#method.as_slice-1" title="as_slice">as_slice</a></li><li><a href="#method.as_str" title="as_str">as_str</a></li><li><a href="#method.assume_init_ref" title="assume_init_ref">assume_init_ref</a></li><li><a href="#method.binary_search" title="binary_search">binary_search</a></li><li><a href="#method.binary_search_by" title="binary_search_by">binary_search_by</a></li><li><a href="#method.binary_search_by_key" title="binary_search_by_key">binary_search_by_key</a></li><li><a href="#method.chunk_by" title="chunk_by">chunk_by</a></li><li><a href="#method.chunks" title="chunks">chunks</a></li><li><a href="#method.chunks_exact" title="chunks_exact">chunks_exact</a></li><li><a href="#method.concat" title="concat">concat</a></li><li><a href="#method.connect" title="connect">connect</a></li><li><a href="#method.contains" title="contains">contains</a></li><li><a href="#method.element_offset" title="element_offset">element_offset</a></li><li><a href="#method.ends_with" title="ends_with">ends_with</a></li><li><a href="#method.eq_ignore_ascii_case" title="eq_ignore_ascii_case">eq_ignore_ascii_case</a></li><li><a href="#method.escape_ascii" title="escape_ascii">escape_ascii</a></li><li><a href="#method.first" title="first">first</a></li><li><a href="#method.first_chunk" title="first_chunk">first_chunk</a></li><li><a href="#method.get" title="get">get</a></li><li><a href="#method.get_unchecked" title="get_unchecked">get_unchecked</a></li><li><a href="#method.is_ascii" title="is_ascii">is_ascii</a></li><li><a href="#method.is_empty-1" title="is_empty">is_empty</a></li><li><a href="#method.is_sorted" title="is_sorted">is_sorted</a></li><li><a href="#method.is_sorted_by" title="is_sorted_by">is_sorted_by</a></li><li><a href="#method.is_sorted_by_key" title="is_sorted_by_key">is_sorted_by_key</a></li><li><a href="#method.iter-1" title="iter">iter</a></li><li><a href="#method.join" title="join">join</a></li><li><a href="#method.last" title="last">last</a></li><li><a href="#method.last_chunk" title="last_chunk">last_chunk</a></li><li><a href="#method.len-1" title="len">len</a></li><li><a href="#method.partition_point" title="partition_point">partition_point</a></li><li><a href="#method.rchunks" title="rchunks">rchunks</a></li><li><a href="#method.rchunks_exact" title="rchunks_exact">rchunks_exact</a></li><li><a href="#method.repeat" title="repeat">repeat</a></li><li><a href="#method.rsplit" title="rsplit">rsplit</a></li><li><a href="#method.rsplit_once" title="rsplit_once">rsplit_once</a></li><li><a href="#method.rsplitn" title="rsplitn">rsplitn</a></li><li><a href="#method.split" title="split">split</a></li><li><a href="#method.split_at" title="split_at">split_at</a></li><li><a href="#method.split_at_checked" title="split_at_checked">split_at_checked</a></li><li><a href="#method.split_at_unchecked" title="split_at_unchecked">split_at_unchecked</a></li><li><a href="#method.split_first" title="split_first">split_first</a></li><li><a href="#method.split_first_chunk" title="split_first_chunk">split_first_chunk</a></li><li><a href="#method.split_inclusive" title="split_inclusive">split_inclusive</a></li><li><a href="#method.split_last" title="split_last">split_last</a></li><li><a href="#method.split_last_chunk" title="split_last_chunk">split_last_chunk</a></li><li><a href="#method.split_once" title="split_once">split_once</a></li><li><a href="#method.splitn" title="splitn">splitn</a></li><li><a href="#method.starts_with" title="starts_with">starts_with</a></li><li><a href="#method.strip_circumfix" title="strip_circumfix">strip_circumfix</a></li><li><a href="#method.strip_prefix" title="strip_prefix">strip_prefix</a></li><li><a href="#method.strip_suffix" title="strip_suffix">strip_suffix</a></li><li><a href="#method.subslice_range" title="subslice_range">subslice_range</a></li><li><a href="#method.to_ascii_lowercase" title="to_ascii_lowercase">to_ascii_lowercase</a></li><li><a href="#method.to_ascii_uppercase" title="to_ascii_uppercase">to_ascii_uppercase</a></li><li><a href="#method.to_vec" title="to_vec">to_vec</a></li><li><a href="#method.to_vec_in" title="to_vec_in">to_vec_in</a></li><li><a href="#method.trim_ascii" title="trim_ascii">trim_ascii</a></li><li><a href="#method.trim_ascii_end" title="trim_ascii_end">trim_ascii_end</a></li><li><a href="#method.trim_ascii_start" title="trim_ascii_start">trim_ascii_start</a></li><li><a href="#method.trim_prefix" title="trim_prefix">trim_prefix</a></li><li><a href="#method.trim_suffix" title="trim_suffix">trim_suffix</a></li><li><a href="#method.utf8_chunks" title="utf8_chunks">utf8_chunks</a></li><li><a href="#method.windows" title="windows">windows</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Clone-for-RegionAssumptions%3C'db%3E" title="Clone">Clone</a></li><li><a href="#impl-Copy-for-RegionAssumptions%3C'db%3E" title="Copy">Copy</a></li><li><a href="#impl-Debug-for-RegionAssumptions%3C'db%3E" title="Debug">Debug</a></li><li><a href="#impl-Default-for-RegionAssumptions%3C'db%3E" title="Default">Default</a></li><li><a href="#impl-Deref-for-RegionAssumptions%3C'db%3E" title="Deref">Deref</a></li><li><a href="#impl-Eq-for-RegionAssumptions%3C'db%3E" title="Eq">Eq</a></li><li><a href="#impl-GenericTypeVisitable%3CV%3E-for-RegionAssumptions%3C'db%3E" title="GenericTypeVisitable<V>">GenericTypeVisitable<V></a></li><li><a href="#impl-Hash-for-RegionAssumptions%3C'db%3E" title="Hash">Hash</a></li><li><a href="#impl-IntoIterator-for-RegionAssumptions%3C'db%3E" title="IntoIterator">IntoIterator</a></li><li><a href="#impl-PartialEq-for-RegionAssumptions%3C'db%3E" title="PartialEq">PartialEq</a></li><li><a href="#impl-SliceLike-for-RegionAssumptions%3C'db%3E" title="SliceLike">SliceLike</a></li><li><a href="#impl-StructuralPartialEq-for-RegionAssumptions%3C'db%3E" title="StructuralPartialEq">StructuralPartialEq</a></li><li><a href="#impl-TypeFoldable%3CDbInterner%3C'db%3E%3E-for-RegionAssumptions%3C'db%3E" title="TypeFoldable<DbInterner<'db>>">TypeFoldable<DbInterner<'db>></a></li><li><a href="#impl-TypeVisitable%3CDbInterner%3C'db%3E%3E-for-RegionAssumptions%3C'db%3E" title="TypeVisitable<DbInterner<'db>>">TypeVisitable<DbInterner<'db>></a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-Freeze-for-RegionAssumptions%3C'db%3E" title="Freeze">Freeze</a></li><li><a href="#impl-RefUnwindSafe-for-RegionAssumptions%3C'db%3E" title="RefUnwindSafe">RefUnwindSafe</a></li><li><a href="#impl-Send-for-RegionAssumptions%3C'db%3E" title="Send">Send</a></li><li><a href="#impl-Sync-for-RegionAssumptions%3C'db%3E" title="Sync">Sync</a></li><li><a href="#impl-Unpin-for-RegionAssumptions%3C'db%3E" title="Unpin">Unpin</a></li><li><a href="#impl-UnsafeUnpin-for-RegionAssumptions%3C'db%3E" title="UnsafeUnpin">UnsafeUnpin</a></li><li><a href="#impl-UnwindSafe-for-RegionAssumptions%3C'db%3E" title="UnwindSafe">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T" title="Any">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T" title="Borrow<T>">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T" title="BorrowMut<T>">BorrowMut<T></a></li><li><a href="#impl-CloneToUninit-for-T" title="CloneToUninit">CloneToUninit</a></li><li><a href="#impl-CollectAndApply%3CT,+R%3E-for-T" title="CollectAndApply<T, R>">CollectAndApply<T, R></a></li><li><a href="#impl-Equivalent%3CK%3E-for-Q" title="Equivalent<K>">Equivalent<K></a></li><li><a href="#impl-Equivalent%3CK%3E-for-Q-1" title="Equivalent<K>">Equivalent<K></a></li><li><a href="#impl-Equivalent%3CK%3E-for-Q-2" title="Equivalent<K>">Equivalent<K></a></li><li><a href="#impl-From%3CT%3E-for-T" title="From<T>">From<T></a></li><li><a href="#impl-HashEqLike%3C%26T%3E-for-T" title="HashEqLike<&T>">HashEqLike<&T></a></li><li><a href="#impl-HashEqLike%3CCow%3C'_,+T%3E%3E-for-T" title="HashEqLike<Cow<'_, T>>">HashEqLike<Cow<'_, T>></a></li><li><a href="#impl-HashEqLike%3CT%3E-for-T" title="HashEqLike<T>">HashEqLike<T></a></li><li><a href="#impl-Instrument-for-T" title="Instrument">Instrument</a></li><li><a href="#impl-Into%3CU%3E-for-T" title="Into<U>">Into<U></a></li><li><a href="#impl-IntoBox%3Cdyn+Any+%2B+Send+%2B+Sync%3E-for-T" title="IntoBox<dyn Any + Send + Sync>">IntoBox<dyn Any + Send + Sync></a></li><li><a href="#impl-IntoBox%3Cdyn+Any+%2B+Send%3E-for-T" title="IntoBox<dyn Any + Send>">IntoBox<dyn Any + Send></a></li><li><a href="#impl-IntoBox%3Cdyn+Any%3E-for-T" title="IntoBox<dyn Any>">IntoBox<dyn Any></a></li><li><a href="#impl-IntoEither-for-T" title="IntoEither">IntoEither</a></li><li><a href="#impl-Lookup%3CT%3E-for-T" title="Lookup<T>">Lookup<T></a></li><li><a href="#impl-Pointable-for-T" title="Pointable">Pointable</a></li><li><a href="#impl-Receiver-for-P" title="Receiver">Receiver</a></li><li><a href="#impl-ToOwned-for-T" title="ToOwned">ToOwned</a></li><li><a href="#impl-TryFrom%3CU%3E-for-T" title="TryFrom<U>">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T" title="TryInto<U>">TryInto<U></a></li><li><a href="#impl-TypeVisitableExt%3CI%3E-for-T" title="TypeVisitableExt<I>">TypeVisitableExt<I></a></li><li><a href="#impl-Upcast%3CI,+U%3E-for-T" title="Upcast<I, U>">Upcast<I, U></a></li><li><a href="#impl-UpcastFrom%3CI,+T%3E-for-T" title="UpcastFrom<I, T>">UpcastFrom<I, T></a></li><li><a href="#impl-WithSubscriber-for-T" title="WithSubscriber">WithSubscriber</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In hir_<wbr>ty::<wbr>next_<wbr>solver</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content" tabindex="-1"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">hir_ty</a>::<wbr><a href="index.html">next_solver</a></div><h1>Struct <span class="struct">Region<wbr>Assumptions</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a> </span></div><pre class="rust item-decl"><code>pub struct RegionAssumptions<'db> { |
| interned: InternedSliceRef<'db, <a class="struct" href="struct.RegionAssumptionsStorage.html" title="struct hir_ty::next_solver::RegionAssumptionsStorage">RegionAssumptionsStorage</a>>, |
| }</code></pre><h2 id="fields" class="fields section-header">Fields<a href="#fields" class="anchor">§</a></h2><span id="structfield.interned" class="structfield section-header"><a href="#structfield.interned" class="anchor field">§</a><code>interned: InternedSliceRef<'db, <a class="struct" href="struct.RegionAssumptionsStorage.html" title="struct hir_ty::next_solver::RegionAssumptionsStorage">RegionAssumptionsStorage</a>></code></span><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-RegionAssumptions%3C'db%3E" class="impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#impl-RegionAssumptions%3C'db%3E" class="anchor">§</a><h3 class="code-header">impl<'db> <a class="struct" href="struct.RegionAssumptions.html" title="struct hir_ty::next_solver::RegionAssumptions">RegionAssumptions</a><'db></h3></section></summary><div class="impl-items"><section id="method.empty" class="method"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><h4 class="code-header">pub fn <a href="#method.empty" class="fn">empty</a>() -> Self</h4></section><section id="method.new_from_slice" class="method"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><h4 class="code-header">pub fn <a href="#method.new_from_slice" class="fn">new_from_slice</a>(slice: &[<a class="type" href="predicate/type.OutlivesPredicate.html" title="type hir_ty::next_solver::predicate::OutlivesPredicate">OutlivesPredicate</a><'db, <a class="struct" href="struct.GenericArg.html" title="struct hir_ty::next_solver::GenericArg">GenericArg</a><'db>>]) -> Self</h4></section><details class="toggle method-toggle" open><summary><section id="method.new_from_slice_no_empty_check" class="method"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><h4 class="code-header">pub(crate) fn <a href="#method.new_from_slice_no_empty_check" class="fn">new_from_slice_no_empty_check</a>( |
| slice: &[<a class="type" href="predicate/type.OutlivesPredicate.html" title="type hir_ty::next_solver::predicate::OutlivesPredicate">OutlivesPredicate</a><'db, <a class="struct" href="struct.GenericArg.html" title="struct hir_ty::next_solver::GenericArg">GenericArg</a><'db>>], |
| ) -> Self</h4></section></summary><div class="docblock"><p>Same as <a href="struct.RegionAssumptions.html#method.new_from_slice" title="associated function hir_ty::next_solver::RegionAssumptions::new_from_slice"><code>Self::new_from_slice()</code></a> but won’t use the global empty slice <code>slice.is_empty()</code>, because someone |
| needs to intern the global slice as well.</p> |
| </div></details><section id="method.new_from_iter" class="method"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><h4 class="code-header">pub fn <a href="#method.new_from_iter" class="fn">new_from_iter</a><I, T>(args: I) -> T::Output<div class="where">where |
| I: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = T>, |
| T: CollectAndApply<<a class="type" href="predicate/type.OutlivesPredicate.html" title="type hir_ty::next_solver::predicate::OutlivesPredicate">OutlivesPredicate</a><'db, <a class="struct" href="struct.GenericArg.html" title="struct hir_ty::next_solver::GenericArg">GenericArg</a><'db>>, Self>,</div></h4></section><section id="method.as_slice" class="method"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><h4 class="code-header">pub fn <a href="#method.as_slice" class="fn">as_slice</a>(self) -> &'db [<a class="type" href="predicate/type.OutlivesPredicate.html" title="type hir_ty::next_solver::predicate::OutlivesPredicate">OutlivesPredicate</a><'db, <a class="struct" href="struct.GenericArg.html" title="struct hir_ty::next_solver::GenericArg">GenericArg</a><'db>>] <a href="#" class="tooltip" data-notable-ty="&'db [OutlivesPredicate<'db, GenericArg<'db>>]">ⓘ</a></h4></section><section id="method.iter" class="method"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><h4 class="code-header">pub fn <a href="#method.iter" class="fn">iter</a>(self) -> <a class="struct" href="https://doc.rust-lang.org/1.99.1/core/iter/adapters/copied/struct.Copied.html" title="struct core::iter::adapters::copied::Copied">Copied</a><<a class="struct" href="https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.Iter.html" title="struct core::slice::iter::Iter">Iter</a><'db, <a class="type" href="predicate/type.OutlivesPredicate.html" title="type hir_ty::next_solver::predicate::OutlivesPredicate">OutlivesPredicate</a><'db, <a class="struct" href="struct.GenericArg.html" title="struct hir_ty::next_solver::GenericArg">GenericArg</a><'db>>>> <a href="#" class="tooltip" data-notable-ty="Copied<Iter<'db, OutlivesPredicate<'db, GenericArg<'db>>>>">ⓘ</a></h4></section><section id="method.len" class="method"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><h4 class="code-header">pub fn <a href="#method.len" class="fn">len</a>(self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a></h4></section><section id="method.is_empty" class="method"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><h4 class="code-header">pub fn <a href="#method.is_empty" class="fn">is_empty</a>(self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-RegionAssumptions%3C'_%3E" class="impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#impl-RegionAssumptions%3C'_%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.RegionAssumptions.html" title="struct hir_ty::next_solver::RegionAssumptions">RegionAssumptions</a><'_></h3></section></summary><div class="impl-items"><section id="method.store" class="method"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><h4 class="code-header">pub fn <a href="#method.store" class="fn">store</a>(self) -> <a class="struct" href="struct.StoredRegionAssumptions.html" title="struct hir_ty::next_solver::StoredRegionAssumptions">StoredRegionAssumptions</a></h4></section></div></details></div><details class="toggle big-toggle" open><summary><h2 id="deref-methods-%5BOutlivesPredicate%3C'db,+GenericArg%3C'db%3E%3E%5D" class="section-header"><span>Methods from <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a><Target = [<a class="type" href="predicate/type.OutlivesPredicate.html" title="type hir_ty::next_solver::predicate::OutlivesPredicate">OutlivesPredicate</a><'db, <a class="struct" href="struct.GenericArg.html" title="struct hir_ty::next_solver::GenericArg">GenericArg</a><'db>>]></span><a href="#deref-methods-%5BOutlivesPredicate%3C'db,+GenericArg%3C'db%3E%3E%5D" class="anchor">§</a></h2></summary><div id="deref-methods-%5BOutlivesPredicate%3C'db,+GenericArg%3C'db%3E%3E%5D-1" class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_bytes" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/mem/maybe_uninit.rs.html#1495">Source</a><h4 class="code-header">pub fn <a href="#method.as_bytes" class="fn">as_bytes</a>(&self) -> &[<a class="union" href="https://doc.rust-lang.org/1.99.1/core/mem/maybe_uninit/union.MaybeUninit.html" title="union core::mem::maybe_uninit::MaybeUninit">MaybeUninit</a><<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.u8.html">u8</a>>]</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>maybe_uninit_as_bytes</code>)</span></div></span></summary><div class="docblock"><p>Returns the contents of this <code>MaybeUninit</code> as a slice of potentially uninitialized bytes.</p> |
| <p>Note that even if the contents of a <code>MaybeUninit</code> have been initialized, the value may still |
| contain padding bytes which are left uninitialized.</p> |
| <h5 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(maybe_uninit_as_bytes)] |
| </span><span class="kw">use </span>std::mem::MaybeUninit; |
| |
| <span class="kw">let </span>uninit = [MaybeUninit::new(<span class="number">0x1234u16</span>), MaybeUninit::new(<span class="number">0x5678u16</span>)]; |
| <span class="kw">let </span>uninit_bytes = uninit.as_bytes(); |
| <span class="kw">let </span>bytes = <span class="kw">unsafe </span>{ uninit_bytes.assume_init_ref() }; |
| <span class="kw">let </span>val1 = u16::from_ne_bytes(bytes[<span class="number">0</span>..<span class="number">2</span>].try_into().unwrap()); |
| <span class="kw">let </span>val2 = u16::from_ne_bytes(bytes[<span class="number">2</span>..<span class="number">4</span>].try_into().unwrap()); |
| <span class="macro">assert_eq!</span>(<span class="kw-2">&</span>[val1, val2], <span class="kw-2">&</span>[<span class="number">0x1234u16</span>, <span class="number">0x5678u16</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.assume_init_ref" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.93.0">1.93.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/mem/maybe_uninit.rs.html#1576">Source</a></span><h4 class="code-header">pub unsafe fn <a href="#method.assume_init_ref" class="fn">assume_init_ref</a>(&self) -> &<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a></h4></section></summary><div class="docblock"><p>Gets a shared reference to the contained value.</p> |
| <h5 id="safety"><a class="doc-anchor" href="#safety">§</a>Safety</h5> |
| <p>Calling this when the content is not yet fully initialized causes undefined |
| behavior: it is up to the caller to guarantee that every <code>MaybeUninit<T></code> in |
| the slice really is in an initialized state.</p> |
| </div></details><details class="toggle method-toggle" open><summary><section id="method.as_str" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/ascii/ascii_char.rs.html#1184">Source</a><h4 class="code-header">pub fn <a href="#method.as_str" class="fn">as_str</a>(&self) -> &<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.str.html">str</a></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>ascii_char</code>)</span></div></span></summary><div class="docblock"><p>Views this slice of ASCII characters as a UTF-8 <code>str</code>.</p> |
| </div></details><details class="toggle method-toggle" open><summary><section id="method.as_bytes-1" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/ascii/ascii_char.rs.html#1195">Source</a><h4 class="code-header">pub fn <a href="#method.as_bytes-1" class="fn">as_bytes</a>(&self) -> &[<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.u8.html">u8</a>] <a href="#" class="tooltip" data-notable-ty="&[u8]">ⓘ</a></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>ascii_char</code>)</span></div></span></summary><div class="docblock"><p>Views this slice of ASCII characters as a slice of <code>u8</code> bytes.</p> |
| </div></details><details class="toggle method-toggle" open><summary><section id="method.is_ascii" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.23.0">1.23.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/ascii.rs.html#18">Source</a></span><h4 class="code-header">pub fn <a href="#method.is_ascii" class="fn">is_ascii</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Checks if all bytes in this slice are within the ASCII range.</p> |
| <p>An empty slice returns <code>true</code>.</p> |
| </div></details><details class="toggle method-toggle" open><summary><section id="method.as_ascii" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/slice/ascii.rs.html#27">Source</a><h4 class="code-header">pub fn <a href="#method.as_ascii" class="fn">as_ascii</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&[<a class="enum" href="https://doc.rust-lang.org/1.99.1/core/ascii/ascii_char/enum.AsciiChar.html" title="enum core::ascii::ascii_char::AsciiChar">AsciiChar</a>]></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>ascii_char</code>)</span></div></span></summary><div class="docblock"><p>If this slice <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.is_ascii" title="method slice::is_ascii"><code>is_ascii</code></a>, returns it as a slice of |
| <a href="https://doc.rust-lang.org/1.99.1/core/ascii/ascii_char/enum.AsciiChar.html" title="enum core::ascii::ascii_char::AsciiChar">ASCII characters</a>, otherwise returns <code>None</code>.</p> |
| </div></details><details class="toggle method-toggle" open><summary><section id="method.as_ascii_unchecked" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/slice/ascii.rs.html#45">Source</a><h4 class="code-header">pub unsafe fn <a href="#method.as_ascii_unchecked" class="fn">as_ascii_unchecked</a>(&self) -> &[<a class="enum" href="https://doc.rust-lang.org/1.99.1/core/ascii/ascii_char/enum.AsciiChar.html" title="enum core::ascii::ascii_char::AsciiChar">AsciiChar</a>]</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>ascii_char</code>)</span></div></span></summary><div class="docblock"><p>Converts this slice of bytes into a slice of ASCII characters, |
| without checking whether they’re valid.</p> |
| <h5 id="safety-1"><a class="doc-anchor" href="#safety-1">§</a>Safety</h5> |
| <p>Every byte in the slice must be in <code>0..=127</code>, or else this is UB.</p> |
| </div></details><details class="toggle method-toggle" open><summary><section id="method.eq_ignore_ascii_case" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.23.0">1.23.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/ascii.rs.html#60">Source</a></span><h4 class="code-header">pub fn <a href="#method.eq_ignore_ascii_case" class="fn">eq_ignore_ascii_case</a>(&self, other: &[<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.u8.html">u8</a>]) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Checks that two slices 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><details class="toggle method-toggle" open><summary><section id="method.escape_ascii" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.60.0">1.60.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/ascii.rs.html#224">Source</a></span><h4 class="code-header">pub fn <a href="#method.escape_ascii" class="fn">escape_ascii</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.99.1/core/slice/ascii/struct.EscapeAscii.html" title="struct core::slice::ascii::EscapeAscii">EscapeAscii</a><'_> <a href="#" class="tooltip" data-notable-ty="EscapeAscii<'_>">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns an iterator that produces an escaped version of this slice, |
| treating it as an ASCII string.</p> |
| <h5 id="examples-1"><a class="doc-anchor" href="#examples-1">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>s = <span class="string">b"0\t\r\n'\"\\\x9d"</span>; |
| <span class="kw">let </span>escaped = s.escape_ascii().to_string(); |
| <span class="macro">assert_eq!</span>(escaped, <span class="string">"0\\t\\r\\n\\'\\\"\\\\\\x9d"</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.trim_ascii_start" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.80.0">1.80.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/ascii.rs.html#247">Source</a></span><h4 class="code-header">pub fn <a href="#method.trim_ascii_start" class="fn">trim_ascii_start</a>(&self) -> &[<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.u8.html">u8</a>] <a href="#" class="tooltip" data-notable-ty="&[u8]">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns a byte slice with leading ASCII whitespace bytes removed.</p> |
| <p>‘Whitespace’ refers to the definition used by |
| <a href="https://doc.rust-lang.org/1.99.1/std/primitive.u8.html#method.is_ascii_whitespace" title="method u8::is_ascii_whitespace"><code>u8::is_ascii_whitespace</code></a>. Importantly, this definition excludes |
| the <code>\0x0B</code> byte even though it has the Unicode <a href="https://www.unicode.org/reports/tr44/#White_Space"><code>White_Space</code></a> property |
| and is removed by <a href="https://doc.rust-lang.org/1.99.1/std/primitive.str.html#method.trim_start" title="method str::trim_start"><code>str::trim_start</code></a>.</p> |
| <h5 id="examples-2"><a class="doc-anchor" href="#examples-2">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert_eq!</span>(<span class="string">b" \t hello world\n"</span>.trim_ascii_start(), <span class="string">b"hello world\n"</span>); |
| <span class="macro">assert_eq!</span>(<span class="string">b" "</span>.trim_ascii_start(), <span class="string">b""</span>); |
| <span class="macro">assert_eq!</span>(<span class="string">b""</span>.trim_ascii_start(), <span class="string">b""</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.trim_ascii_end" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.80.0">1.80.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/ascii.rs.html#280">Source</a></span><h4 class="code-header">pub fn <a href="#method.trim_ascii_end" class="fn">trim_ascii_end</a>(&self) -> &[<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.u8.html">u8</a>] <a href="#" class="tooltip" data-notable-ty="&[u8]">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns a byte slice with trailing ASCII whitespace bytes removed.</p> |
| <p>‘Whitespace’ refers to the definition used by |
| <a href="https://doc.rust-lang.org/1.99.1/std/primitive.u8.html#method.is_ascii_whitespace" title="method u8::is_ascii_whitespace"><code>u8::is_ascii_whitespace</code></a>. Importantly, this definition excludes |
| the <code>\0x0B</code> byte even though it has the Unicode <a href="https://www.unicode.org/reports/tr44/#White_Space"><code>White_Space</code></a> property |
| and is removed by <a href="https://doc.rust-lang.org/1.99.1/std/primitive.str.html#method.trim_end" title="method str::trim_end"><code>str::trim_end</code></a>.</p> |
| <h5 id="examples-3"><a class="doc-anchor" href="#examples-3">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert_eq!</span>(<span class="string">b"\r hello world\n "</span>.trim_ascii_end(), <span class="string">b"\r hello world"</span>); |
| <span class="macro">assert_eq!</span>(<span class="string">b" "</span>.trim_ascii_end(), <span class="string">b""</span>); |
| <span class="macro">assert_eq!</span>(<span class="string">b""</span>.trim_ascii_end(), <span class="string">b""</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.trim_ascii" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.80.0">1.80.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/ascii.rs.html#314">Source</a></span><h4 class="code-header">pub fn <a href="#method.trim_ascii" class="fn">trim_ascii</a>(&self) -> &[<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.u8.html">u8</a>] <a href="#" class="tooltip" data-notable-ty="&[u8]">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns a byte slice with leading and trailing ASCII whitespace bytes |
| removed.</p> |
| <p>‘Whitespace’ refers to the definition used by |
| <a href="https://doc.rust-lang.org/1.99.1/std/primitive.u8.html#method.is_ascii_whitespace" title="method u8::is_ascii_whitespace"><code>u8::is_ascii_whitespace</code></a>. Importantly, this definition excludes |
| the <code>\0x0B</code> byte even though it has the Unicode <a href="https://www.unicode.org/reports/tr44/#White_Space"><code>White_Space</code></a> property |
| and is removed by <a href="https://doc.rust-lang.org/1.99.1/std/primitive.str.html#method.trim" title="method str::trim"><code>str::trim</code></a>.</p> |
| <h5 id="examples-4"><a class="doc-anchor" href="#examples-4">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert_eq!</span>(<span class="string">b"\r hello world\n "</span>.trim_ascii(), <span class="string">b"hello world"</span>); |
| <span class="macro">assert_eq!</span>(<span class="string">b" "</span>.trim_ascii(), <span class="string">b""</span>); |
| <span class="macro">assert_eq!</span>(<span class="string">b""</span>.trim_ascii(), <span class="string">b""</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.len-1" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#116">Source</a></span><h4 class="code-header">pub fn <a href="#method.len-1" class="fn">len</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Returns the number of elements in the slice.</p> |
| <h5 id="examples-5"><a class="doc-anchor" href="#examples-5">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>a = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>]; |
| <span class="macro">assert_eq!</span>(a.len(), <span class="number">3</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.is_empty-1" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#136">Source</a></span><h4 class="code-header">pub fn <a href="#method.is_empty-1" class="fn">is_empty</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Returns <code>true</code> if the slice has a length of 0.</p> |
| <h5 id="examples-6"><a class="doc-anchor" href="#examples-6">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>a = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>]; |
| <span class="macro">assert!</span>(!a.is_empty()); |
| |
| <span class="kw">let </span>b: <span class="kw-2">&</span>[i32] = <span class="kw-2">&</span>[]; |
| <span class="macro">assert!</span>(b.is_empty());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.first" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#155">Source</a></span><h4 class="code-header">pub fn <a href="#method.first" class="fn">first</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&T</a>></h4></section></summary><div class="docblock"><p>Returns the first element of the slice, or <code>None</code> if it is empty.</p> |
| <h5 id="examples-7"><a class="doc-anchor" href="#examples-7">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>]; |
| <span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="kw-2">&</span><span class="number">10</span>), v.first()); |
| |
| <span class="kw">let </span>w: <span class="kw-2">&</span>[i32] = <span class="kw-2">&</span>[]; |
| <span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, w.first());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_first" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.5.0">1.5.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#198">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_first" class="fn">split_first</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><(<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&T</a>, &<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>)></h4></section></summary><div class="docblock"><p>Returns the first and all the rest of the elements of the slice, or <code>None</code> if it is empty.</p> |
| <h5 id="examples-8"><a class="doc-anchor" href="#examples-8">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="kw-2">&</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>]; |
| |
| <span class="kw">if let </span><span class="prelude-val">Some</span>((first, elements)) = x.split_first() { |
| <span class="macro">assert_eq!</span>(first, <span class="kw-2">&</span><span class="number">0</span>); |
| <span class="macro">assert_eq!</span>(elements, <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">2</span>]); |
| }</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_last" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.5.0">1.5.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#240">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_last" class="fn">split_last</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><(<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&T</a>, &<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>)></h4></section></summary><div class="docblock"><p>Returns the last and all the rest of the elements of the slice, or <code>None</code> if it is empty.</p> |
| <h5 id="examples-9"><a class="doc-anchor" href="#examples-9">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="kw-2">&</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>]; |
| |
| <span class="kw">if let </span><span class="prelude-val">Some</span>((last, elements)) = x.split_last() { |
| <span class="macro">assert_eq!</span>(last, <span class="kw-2">&</span><span class="number">2</span>); |
| <span class="macro">assert_eq!</span>(elements, <span class="kw-2">&</span>[<span class="number">0</span>, <span class="number">1</span>]); |
| }</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.last" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#281">Source</a></span><h4 class="code-header">pub fn <a href="#method.last" class="fn">last</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&T</a>></h4></section></summary><div class="docblock"><p>Returns the last element of the slice, or <code>None</code> if it is empty.</p> |
| <h5 id="examples-10"><a class="doc-anchor" href="#examples-10">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>]; |
| <span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="kw-2">&</span><span class="number">30</span>), v.last()); |
| |
| <span class="kw">let </span>w: <span class="kw-2">&</span>[i32] = <span class="kw-2">&</span>[]; |
| <span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, w.last());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.first_chunk" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.77.0">1.77.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#327">Source</a></span><h4 class="code-header">pub fn <a href="#method.first_chunk" class="fn">first_chunk</a><const N: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.array.html">[T; N]</a>></h4></section></summary><div class="docblock"><p>Returns an array reference to the first <code>N</code> items in the slice.</p> |
| <p>If the slice is not at least <code>N</code> in length, this will return <code>None</code>.</p> |
| <h5 id="examples-11"><a class="doc-anchor" href="#examples-11">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>u = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>]; |
| <span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>]), u.first_chunk::<<span class="number">2</span>>()); |
| |
| <span class="kw">let </span>v: <span class="kw-2">&</span>[i32] = <span class="kw-2">&</span>[<span class="number">10</span>]; |
| <span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, v.first_chunk::<<span class="number">2</span>>()); |
| |
| <span class="kw">let </span>w: <span class="kw-2">&</span>[i32] = <span class="kw-2">&</span>[]; |
| <span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="kw-2">&</span>[]), w.first_chunk::<<span class="number">0</span>>());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_first_chunk" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.77.0">1.77.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#387">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_first_chunk" class="fn">split_first_chunk</a><const N: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><(&<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.array.html">[T; N]</a>, &<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>)></h4></section></summary><div class="docblock"><p>Returns an array reference to the first <code>N</code> items in the slice and the remaining slice.</p> |
| <p>If the slice is not at least <code>N</code> in length, this will return <code>None</code>.</p> |
| <h5 id="examples-12"><a class="doc-anchor" href="#examples-12">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="kw-2">&</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>]; |
| |
| <span class="kw">if let </span><span class="prelude-val">Some</span>((first, elements)) = x.split_first_chunk::<<span class="number">2</span>>() { |
| <span class="macro">assert_eq!</span>(first, <span class="kw-2">&</span>[<span class="number">0</span>, <span class="number">1</span>]); |
| <span class="macro">assert_eq!</span>(elements, <span class="kw-2">&</span>[<span class="number">2</span>]); |
| } |
| |
| <span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, x.split_first_chunk::<<span class="number">4</span>>());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_last_chunk" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.77.0">1.77.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#447">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_last_chunk" class="fn">split_last_chunk</a><const N: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><(&<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>, &<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.array.html">[T; N]</a>)></h4></section></summary><div class="docblock"><p>Returns an array reference to the last <code>N</code> items in the slice and the remaining slice.</p> |
| <p>If the slice is not at least <code>N</code> in length, this will return <code>None</code>.</p> |
| <h5 id="examples-13"><a class="doc-anchor" href="#examples-13">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="kw-2">&</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>]; |
| |
| <span class="kw">if let </span><span class="prelude-val">Some</span>((elements, last)) = x.split_last_chunk::<<span class="number">2</span>>() { |
| <span class="macro">assert_eq!</span>(elements, <span class="kw-2">&</span>[<span class="number">0</span>]); |
| <span class="macro">assert_eq!</span>(last, <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">2</span>]); |
| } |
| |
| <span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, x.split_last_chunk::<<span class="number">4</span>>());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.last_chunk" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.77.0">1.77.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#509">Source</a></span><h4 class="code-header">pub fn <a href="#method.last_chunk" class="fn">last_chunk</a><const N: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.array.html">[T; N]</a>></h4></section></summary><div class="docblock"><p>Returns an array reference to the last <code>N</code> items in the slice.</p> |
| <p>If the slice is not at least <code>N</code> in length, this will return <code>None</code>.</p> |
| <h5 id="examples-14"><a class="doc-anchor" href="#examples-14">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>u = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>]; |
| <span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">40</span>, <span class="number">30</span>]), u.last_chunk::<<span class="number">2</span>>()); |
| |
| <span class="kw">let </span>v: <span class="kw-2">&</span>[i32] = <span class="kw-2">&</span>[<span class="number">10</span>]; |
| <span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, v.last_chunk::<<span class="number">2</span>>()); |
| |
| <span class="kw">let </span>w: <span class="kw-2">&</span>[i32] = <span class="kw-2">&</span>[]; |
| <span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="kw-2">&</span>[]), w.last_chunk::<<span class="number">0</span>>());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.get" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#572-574">Source</a></span><h4 class="code-header">pub fn <a href="#method.get" class="fn">get</a><I>(&self, index: I) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<I as <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a><<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.99.1/core/slice/index/trait.SliceIndex.html#associatedtype.Output" title="type core::slice::index::SliceIndex::Output">Output</a>><div class="where">where |
| I: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a><<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>>,</div></h4></section></summary><div class="docblock"><p>Returns a reference to an element or subslice depending on the type of |
| index.</p> |
| <ul> |
| <li>If given a position, returns a reference to the element at that |
| position or <code>None</code> if out of bounds.</li> |
| <li>If given a range, returns the subslice corresponding to that range, |
| or <code>None</code> if out of bounds.</li> |
| </ul> |
| <h5 id="examples-15"><a class="doc-anchor" href="#examples-15">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>]; |
| <span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="kw-2">&</span><span class="number">40</span>), v.get(<span class="number">1</span>)); |
| <span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>][..]), v.get(<span class="number">0</span>..<span class="number">2</span>)); |
| <span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, v.get(<span class="number">3</span>)); |
| <span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, v.get(<span class="number">0</span>..<span class="number">4</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.get_unchecked" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#640-642">Source</a></span><h4 class="code-header">pub unsafe fn <a href="#method.get_unchecked" class="fn">get_unchecked</a><I>( |
| &self, |
| index: I, |
| ) -> &<I as <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a><<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.99.1/core/slice/index/trait.SliceIndex.html#associatedtype.Output" title="type core::slice::index::SliceIndex::Output">Output</a><div class="where">where |
| I: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a><<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>>,</div></h4></section></summary><div class="docblock"><p>Returns a reference to an element or subslice, without doing bounds |
| checking.</p> |
| <p>For a safe alternative see <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.get" title="method slice::get"><code>get</code></a>.</p> |
| <h5 id="safety-2"><a class="doc-anchor" href="#safety-2">§</a>Safety</h5> |
| <p>Calling this method with an out-of-bounds index is <em><a href="https://doc.rust-lang.org/reference/behavior-considered-undefined.html">undefined behavior</a></em> |
| even if the resulting reference is not used.</p> |
| <p>You can think of this like <code>.get(index).unwrap_unchecked()</code>. It’s UB |
| to call <code>.get_unchecked(len)</code>, even if you immediately convert to a |
| pointer. And it’s UB to call <code>.get_unchecked(..len + 1)</code>, |
| <code>.get_unchecked(..=len)</code>, or similar.</p> |
| <h5 id="examples-16"><a class="doc-anchor" href="#examples-16">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>]; |
| |
| <span class="kw">unsafe </span>{ |
| <span class="macro">assert_eq!</span>(x.get_unchecked(<span class="number">1</span>), <span class="kw-2">&</span><span class="number">2</span>); |
| }</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.as_ptr" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#728">Source</a></span><h4 class="code-header">pub fn <a href="#method.as_ptr" class="fn">as_ptr</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.pointer.html">*const T</a></h4></section></summary><div class="docblock"><p>Returns a raw pointer to the slice’s buffer.</p> |
| <p>The caller must ensure that the slice outlives the pointer this |
| function returns, or else it will end up dangling.</p> |
| <p>The caller must also ensure that the memory the pointer (non-transitively) points to |
| is never written to (except inside an <code>UnsafeCell</code>) using this pointer or any pointer |
| derived from it. If you need to mutate the contents of the slice, use <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.as_mut_ptr" title="method slice::as_mut_ptr"><code>as_mut_ptr</code></a>.</p> |
| <p>Modifying the container referenced by this slice may cause its buffer |
| to be reallocated, which would also make any pointers to it invalid.</p> |
| <h5 id="examples-17"><a class="doc-anchor" href="#examples-17">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>]; |
| <span class="kw">let </span>x_ptr = x.as_ptr(); |
| |
| <span class="kw">unsafe </span>{ |
| <span class="kw">for </span>i <span class="kw">in </span><span class="number">0</span>..x.len() { |
| <span class="macro">assert_eq!</span>(x.get_unchecked(i), <span class="kw-2">&*</span>x_ptr.add(i)); |
| } |
| }</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.as_ptr_range" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.48.0">1.48.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#796">Source</a></span><h4 class="code-header">pub fn <a href="#method.as_ptr_range" class="fn">as_ptr_range</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.99.1/core/ops/range/struct.Range.html" title="struct core::ops::range::Range">Range</a><<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.pointer.html">*const T</a>> <a href="#" class="tooltip" data-notable-ty="Range<*const T>">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns the two raw pointers spanning the slice.</p> |
| <p>The returned range is half-open, which means that the end pointer |
| points <em>one past</em> the last element of the slice. This way, an empty |
| slice is represented by two equal pointers, and the difference between |
| the two pointers represents the size of the slice.</p> |
| <p>See <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.as_ptr" title="method slice::as_ptr"><code>as_ptr</code></a> for warnings on using these pointers. The end pointer |
| requires extra caution, as it does not point to a valid element in the |
| slice.</p> |
| <p>This function is useful for interacting with foreign interfaces which |
| use two pointers to refer to a range of elements in memory, as is |
| common in C++.</p> |
| <p>It can also be useful to check if a pointer to an element refers to an |
| element of this slice:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>a = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>]; |
| <span class="kw">let </span>x = <span class="kw-2">&</span>a[<span class="number">1</span>] <span class="kw">as </span><span class="kw-2">*const </span><span class="kw">_</span>; |
| <span class="kw">let </span>y = <span class="kw-2">&</span><span class="number">5 </span><span class="kw">as </span><span class="kw-2">*const </span><span class="kw">_</span>; |
| |
| <span class="macro">assert!</span>(a.as_ptr_range().contains(<span class="kw-2">&</span>x)); |
| <span class="macro">assert!</span>(!a.as_ptr_range().contains(<span class="kw-2">&</span>y));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.as_array" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.93.0">1.93.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#853">Source</a></span><h4 class="code-header">pub fn <a href="#method.as_array" class="fn">as_array</a><const N: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.array.html">[T; N]</a>></h4></section></summary><div class="docblock"><p>Gets a reference to the underlying array.</p> |
| <p>If <code>N</code> is not exactly equal to the length of <code>self</code>, then this method returns <code>None</code>.</p> |
| </div></details><details class="toggle method-toggle" open><summary><section id="method.iter-1" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#1039">Source</a></span><h4 class="code-header">pub fn <a href="#method.iter-1" class="fn">iter</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.Iter.html" title="struct core::slice::iter::Iter">Iter</a><'_, T> <a href="#" class="tooltip" data-notable-ty="Iter<'_, T>">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns an iterator over the slice.</p> |
| <p>The iterator yields all items from start to end.</p> |
| <h5 id="examples-18"><a class="doc-anchor" href="#examples-18">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>]; |
| <span class="kw">let </span><span class="kw-2">mut </span>iterator = x.iter(); |
| |
| <span class="macro">assert_eq!</span>(iterator.next(), <span class="prelude-val">Some</span>(<span class="kw-2">&</span><span class="number">1</span>)); |
| <span class="macro">assert_eq!</span>(iterator.next(), <span class="prelude-val">Some</span>(<span class="kw-2">&</span><span class="number">2</span>)); |
| <span class="macro">assert_eq!</span>(iterator.next(), <span class="prelude-val">Some</span>(<span class="kw-2">&</span><span class="number">4</span>)); |
| <span class="macro">assert_eq!</span>(iterator.next(), <span class="prelude-val">None</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.windows" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#1114">Source</a></span><h4 class="code-header">pub fn <a href="#method.windows" class="fn">windows</a>(&self, size: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.Windows.html" title="struct core::slice::iter::Windows">Windows</a><'_, T> <a href="#" class="tooltip" data-notable-ty="Windows<'_, T>">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns an iterator over all contiguous windows of length |
| <code>size</code>. The windows overlap. If the slice is shorter than |
| <code>size</code>, the iterator returns no values.</p> |
| <h5 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h5> |
| <p>Panics if <code>size</code> is zero.</p> |
| <h5 id="examples-19"><a class="doc-anchor" href="#examples-19">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="string">'l'</span>, <span class="string">'o'</span>, <span class="string">'r'</span>, <span class="string">'e'</span>, <span class="string">'m'</span>]; |
| <span class="kw">let </span><span class="kw-2">mut </span>iter = slice.windows(<span class="number">3</span>); |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'l'</span>, <span class="string">'o'</span>, <span class="string">'r'</span>]); |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'o'</span>, <span class="string">'r'</span>, <span class="string">'e'</span>]); |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'r'</span>, <span class="string">'e'</span>, <span class="string">'m'</span>]); |
| <span class="macro">assert!</span>(iter.next().is_none());</code></pre></div> |
| <p>If the slice is shorter than <code>size</code>:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="string">'f'</span>, <span class="string">'o'</span>, <span class="string">'o'</span>]; |
| <span class="kw">let </span><span class="kw-2">mut </span>iter = slice.windows(<span class="number">4</span>); |
| <span class="macro">assert!</span>(iter.next().is_none());</code></pre></div> |
| <p>Because the <a href="https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> trait cannot represent the required lifetimes, |
| there is no <code>windows_mut</code> analog to <code>windows</code>; |
| <code>[0,1,2].windows_mut(2).collect()</code> would violate <a href="https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html#the-rules-of-references">the rules of references</a> |
| (though a <a href="https://blog.rust-lang.org/2022/10/28/gats-stabilization.html">LendingIterator</a> analog is possible). You can sometimes use |
| <a href="https://doc.rust-lang.org/1.99.1/core/cell/struct.Cell.html#method.as_slice_of_cells" title="method core::cell::Cell::as_slice_of_cells"><code>Cell::as_slice_of_cells</code></a> in |
| conjunction with <code>windows</code> instead:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::cell::Cell; |
| |
| <span class="kw">let </span><span class="kw-2">mut </span>array = [<span class="string">'R'</span>, <span class="string">'u'</span>, <span class="string">'s'</span>, <span class="string">'t'</span>, <span class="string">' '</span>, <span class="string">'2'</span>, <span class="string">'0'</span>, <span class="string">'1'</span>, <span class="string">'5'</span>]; |
| <span class="kw">let </span>slice = <span class="kw-2">&mut </span>array[..]; |
| <span class="kw">let </span>slice_of_cells: <span class="kw-2">&</span>[Cell<char>] = Cell::from_mut(slice).as_slice_of_cells(); |
| <span class="kw">for </span>w <span class="kw">in </span>slice_of_cells.windows(<span class="number">3</span>) { |
| Cell::swap(<span class="kw-2">&</span>w[<span class="number">0</span>], <span class="kw-2">&</span>w[<span class="number">2</span>]); |
| } |
| <span class="macro">assert_eq!</span>(array, [<span class="string">'s'</span>, <span class="string">'t'</span>, <span class="string">' '</span>, <span class="string">'2'</span>, <span class="string">'0'</span>, <span class="string">'1'</span>, <span class="string">'5'</span>, <span class="string">'u'</span>, <span class="string">'R'</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.chunks" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#1154">Source</a></span><h4 class="code-header">pub fn <a href="#method.chunks" class="fn">chunks</a>(&self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.Chunks.html" title="struct core::slice::iter::Chunks">Chunks</a><'_, T> <a href="#" class="tooltip" data-notable-ty="Chunks<'_, T>">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns an iterator over <code>chunk_size</code> elements of the slice at a time, starting at the |
| beginning of the slice.</p> |
| <p>The chunks are slices and do not overlap. If <code>chunk_size</code> does not divide the length of the |
| slice, then the last chunk will not have length <code>chunk_size</code>.</p> |
| <p>See <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.chunks_exact" title="method slice::chunks_exact"><code>chunks_exact</code></a> for a variant of this iterator that returns chunks of always exactly |
| <code>chunk_size</code> elements, and <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.rchunks" title="method slice::rchunks"><code>rchunks</code></a> for the same iterator but starting at the end of the |
| slice.</p> |
| <p>If your <code>chunk_size</code> is a constant, consider using <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.as_chunks" title="method slice::as_chunks"><code>as_chunks</code></a> instead, which will |
| give references to arrays of exactly that length, rather than slices.</p> |
| <h5 id="panics-1"><a class="doc-anchor" href="#panics-1">§</a>Panics</h5> |
| <p>Panics if <code>chunk_size</code> is zero.</p> |
| <h5 id="examples-20"><a class="doc-anchor" href="#examples-20">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="string">'l'</span>, <span class="string">'o'</span>, <span class="string">'r'</span>, <span class="string">'e'</span>, <span class="string">'m'</span>]; |
| <span class="kw">let </span><span class="kw-2">mut </span>iter = slice.chunks(<span class="number">2</span>); |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'l'</span>, <span class="string">'o'</span>]); |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'r'</span>, <span class="string">'e'</span>]); |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'m'</span>]); |
| <span class="macro">assert!</span>(iter.next().is_none());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.chunks_exact" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.31.0">1.31.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#1241">Source</a></span><h4 class="code-header">pub fn <a href="#method.chunks_exact" class="fn">chunks_exact</a>(&self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.ChunksExact.html" title="struct core::slice::iter::ChunksExact">ChunksExact</a><'_, T> <a href="#" class="tooltip" data-notable-ty="ChunksExact<'_, T>">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns an iterator over <code>chunk_size</code> elements of the slice at a time, starting at the |
| beginning of the slice.</p> |
| <p>The chunks are slices and do not overlap. If <code>chunk_size</code> does not divide the length of the |
| slice, then the last up to <code>chunk_size-1</code> elements will be omitted and can be retrieved |
| from the <code>remainder</code> function of the iterator.</p> |
| <p>Due to each chunk having exactly <code>chunk_size</code> elements, the compiler can often optimize the |
| resulting code better than in the case of <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.chunks" title="method slice::chunks"><code>chunks</code></a>.</p> |
| <p>See <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.chunks" title="method slice::chunks"><code>chunks</code></a> for a variant of this iterator that also returns the remainder as a smaller |
| chunk, and <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.rchunks_exact" title="method slice::rchunks_exact"><code>rchunks_exact</code></a> for the same iterator but starting at the end of the slice.</p> |
| <p>If your <code>chunk_size</code> is a constant, consider using <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.as_chunks" title="method slice::as_chunks"><code>as_chunks</code></a> instead, which will |
| give references to arrays of exactly that length, rather than slices.</p> |
| <h5 id="panics-2"><a class="doc-anchor" href="#panics-2">§</a>Panics</h5> |
| <p>Panics if <code>chunk_size</code> is zero.</p> |
| <h5 id="examples-21"><a class="doc-anchor" href="#examples-21">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="string">'l'</span>, <span class="string">'o'</span>, <span class="string">'r'</span>, <span class="string">'e'</span>, <span class="string">'m'</span>]; |
| <span class="kw">let </span><span class="kw-2">mut </span>iter = slice.chunks_exact(<span class="number">2</span>); |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'l'</span>, <span class="string">'o'</span>]); |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'r'</span>, <span class="string">'e'</span>]); |
| <span class="macro">assert!</span>(iter.next().is_none()); |
| <span class="macro">assert_eq!</span>(iter.remainder(), <span class="kw-2">&</span>[<span class="string">'m'</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.as_chunks_unchecked" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.88.0">1.88.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#1337-1339">Source</a></span><h4 class="code-header">pub unsafe fn <a href="#method.as_chunks_unchecked" class="fn">as_chunks_unchecked</a><const N: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>>(&self) -> &[<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.array.html">[T; N]</a>]</h4></section></summary><div class="docblock"><p>Splits the slice into a slice of <code>N</code>-element arrays, |
| assuming that there’s no remainder.</p> |
| <p>This is the inverse operation to <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.as_flattened" title="method slice::as_flattened"><code>as_flattened</code></a>.</p> |
| <p>As this is <code>unsafe</code>, consider whether you could use <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.as_chunks" title="method slice::as_chunks"><code>as_chunks</code></a> or |
| <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.as_rchunks" title="method slice::as_rchunks"><code>as_rchunks</code></a> instead, perhaps via something like |
| <code>if let (chunks, []) = slice.as_chunks()</code> or |
| <code>let (chunks, []) = slice.as_chunks() else { unreachable!() };</code>.</p> |
| <h5 id="safety-3"><a class="doc-anchor" href="#safety-3">§</a>Safety</h5> |
| <p>This may only be called when</p> |
| <ul> |
| <li>The slice splits exactly into <code>N</code>-element chunks (aka <code>self.len() % N == 0</code>).</li> |
| <li><code>N != 0</code>.</li> |
| </ul> |
| <h5 id="examples-22"><a class="doc-anchor" href="#examples-22">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice: <span class="kw-2">&</span>[char] = <span class="kw-2">&</span>[<span class="string">'l'</span>, <span class="string">'o'</span>, <span class="string">'r'</span>, <span class="string">'e'</span>, <span class="string">'m'</span>, <span class="string">'!'</span>]; |
| <span class="kw">let </span>chunks: <span class="kw-2">&</span>[[char; <span class="number">1</span>]] = |
| <span class="comment">// SAFETY: 1-element chunks never have remainder |
| </span><span class="kw">unsafe </span>{ slice.as_chunks_unchecked() }; |
| <span class="macro">assert_eq!</span>(chunks, <span class="kw-2">&</span>[[<span class="string">'l'</span>], [<span class="string">'o'</span>], [<span class="string">'r'</span>], [<span class="string">'e'</span>], [<span class="string">'m'</span>], [<span class="string">'!'</span>]]); |
| <span class="kw">let </span>chunks: <span class="kw-2">&</span>[[char; <span class="number">3</span>]] = |
| <span class="comment">// SAFETY: The slice length (6) is a multiple of 3 |
| </span><span class="kw">unsafe </span>{ slice.as_chunks_unchecked() }; |
| <span class="macro">assert_eq!</span>(chunks, <span class="kw-2">&</span>[[<span class="string">'l'</span>, <span class="string">'o'</span>, <span class="string">'r'</span>], [<span class="string">'e'</span>, <span class="string">'m'</span>, <span class="string">'!'</span>]]); |
| |
| <span class="comment">// These would be unsound: |
| // let chunks: &[[_; 5]] = slice.as_chunks_unchecked() // The slice length is not a multiple of 5 |
| // let chunks: &[[_; 0]] = slice.as_chunks_unchecked() // Zero-length chunks are never allowed</span></code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.as_chunks" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.88.0">1.88.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#1397">Source</a></span><h4 class="code-header">pub fn <a href="#method.as_chunks" class="fn">as_chunks</a><const N: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>>(&self) -> (&[<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.array.html">[T; N]</a>], &<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>)</h4></section></summary><div class="docblock"><p>Splits the slice into a slice of <code>N</code>-element arrays, |
| starting at the beginning of the slice, |
| and a remainder slice with length strictly less than <code>N</code>.</p> |
| <p>The remainder is meaningful in the division sense. Given |
| <code>let (chunks, remainder) = slice.as_chunks()</code>, then:</p> |
| <ul> |
| <li><code>chunks.len()</code> equals <code>slice.len() / N</code>,</li> |
| <li><code>remainder.len()</code> equals <code>slice.len() % N</code>, and</li> |
| <li><code>slice.len()</code> equals <code>chunks.len() * N + remainder.len()</code>.</li> |
| </ul> |
| <p>You can flatten the chunks back into a slice-of-<code>T</code> with <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.as_flattened" title="method slice::as_flattened"><code>as_flattened</code></a>.</p> |
| <h5 id="panics-3"><a class="doc-anchor" href="#panics-3">§</a>Panics</h5> |
| <p>Panics if <code>N</code> is zero.</p> |
| <p>Note that this check is against a const generic parameter, not a runtime |
| value, and thus a particular monomorphization will either always panic |
| or it will never panic.</p> |
| <h5 id="examples-23"><a class="doc-anchor" href="#examples-23">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="string">'l'</span>, <span class="string">'o'</span>, <span class="string">'r'</span>, <span class="string">'e'</span>, <span class="string">'m'</span>]; |
| <span class="kw">let </span>(chunks, remainder) = slice.as_chunks(); |
| <span class="macro">assert_eq!</span>(chunks, <span class="kw-2">&</span>[[<span class="string">'l'</span>, <span class="string">'o'</span>], [<span class="string">'r'</span>, <span class="string">'e'</span>]]); |
| <span class="macro">assert_eq!</span>(remainder, <span class="kw-2">&</span>[<span class="string">'m'</span>]);</code></pre></div> |
| <p>If you expect the slice to be an exact multiple, you can combine |
| <code>let</code>-<code>else</code> with an empty slice pattern:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="string">'R'</span>, <span class="string">'u'</span>, <span class="string">'s'</span>, <span class="string">'t'</span>]; |
| <span class="kw">let </span>(chunks, []) = slice.as_chunks::<<span class="number">2</span>>() <span class="kw">else </span>{ |
| <span class="macro">panic!</span>(<span class="string">"slice didn't have even length"</span>) |
| }; |
| <span class="macro">assert_eq!</span>(chunks, <span class="kw-2">&</span>[[<span class="string">'R'</span>, <span class="string">'u'</span>], [<span class="string">'s'</span>, <span class="string">'t'</span>]]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.as_rchunks" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.88.0">1.88.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#1444">Source</a></span><h4 class="code-header">pub fn <a href="#method.as_rchunks" class="fn">as_rchunks</a><const N: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>>(&self) -> (&<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>, &[<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.array.html">[T; N]</a>])</h4></section></summary><div class="docblock"><p>Splits the slice into a slice of <code>N</code>-element arrays, |
| starting at the end of the slice, |
| and a remainder slice with length strictly less than <code>N</code>.</p> |
| <p>The remainder is meaningful in the division sense. Given |
| <code>let (remainder, chunks) = slice.as_rchunks()</code>, then:</p> |
| <ul> |
| <li><code>remainder.len()</code> equals <code>slice.len() % N</code>,</li> |
| <li><code>chunks.len()</code> equals <code>slice.len() / N</code>, and</li> |
| <li><code>slice.len()</code> equals <code>chunks.len() * N + remainder.len()</code>.</li> |
| </ul> |
| <p>You can flatten the chunks back into a slice-of-<code>T</code> with <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.as_flattened" title="method slice::as_flattened"><code>as_flattened</code></a>.</p> |
| <h5 id="panics-4"><a class="doc-anchor" href="#panics-4">§</a>Panics</h5> |
| <p>Panics if <code>N</code> is zero.</p> |
| <p>Note that this check is against a const generic parameter, not a runtime |
| value, and thus a particular monomorphization will either always panic |
| or it will never panic.</p> |
| <h5 id="examples-24"><a class="doc-anchor" href="#examples-24">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="string">'l'</span>, <span class="string">'o'</span>, <span class="string">'r'</span>, <span class="string">'e'</span>, <span class="string">'m'</span>]; |
| <span class="kw">let </span>(remainder, chunks) = slice.as_rchunks(); |
| <span class="macro">assert_eq!</span>(remainder, <span class="kw-2">&</span>[<span class="string">'l'</span>]); |
| <span class="macro">assert_eq!</span>(chunks, <span class="kw-2">&</span>[[<span class="string">'o'</span>, <span class="string">'r'</span>], [<span class="string">'e'</span>, <span class="string">'m'</span>]]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.array_windows" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.94.0">1.94.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#1653-1655">Source</a></span><h4 class="code-header">pub fn <a href="#method.array_windows" class="fn">array_windows</a><const N: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.ArrayWindows.html" title="struct core::slice::iter::ArrayWindows">ArrayWindows</a><'_, T, N> <a href="#" class="tooltip" data-notable-ty="ArrayWindows<'_, T, N>">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns an iterator over overlapping windows of <code>N</code> elements of a slice, |
| starting at the beginning of the slice.</p> |
| <p>This is the const generic equivalent of <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.windows" title="method slice::windows"><code>windows</code></a>.</p> |
| <p>If <code>N</code> is greater than the size of the slice, it will return no windows.</p> |
| <h5 id="panics-5"><a class="doc-anchor" href="#panics-5">§</a>Panics</h5> |
| <p>Panics if <code>N</code> is zero.</p> |
| <p>Note that this check is against a const generic parameter, not a runtime |
| value, and thus a particular monomorphization will either always panic |
| or it will never panic.</p> |
| <h5 id="examples-25"><a class="doc-anchor" href="#examples-25">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>]; |
| <span class="kw">let </span><span class="kw-2">mut </span>iter = slice.array_windows(); |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">0</span>, <span class="number">1</span>]); |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">2</span>]); |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">2</span>, <span class="number">3</span>]); |
| <span class="macro">assert!</span>(iter.next().is_none());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.rchunks" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.31.0">1.31.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#1695">Source</a></span><h4 class="code-header">pub fn <a href="#method.rchunks" class="fn">rchunks</a>(&self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.RChunks.html" title="struct core::slice::iter::RChunks">RChunks</a><'_, T> <a href="#" class="tooltip" data-notable-ty="RChunks<'_, T>">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns an iterator over <code>chunk_size</code> elements of the slice at a time, starting at the end |
| of the slice.</p> |
| <p>The chunks are slices and do not overlap. If <code>chunk_size</code> does not divide the length of the |
| slice, then the last chunk will not have length <code>chunk_size</code>.</p> |
| <p>See <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.rchunks_exact" title="method slice::rchunks_exact"><code>rchunks_exact</code></a> for a variant of this iterator that returns chunks of always exactly |
| <code>chunk_size</code> elements, and <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.chunks" title="method slice::chunks"><code>chunks</code></a> for the same iterator but starting at the beginning |
| of the slice.</p> |
| <p>If your <code>chunk_size</code> is a constant, consider using <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.as_rchunks" title="method slice::as_rchunks"><code>as_rchunks</code></a> instead, which will |
| give references to arrays of exactly that length, rather than slices.</p> |
| <h5 id="panics-6"><a class="doc-anchor" href="#panics-6">§</a>Panics</h5> |
| <p>Panics if <code>chunk_size</code> is zero.</p> |
| <h5 id="examples-26"><a class="doc-anchor" href="#examples-26">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="string">'l'</span>, <span class="string">'o'</span>, <span class="string">'r'</span>, <span class="string">'e'</span>, <span class="string">'m'</span>]; |
| <span class="kw">let </span><span class="kw-2">mut </span>iter = slice.rchunks(<span class="number">2</span>); |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'e'</span>, <span class="string">'m'</span>]); |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'o'</span>, <span class="string">'r'</span>]); |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'l'</span>]); |
| <span class="macro">assert!</span>(iter.next().is_none());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.rchunks_exact" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.31.0">1.31.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#1784">Source</a></span><h4 class="code-header">pub fn <a href="#method.rchunks_exact" class="fn">rchunks_exact</a>(&self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.RChunksExact.html" title="struct core::slice::iter::RChunksExact">RChunksExact</a><'_, T> <a href="#" class="tooltip" data-notable-ty="RChunksExact<'_, T>">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns an iterator over <code>chunk_size</code> elements of the slice at a time, starting at the |
| end of the slice.</p> |
| <p>The chunks are slices and do not overlap. If <code>chunk_size</code> does not divide the length of the |
| slice, then the last up to <code>chunk_size-1</code> elements will be omitted and can be retrieved |
| from the <code>remainder</code> function of the iterator.</p> |
| <p>Due to each chunk having exactly <code>chunk_size</code> elements, the compiler can often optimize the |
| resulting code better than in the case of <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.rchunks" title="method slice::rchunks"><code>rchunks</code></a>.</p> |
| <p>See <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.rchunks" title="method slice::rchunks"><code>rchunks</code></a> for a variant of this iterator that also returns the remainder as a smaller |
| chunk, and <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.chunks_exact" title="method slice::chunks_exact"><code>chunks_exact</code></a> for the same iterator but starting at the beginning of the |
| slice.</p> |
| <p>If your <code>chunk_size</code> is a constant, consider using <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.as_rchunks" title="method slice::as_rchunks"><code>as_rchunks</code></a> instead, which will |
| give references to arrays of exactly that length, rather than slices.</p> |
| <h5 id="panics-7"><a class="doc-anchor" href="#panics-7">§</a>Panics</h5> |
| <p>Panics if <code>chunk_size</code> is zero.</p> |
| <h5 id="examples-27"><a class="doc-anchor" href="#examples-27">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="string">'l'</span>, <span class="string">'o'</span>, <span class="string">'r'</span>, <span class="string">'e'</span>, <span class="string">'m'</span>]; |
| <span class="kw">let </span><span class="kw-2">mut </span>iter = slice.rchunks_exact(<span class="number">2</span>); |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'e'</span>, <span class="string">'m'</span>]); |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'o'</span>, <span class="string">'r'</span>]); |
| <span class="macro">assert!</span>(iter.next().is_none()); |
| <span class="macro">assert_eq!</span>(iter.remainder(), <span class="kw-2">&</span>[<span class="string">'l'</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.chunk_by" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.77.0">1.77.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#1873-1875">Source</a></span><h4 class="code-header">pub fn <a href="#method.chunk_by" class="fn">chunk_by</a><F>(&self, pred: F) -> <a class="struct" href="https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.ChunkBy.html" title="struct core::slice::iter::ChunkBy">ChunkBy</a><'_, T, F> <a href="#" class="tooltip" data-notable-ty="ChunkBy<'_, T, F>">ⓘ</a><div class="where">where |
| F: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&T</a>, <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Returns an iterator over the slice producing non-overlapping runs |
| of elements using the predicate to separate them.</p> |
| <p>The predicate is called for every pair of consecutive elements, |
| meaning that it is called on <code>slice[0]</code> and <code>slice[1]</code>, |
| followed by <code>slice[1]</code> and <code>slice[2]</code>, and so on.</p> |
| <h5 id="examples-28"><a class="doc-anchor" href="#examples-28">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">3</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">2</span>, <span class="number">2</span>]; |
| |
| <span class="kw">let </span><span class="kw-2">mut </span>iter = slice.chunk_by(|a, b| a == b); |
| |
| <span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>][..])); |
| <span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">3</span>, <span class="number">3</span>][..])); |
| <span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">2</span>, <span class="number">2</span>, <span class="number">2</span>][..])); |
| <span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">None</span>);</code></pre></div> |
| <p>This method can be used to extract the sorted subslices:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]; |
| |
| <span class="kw">let </span><span class="kw-2">mut </span>iter = slice.chunk_by(|a, b| a <= b); |
| |
| <span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>][..])); |
| <span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">2</span>, <span class="number">3</span>][..])); |
| <span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>][..])); |
| <span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">None</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_at" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#1961">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_at" class="fn">split_at</a>(&self, mid: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>) -> (&<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>, &<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>)</h4></section></summary><div class="docblock"><p>Divides one slice into two at an index.</p> |
| <p>The first will contain all indices from <code>[0, mid)</code> (excluding |
| the index <code>mid</code> itself) and the second will contain all |
| indices from <code>[mid, len)</code> (excluding the index <code>len</code> itself).</p> |
| <h5 id="panics-8"><a class="doc-anchor" href="#panics-8">§</a>Panics</h5> |
| <p>Panics if <code>mid > len</code>. For a non-panicking alternative see |
| <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.split_at_checked" title="method slice::split_at_checked"><code>split_at_checked</code></a>.</p> |
| <h5 id="examples-29"><a class="doc-anchor" href="#examples-29">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = [<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>]; |
| |
| { |
| <span class="kw">let </span>(left, right) = v.split_at(<span class="number">0</span>); |
| <span class="macro">assert_eq!</span>(left, []); |
| <span class="macro">assert_eq!</span>(right, [<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>]); |
| } |
| |
| { |
| <span class="kw">let </span>(left, right) = v.split_at(<span class="number">2</span>); |
| <span class="macro">assert_eq!</span>(left, [<span class="string">'a'</span>, <span class="string">'b'</span>]); |
| <span class="macro">assert_eq!</span>(right, [<span class="string">'c'</span>]); |
| } |
| |
| { |
| <span class="kw">let </span>(left, right) = v.split_at(<span class="number">3</span>); |
| <span class="macro">assert_eq!</span>(left, [<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>]); |
| <span class="macro">assert_eq!</span>(right, []); |
| }</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_at_unchecked" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.79.0">1.79.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#2047">Source</a></span><h4 class="code-header">pub unsafe fn <a href="#method.split_at_unchecked" class="fn">split_at_unchecked</a>(&self, mid: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>) -> (&<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>, &<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>)</h4></section></summary><div class="docblock"><p>Divides one slice into two at an index, without doing bounds checking.</p> |
| <p>The first will contain all indices from <code>[0, mid)</code> (excluding |
| the index <code>mid</code> itself) and the second will contain all |
| indices from <code>[mid, len)</code> (excluding the index <code>len</code> itself).</p> |
| <p>For a safe alternative see <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.split_at" title="method slice::split_at"><code>split_at</code></a>.</p> |
| <h5 id="safety-4"><a class="doc-anchor" href="#safety-4">§</a>Safety</h5> |
| <p>Calling this method with an out-of-bounds index is <em><a href="https://doc.rust-lang.org/reference/behavior-considered-undefined.html">undefined behavior</a></em> |
| even if the resulting reference is not used. The caller has to ensure that |
| <code>0 <= mid <= self.len()</code>.</p> |
| <h5 id="examples-30"><a class="doc-anchor" href="#examples-30">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = [<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>]; |
| |
| <span class="kw">unsafe </span>{ |
| <span class="kw">let </span>(left, right) = v.split_at_unchecked(<span class="number">0</span>); |
| <span class="macro">assert_eq!</span>(left, []); |
| <span class="macro">assert_eq!</span>(right, [<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>]); |
| } |
| |
| <span class="kw">unsafe </span>{ |
| <span class="kw">let </span>(left, right) = v.split_at_unchecked(<span class="number">2</span>); |
| <span class="macro">assert_eq!</span>(left, [<span class="string">'a'</span>, <span class="string">'b'</span>]); |
| <span class="macro">assert_eq!</span>(right, [<span class="string">'c'</span>]); |
| } |
| |
| <span class="kw">unsafe </span>{ |
| <span class="kw">let </span>(left, right) = v.split_at_unchecked(<span class="number">3</span>); |
| <span class="macro">assert_eq!</span>(left, [<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>]); |
| <span class="macro">assert_eq!</span>(right, []); |
| }</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_at_checked" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.80.0">1.80.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#2162">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_at_checked" class="fn">split_at_checked</a>(&self, mid: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><(&<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>, &<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>)></h4></section></summary><div class="docblock"><p>Divides one slice into two at an index, returning <code>None</code> if the slice is |
| too short.</p> |
| <p>If <code>mid ≤ len</code> returns a pair of slices where the first will contain all |
| indices from <code>[0, mid)</code> (excluding the index <code>mid</code> itself) and the |
| second will contain all indices from <code>[mid, len)</code> (excluding the index |
| <code>len</code> itself).</p> |
| <p>Otherwise, if <code>mid > len</code>, returns <code>None</code>.</p> |
| <h5 id="examples-31"><a class="doc-anchor" href="#examples-31">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = [<span class="number">1</span>, -<span class="number">2</span>, <span class="number">3</span>, -<span class="number">4</span>, <span class="number">5</span>, -<span class="number">6</span>]; |
| |
| { |
| <span class="kw">let </span>(left, right) = v.split_at_checked(<span class="number">0</span>).unwrap(); |
| <span class="macro">assert_eq!</span>(left, []); |
| <span class="macro">assert_eq!</span>(right, [<span class="number">1</span>, -<span class="number">2</span>, <span class="number">3</span>, -<span class="number">4</span>, <span class="number">5</span>, -<span class="number">6</span>]); |
| } |
| |
| { |
| <span class="kw">let </span>(left, right) = v.split_at_checked(<span class="number">2</span>).unwrap(); |
| <span class="macro">assert_eq!</span>(left, [<span class="number">1</span>, -<span class="number">2</span>]); |
| <span class="macro">assert_eq!</span>(right, [<span class="number">3</span>, -<span class="number">4</span>, <span class="number">5</span>, -<span class="number">6</span>]); |
| } |
| |
| { |
| <span class="kw">let </span>(left, right) = v.split_at_checked(<span class="number">6</span>).unwrap(); |
| <span class="macro">assert_eq!</span>(left, [<span class="number">1</span>, -<span class="number">2</span>, <span class="number">3</span>, -<span class="number">4</span>, <span class="number">5</span>, -<span class="number">6</span>]); |
| <span class="macro">assert_eq!</span>(right, []); |
| } |
| |
| <span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, v.split_at_checked(<span class="number">7</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#2253-2255">Source</a></span><h4 class="code-header">pub fn <a href="#method.split" class="fn">split</a><F>(&self, pred: F) -> <a class="struct" href="https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.Split.html" title="struct core::slice::iter::Split">Split</a><'_, T, F> <a href="#" class="tooltip" data-notable-ty="Split<'_, T, F>">ⓘ</a><div class="where">where |
| F: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Returns an iterator over subslices separated by elements that match |
| <code>pred</code>. The matched element is not contained in the subslices.</p> |
| <h5 id="examples-32"><a class="doc-anchor" href="#examples-32">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">33</span>, <span class="number">20</span>]; |
| <span class="kw">let </span><span class="kw-2">mut </span>iter = slice.split(|num| num % <span class="number">3 </span>== <span class="number">0</span>); |
| |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>]); |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">20</span>]); |
| <span class="macro">assert!</span>(iter.next().is_none());</code></pre></div> |
| <p>If the first element is matched, an empty slice will be the first item |
| returned by the iterator. Similarly, if the last element in the slice |
| is matched, an empty slice will be the last item returned by the |
| iterator:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">33</span>]; |
| <span class="kw">let </span><span class="kw-2">mut </span>iter = slice.split(|num| num % <span class="number">3 </span>== <span class="number">0</span>); |
| |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>]); |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[]); |
| <span class="macro">assert!</span>(iter.next().is_none());</code></pre></div> |
| <p>If two matched elements are directly adjacent, an empty slice will be |
| present between them:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="number">10</span>, <span class="number">6</span>, <span class="number">33</span>, <span class="number">20</span>]; |
| <span class="kw">let </span><span class="kw-2">mut </span>iter = slice.split(|num| num % <span class="number">3 </span>== <span class="number">0</span>); |
| |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">10</span>]); |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[]); |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">20</span>]); |
| <span class="macro">assert!</span>(iter.next().is_none());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_inclusive" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.51.0">1.51.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#2311-2313">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_inclusive" class="fn">split_inclusive</a><F>(&self, pred: F) -> <a class="struct" href="https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.SplitInclusive.html" title="struct core::slice::iter::SplitInclusive">SplitInclusive</a><'_, T, F> <a href="#" class="tooltip" data-notable-ty="SplitInclusive<'_, T, F>">ⓘ</a><div class="where">where |
| F: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Returns an iterator over subslices separated by elements that match |
| <code>pred</code>. The matched element is contained in the end of the previous |
| subslice as a terminator.</p> |
| <h5 id="examples-33"><a class="doc-anchor" href="#examples-33">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">33</span>, <span class="number">20</span>]; |
| <span class="kw">let </span><span class="kw-2">mut </span>iter = slice.split_inclusive(|num| num % <span class="number">3 </span>== <span class="number">0</span>); |
| |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">33</span>]); |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">20</span>]); |
| <span class="macro">assert!</span>(iter.next().is_none());</code></pre></div> |
| <p>If the last element of the slice is matched, |
| that element will be considered the terminator of the preceding slice. |
| That slice will be the last item returned by the iterator.</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="number">3</span>, <span class="number">10</span>, <span class="number">40</span>, <span class="number">33</span>]; |
| <span class="kw">let </span><span class="kw-2">mut </span>iter = slice.split_inclusive(|num| num % <span class="number">3 </span>== <span class="number">0</span>); |
| |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">3</span>]); |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">33</span>]); |
| <span class="macro">assert!</span>(iter.next().is_none());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.rsplit" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.27.0">1.27.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#2371-2373">Source</a></span><h4 class="code-header">pub fn <a href="#method.rsplit" class="fn">rsplit</a><F>(&self, pred: F) -> <a class="struct" href="https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.RSplit.html" title="struct core::slice::iter::RSplit">RSplit</a><'_, T, F> <a href="#" class="tooltip" data-notable-ty="RSplit<'_, T, F>">ⓘ</a><div class="where">where |
| F: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Returns an iterator over subslices separated by elements that match |
| <code>pred</code>, starting at the end of the slice and working backwards. |
| The matched element is not contained in the subslices.</p> |
| <h5 id="examples-34"><a class="doc-anchor" href="#examples-34">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="number">11</span>, <span class="number">22</span>, <span class="number">33</span>, <span class="number">0</span>, <span class="number">44</span>, <span class="number">55</span>]; |
| <span class="kw">let </span><span class="kw-2">mut </span>iter = slice.rsplit(|num| <span class="kw-2">*</span>num == <span class="number">0</span>); |
| |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">44</span>, <span class="number">55</span>]); |
| <span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">11</span>, <span class="number">22</span>, <span class="number">33</span>]); |
| <span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">None</span>);</code></pre></div> |
| <p>As with <code>split()</code>, if the first or last element is matched, an empty |
| slice will be the first (or last) item returned by the iterator.</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = <span class="kw-2">&</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">8</span>]; |
| <span class="kw">let </span><span class="kw-2">mut </span>it = v.rsplit(|n| <span class="kw-2">*</span>n % <span class="number">2 </span>== <span class="number">0</span>); |
| <span class="macro">assert_eq!</span>(it.next().unwrap(), <span class="kw-2">&</span>[]); |
| <span class="macro">assert_eq!</span>(it.next().unwrap(), <span class="kw-2">&</span>[<span class="number">3</span>, <span class="number">5</span>]); |
| <span class="macro">assert_eq!</span>(it.next().unwrap(), <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">1</span>]); |
| <span class="macro">assert_eq!</span>(it.next().unwrap(), <span class="kw-2">&</span>[]); |
| <span class="macro">assert_eq!</span>(it.next(), <span class="prelude-val">None</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.splitn" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#2425-2427">Source</a></span><h4 class="code-header">pub fn <a href="#method.splitn" class="fn">splitn</a><F>(&self, n: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>, pred: F) -> <a class="struct" href="https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.SplitN.html" title="struct core::slice::iter::SplitN">SplitN</a><'_, T, F> <a href="#" class="tooltip" data-notable-ty="SplitN<'_, T, F>">ⓘ</a><div class="where">where |
| F: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Returns an iterator over subslices separated by elements that match |
| <code>pred</code>, limited to returning at most <code>n</code> items. The matched element is |
| not contained in the subslices.</p> |
| <p>The last element returned, if any, will contain the remainder of the |
| slice.</p> |
| <h5 id="examples-35"><a class="doc-anchor" href="#examples-35">§</a>Examples</h5> |
| <p>Print the slice split once by numbers divisible by 3 (i.e., <code>[10, 40]</code>, |
| <code>[20, 60, 50]</code>):</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>, <span class="number">20</span>, <span class="number">60</span>, <span class="number">50</span>]; |
| |
| <span class="kw">for </span>group <span class="kw">in </span>v.splitn(<span class="number">2</span>, |num| <span class="kw-2">*</span>num % <span class="number">3 </span>== <span class="number">0</span>) { |
| <span class="macro">println!</span>(<span class="string">"{group:?}"</span>); |
| }</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.rsplitn" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#2480-2482">Source</a></span><h4 class="code-header">pub fn <a href="#method.rsplitn" class="fn">rsplitn</a><F>(&self, n: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>, pred: F) -> <a class="struct" href="https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.RSplitN.html" title="struct core::slice::iter::RSplitN">RSplitN</a><'_, T, F> <a href="#" class="tooltip" data-notable-ty="RSplitN<'_, T, F>">ⓘ</a><div class="where">where |
| F: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Returns an iterator over subslices separated by elements that match |
| <code>pred</code> limited to returning at most <code>n</code> items. This starts at the end of |
| the slice and works backwards. The matched element is not contained in |
| the subslices.</p> |
| <p>The last element returned, if any, will contain the remainder of the |
| slice.</p> |
| <h5 id="examples-36"><a class="doc-anchor" href="#examples-36">§</a>Examples</h5> |
| <p>Print the slice split once, starting from the end, by numbers divisible |
| by 3 (i.e., <code>[50]</code>, <code>[10, 40, 30, 20]</code>):</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>, <span class="number">20</span>, <span class="number">60</span>, <span class="number">50</span>]; |
| |
| <span class="kw">for </span>group <span class="kw">in </span>v.rsplitn(<span class="number">2</span>, |num| <span class="kw-2">*</span>num % <span class="number">3 </span>== <span class="number">0</span>) { |
| <span class="macro">println!</span>(<span class="string">"{group:?}"</span>); |
| }</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_once" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#2534-2536">Source</a><h4 class="code-header">pub fn <a href="#method.split_once" class="fn">split_once</a><F>(&self, pred: F) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><(&<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>, &<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>)><div class="where">where |
| F: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a>,</div></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_split_once</code>)</span></div></span></summary><div class="docblock"><p>Splits the slice on the first element that matches the specified |
| predicate.</p> |
| <p>If any matching elements are present in the slice, returns the prefix |
| before the match and suffix after. The matching element itself is not |
| included. If no elements match, returns <code>None</code>.</p> |
| <h5 id="examples-37"><a class="doc-anchor" href="#examples-37">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(slice_split_once)] |
| </span><span class="kw">let </span>s = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">4</span>]; |
| <span class="macro">assert_eq!</span>(s.split_once(|<span class="kw-2">&</span>x| x == <span class="number">2</span>), <span class="prelude-val">Some</span>(( |
| <span class="kw-2">&</span>[<span class="number">1</span>][..], |
| <span class="kw-2">&</span>[<span class="number">3</span>, <span class="number">2</span>, <span class="number">4</span>][..] |
| ))); |
| <span class="macro">assert_eq!</span>(s.split_once(|<span class="kw-2">&</span>x| x == <span class="number">0</span>), <span class="prelude-val">None</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.rsplit_once" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#2563-2565">Source</a><h4 class="code-header">pub fn <a href="#method.rsplit_once" class="fn">rsplit_once</a><F>(&self, pred: F) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><(&<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>, &<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>)><div class="where">where |
| F: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a>,</div></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_split_once</code>)</span></div></span></summary><div class="docblock"><p>Splits the slice on the last element that matches the specified |
| predicate.</p> |
| <p>If any matching elements are present in the slice, returns the prefix |
| before the match and suffix after. The matching element itself is not |
| included. If no elements match, returns <code>None</code>.</p> |
| <h5 id="examples-38"><a class="doc-anchor" href="#examples-38">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(slice_split_once)] |
| </span><span class="kw">let </span>s = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">4</span>]; |
| <span class="macro">assert_eq!</span>(s.rsplit_once(|<span class="kw-2">&</span>x| x == <span class="number">2</span>), <span class="prelude-val">Some</span>(( |
| <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>][..], |
| <span class="kw-2">&</span>[<span class="number">4</span>][..] |
| ))); |
| <span class="macro">assert_eq!</span>(s.rsplit_once(|<span class="kw-2">&</span>x| x == <span class="number">0</span>), <span class="prelude-val">None</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.contains" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#2600-2602">Source</a></span><h4 class="code-header">pub fn <a href="#method.contains" class="fn">contains</a>(&self, x: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a><div class="where">where |
| T: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>,</div></h4></section></summary><div class="docblock"><p>Returns <code>true</code> if the slice contains an element with the given value.</p> |
| <p>This operation is <em>O</em>(<em>n</em>).</p> |
| <p>Note that if you have a sorted slice, <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.binary_search" title="method slice::binary_search"><code>binary_search</code></a> may be faster.</p> |
| <h5 id="examples-39"><a class="doc-anchor" href="#examples-39">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>]; |
| <span class="macro">assert!</span>(v.contains(<span class="kw-2">&</span><span class="number">30</span>)); |
| <span class="macro">assert!</span>(!v.contains(<span class="kw-2">&</span><span class="number">50</span>));</code></pre></div> |
| <p>If you do not have a <code>&T</code>, but some other value that you can compare |
| with one (for example, <code>String</code> implements <code>PartialEq<str></code>), you can |
| use <code>iter().any</code>:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = [String::from(<span class="string">"hello"</span>), String::from(<span class="string">"world"</span>)]; <span class="comment">// slice of `String` |
| </span><span class="macro">assert!</span>(v.iter().any(|e| e == <span class="string">"hello"</span>)); <span class="comment">// search with `&str` |
| </span><span class="macro">assert!</span>(!v.iter().any(|e| e == <span class="string">"hi"</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.starts_with" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#2630-2632">Source</a></span><h4 class="code-header">pub fn <a href="#method.starts_with" class="fn">starts_with</a>(&self, needle: &<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a><div class="where">where |
| T: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>,</div></h4></section></summary><div class="docblock"><p>Returns <code>true</code> if <code>needle</code> is a prefix of the slice or equal to the slice.</p> |
| <h5 id="examples-40"><a class="doc-anchor" href="#examples-40">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>]; |
| <span class="macro">assert!</span>(v.starts_with(<span class="kw-2">&</span>[<span class="number">10</span>])); |
| <span class="macro">assert!</span>(v.starts_with(<span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>])); |
| <span class="macro">assert!</span>(v.starts_with(<span class="kw-2">&</span>v)); |
| <span class="macro">assert!</span>(!v.starts_with(<span class="kw-2">&</span>[<span class="number">50</span>])); |
| <span class="macro">assert!</span>(!v.starts_with(<span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">50</span>]));</code></pre></div> |
| <p>Always returns <code>true</code> if <code>needle</code> is an empty slice:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = <span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>]; |
| <span class="macro">assert!</span>(v.starts_with(<span class="kw-2">&</span>[])); |
| <span class="kw">let </span>v: <span class="kw-2">&</span>[u8] = <span class="kw-2">&</span>[]; |
| <span class="macro">assert!</span>(v.starts_with(<span class="kw-2">&</span>[]));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.ends_with" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#2661-2663">Source</a></span><h4 class="code-header">pub fn <a href="#method.ends_with" class="fn">ends_with</a>(&self, needle: &<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a><div class="where">where |
| T: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>,</div></h4></section></summary><div class="docblock"><p>Returns <code>true</code> if <code>needle</code> is a suffix of the slice or equal to the slice.</p> |
| <h5 id="examples-41"><a class="doc-anchor" href="#examples-41">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>]; |
| <span class="macro">assert!</span>(v.ends_with(<span class="kw-2">&</span>[<span class="number">30</span>])); |
| <span class="macro">assert!</span>(v.ends_with(<span class="kw-2">&</span>[<span class="number">40</span>, <span class="number">30</span>])); |
| <span class="macro">assert!</span>(v.ends_with(<span class="kw-2">&</span>v)); |
| <span class="macro">assert!</span>(!v.ends_with(<span class="kw-2">&</span>[<span class="number">50</span>])); |
| <span class="macro">assert!</span>(!v.ends_with(<span class="kw-2">&</span>[<span class="number">50</span>, <span class="number">30</span>]));</code></pre></div> |
| <p>Always returns <code>true</code> if <code>needle</code> is an empty slice:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = <span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>]; |
| <span class="macro">assert!</span>(v.ends_with(<span class="kw-2">&</span>[])); |
| <span class="kw">let </span>v: <span class="kw-2">&</span>[u8] = <span class="kw-2">&</span>[]; |
| <span class="macro">assert!</span>(v.ends_with(<span class="kw-2">&</span>[]));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.strip_prefix" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.51.0">1.51.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#2693-2695">Source</a></span><h4 class="code-header">pub fn <a href="#method.strip_prefix" class="fn">strip_prefix</a><P>(&self, prefix: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&P</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>><div class="where">where |
| P: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/slice/trait.SlicePattern.html" title="trait core::slice::SlicePattern">SlicePattern</a><Item = T> + ?<a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, |
| T: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>,</div></h4></section></summary><div class="docblock"><p>Returns a subslice with the prefix removed.</p> |
| <p>If the slice starts with <code>prefix</code>, returns the subslice after the prefix, wrapped in <code>Some</code>. |
| If <code>prefix</code> is empty, simply returns the original slice. If <code>prefix</code> is equal to the |
| original slice, returns an empty slice.</p> |
| <p>If the slice does not start with <code>prefix</code>, returns <code>None</code>.</p> |
| <h5 id="examples-42"><a class="doc-anchor" href="#examples-42">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = <span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>]; |
| <span class="macro">assert_eq!</span>(v.strip_prefix(<span class="kw-2">&</span>[<span class="number">10</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">40</span>, <span class="number">30</span>][..])); |
| <span class="macro">assert_eq!</span>(v.strip_prefix(<span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">30</span>][..])); |
| <span class="macro">assert_eq!</span>(v.strip_prefix(<span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>[][..])); |
| <span class="macro">assert_eq!</span>(v.strip_prefix(<span class="kw-2">&</span>[<span class="number">50</span>]), <span class="prelude-val">None</span>); |
| <span class="macro">assert_eq!</span>(v.strip_prefix(<span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">50</span>]), <span class="prelude-val">None</span>); |
| |
| <span class="kw">let </span>prefix : <span class="kw-2">&</span>str = <span class="string">"he"</span>; |
| <span class="macro">assert_eq!</span>(<span class="string">b"hello"</span>.strip_prefix(prefix.as_bytes()), |
| <span class="prelude-val">Some</span>(<span class="string">b"llo"</span>.as_ref()));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.strip_suffix" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.51.0">1.51.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#2729-2731">Source</a></span><h4 class="code-header">pub fn <a href="#method.strip_suffix" class="fn">strip_suffix</a><P>(&self, suffix: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&P</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>><div class="where">where |
| P: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/slice/trait.SlicePattern.html" title="trait core::slice::SlicePattern">SlicePattern</a><Item = T> + ?<a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, |
| T: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>,</div></h4></section></summary><div class="docblock"><p>Returns a subslice with the suffix removed.</p> |
| <p>If the slice ends with <code>suffix</code>, returns the subslice before the suffix, wrapped in <code>Some</code>. |
| If <code>suffix</code> is empty, simply returns the original slice. If <code>suffix</code> is equal to the |
| original slice, returns an empty slice.</p> |
| <p>If the slice does not end with <code>suffix</code>, returns <code>None</code>.</p> |
| <h5 id="examples-43"><a class="doc-anchor" href="#examples-43">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = <span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>]; |
| <span class="macro">assert_eq!</span>(v.strip_suffix(<span class="kw-2">&</span>[<span class="number">30</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>][..])); |
| <span class="macro">assert_eq!</span>(v.strip_suffix(<span class="kw-2">&</span>[<span class="number">40</span>, <span class="number">30</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">10</span>][..])); |
| <span class="macro">assert_eq!</span>(v.strip_suffix(<span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>[][..])); |
| <span class="macro">assert_eq!</span>(v.strip_suffix(<span class="kw-2">&</span>[<span class="number">50</span>]), <span class="prelude-val">None</span>); |
| <span class="macro">assert_eq!</span>(v.strip_suffix(<span class="kw-2">&</span>[<span class="number">50</span>, <span class="number">30</span>]), <span class="prelude-val">None</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.strip_circumfix" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.98.0">1.98.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#2769-2773">Source</a></span><h4 class="code-header">pub fn <a href="#method.strip_circumfix" class="fn">strip_circumfix</a><S, P>(&self, prefix: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&P</a>, suffix: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&S</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>><div class="where">where |
| T: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>, |
| S: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/slice/trait.SlicePattern.html" title="trait core::slice::SlicePattern">SlicePattern</a><Item = T> + ?<a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, |
| P: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/slice/trait.SlicePattern.html" title="trait core::slice::SlicePattern">SlicePattern</a><Item = T> + ?<a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Returns a subslice with the prefix and suffix removed.</p> |
| <p>If the slice starts with <code>prefix</code>, ends with <code>suffix</code>, and |
| the prefix and suffix don’t overlap, returns the subslice after |
| the prefix and before the suffix, wrapped in <code>Some</code>.</p> |
| <p>If the slice does not start with <code>prefix</code>, does not end with <code>suffix</code>, |
| or the prefix and suffix overlap in the slice, returns <code>None</code>.</p> |
| <h5 id="examples-44"><a class="doc-anchor" href="#examples-44">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = <span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">50</span>, <span class="number">40</span>, <span class="number">30</span>]; |
| <span class="macro">assert_eq!</span>(v.strip_circumfix(<span class="kw-2">&</span>[<span class="number">10</span>], <span class="kw-2">&</span>[<span class="number">30</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">50</span>, <span class="number">40</span>][..])); |
| <span class="macro">assert_eq!</span>(v.strip_circumfix(<span class="kw-2">&</span>[<span class="number">10</span>], <span class="kw-2">&</span>[<span class="number">40</span>, <span class="number">30</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">50</span>][..])); |
| <span class="macro">assert_eq!</span>(v.strip_circumfix(<span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">50</span>], <span class="kw-2">&</span>[<span class="number">40</span>, <span class="number">30</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>[][..])); |
| <span class="macro">assert_eq!</span>(v.strip_circumfix(<span class="kw-2">&</span>[<span class="number">50</span>], <span class="kw-2">&</span>[<span class="number">30</span>]), <span class="prelude-val">None</span>); |
| <span class="macro">assert_eq!</span>(v.strip_circumfix(<span class="kw-2">&</span>[<span class="number">10</span>], <span class="kw-2">&</span>[<span class="number">40</span>]), <span class="prelude-val">None</span>); |
| <span class="macro">assert_eq!</span>(v.strip_circumfix(<span class="kw-2">&</span>[], <span class="kw-2">&</span>[<span class="number">40</span>, <span class="number">30</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">50</span>][..])); |
| <span class="macro">assert_eq!</span>(v.strip_circumfix(<span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">50</span>], <span class="kw-2">&</span>[]), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">40</span>, <span class="number">30</span>][..])); |
| <span class="macro">assert_eq!</span>(v.strip_circumfix(<span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">50</span>, <span class="number">40</span>], <span class="kw-2">&</span>[<span class="number">50</span>, <span class="number">40</span>, <span class="number">30</span>]), <span class="prelude-val">None</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.trim_prefix" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#2805-2807">Source</a><h4 class="code-header">pub fn <a href="#method.trim_prefix" class="fn">trim_prefix</a><P>(&self, prefix: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&P</a>) -> &<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a><div class="where">where |
| P: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/slice/trait.SlicePattern.html" title="trait core::slice::SlicePattern">SlicePattern</a><Item = T> + ?<a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, |
| T: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>,</div></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>trim_prefix_suffix</code>)</span></div></span></summary><div class="docblock"><p>Returns a subslice with the optional prefix removed.</p> |
| <p>If the slice starts with <code>prefix</code>, returns the subslice after the prefix. If <code>prefix</code> |
| is empty or the slice does not start with <code>prefix</code>, simply returns the original slice. |
| If <code>prefix</code> is equal to the original slice, returns an empty slice.</p> |
| <h5 id="examples-45"><a class="doc-anchor" href="#examples-45">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(trim_prefix_suffix)] |
| |
| </span><span class="kw">let </span>v = <span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>]; |
| |
| <span class="comment">// Prefix present - removes it |
| </span><span class="macro">assert_eq!</span>(v.trim_prefix(<span class="kw-2">&</span>[<span class="number">10</span>]), <span class="kw-2">&</span>[<span class="number">40</span>, <span class="number">30</span>][..]); |
| <span class="macro">assert_eq!</span>(v.trim_prefix(<span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>]), <span class="kw-2">&</span>[<span class="number">30</span>][..]); |
| <span class="macro">assert_eq!</span>(v.trim_prefix(<span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>]), <span class="kw-2">&</span>[][..]); |
| |
| <span class="comment">// Prefix absent - returns original slice |
| </span><span class="macro">assert_eq!</span>(v.trim_prefix(<span class="kw-2">&</span>[<span class="number">50</span>]), <span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>][..]); |
| <span class="macro">assert_eq!</span>(v.trim_prefix(<span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">50</span>]), <span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>][..]); |
| |
| <span class="kw">let </span>prefix : <span class="kw-2">&</span>str = <span class="string">"he"</span>; |
| <span class="macro">assert_eq!</span>(<span class="string">b"hello"</span>.trim_prefix(prefix.as_bytes()), <span class="string">b"llo"</span>.as_ref());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.trim_suffix" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#2845-2847">Source</a><h4 class="code-header">pub fn <a href="#method.trim_suffix" class="fn">trim_suffix</a><P>(&self, suffix: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&P</a>) -> &<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a><div class="where">where |
| P: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/slice/trait.SlicePattern.html" title="trait core::slice::SlicePattern">SlicePattern</a><Item = T> + ?<a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, |
| T: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>,</div></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>trim_prefix_suffix</code>)</span></div></span></summary><div class="docblock"><p>Returns a subslice with the optional suffix removed.</p> |
| <p>If the slice ends with <code>suffix</code>, returns the subslice before the suffix. If <code>suffix</code> |
| is empty or the slice does not end with <code>suffix</code>, simply returns the original slice. |
| If <code>suffix</code> is equal to the original slice, returns an empty slice.</p> |
| <h5 id="examples-46"><a class="doc-anchor" href="#examples-46">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(trim_prefix_suffix)] |
| |
| </span><span class="kw">let </span>v = <span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>]; |
| |
| <span class="comment">// Suffix present - removes it |
| </span><span class="macro">assert_eq!</span>(v.trim_suffix(<span class="kw-2">&</span>[<span class="number">30</span>]), <span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>][..]); |
| <span class="macro">assert_eq!</span>(v.trim_suffix(<span class="kw-2">&</span>[<span class="number">40</span>, <span class="number">30</span>]), <span class="kw-2">&</span>[<span class="number">10</span>][..]); |
| <span class="macro">assert_eq!</span>(v.trim_suffix(<span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>]), <span class="kw-2">&</span>[][..]); |
| |
| <span class="comment">// Suffix absent - returns original slice |
| </span><span class="macro">assert_eq!</span>(v.trim_suffix(<span class="kw-2">&</span>[<span class="number">50</span>]), <span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>][..]); |
| <span class="macro">assert_eq!</span>(v.trim_suffix(<span class="kw-2">&</span>[<span class="number">50</span>, <span class="number">30</span>]), <span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>][..]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.binary_search" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#2932-2934">Source</a></span><h4 class="code-header">pub fn <a href="#method.binary_search" class="fn">binary_search</a>(&self, x: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&T</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>><div class="where">where |
| T: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h4></section></summary><div class="docblock"><p>Binary searches this slice for a given element. |
| If the slice is not sorted, the returned result is unspecified and |
| meaningless.</p> |
| <p>If the value is found then <a href="https://doc.rust-lang.org/1.99.1/core/result/enum.Result.html#variant.Ok" title="variant core::result::Result::Ok"><code>Result::Ok</code></a> is returned, containing the |
| index of the matching element. If there are multiple matches, then any |
| one of the matches could be returned. The index is chosen |
| deterministically, but is subject to change in future versions of Rust. |
| If the value is not found then <a href="https://doc.rust-lang.org/1.99.1/core/result/enum.Result.html#variant.Err" title="variant core::result::Result::Err"><code>Result::Err</code></a> is returned, containing |
| the index where a matching element could be inserted while maintaining |
| sorted order.</p> |
| <p>See also <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.binary_search_by" title="method slice::binary_search_by"><code>binary_search_by</code></a>, <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.binary_search_by_key" title="method slice::binary_search_by_key"><code>binary_search_by_key</code></a>, and <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.partition_point" title="method slice::partition_point"><code>partition_point</code></a>.</p> |
| <h5 id="examples-47"><a class="doc-anchor" href="#examples-47">§</a>Examples</h5> |
| <p>Looks up a series of four elements. The first is found, with a |
| uniquely determined position; the second and third are not |
| found; the fourth could match any position in <code>[1, 4]</code>.</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>s = [<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">8</span>, <span class="number">13</span>, <span class="number">21</span>, <span class="number">34</span>, <span class="number">55</span>]; |
| |
| <span class="macro">assert_eq!</span>(s.binary_search(<span class="kw-2">&</span><span class="number">13</span>), <span class="prelude-val">Ok</span>(<span class="number">9</span>)); |
| <span class="macro">assert_eq!</span>(s.binary_search(<span class="kw-2">&</span><span class="number">4</span>), <span class="prelude-val">Err</span>(<span class="number">7</span>)); |
| <span class="macro">assert_eq!</span>(s.binary_search(<span class="kw-2">&</span><span class="number">100</span>), <span class="prelude-val">Err</span>(<span class="number">13</span>)); |
| <span class="kw">let </span>r = s.binary_search(<span class="kw-2">&</span><span class="number">1</span>); |
| <span class="macro">assert!</span>(<span class="kw">match </span>r { <span class="prelude-val">Ok</span>(<span class="number">1</span>..=<span class="number">4</span>) => <span class="bool-val">true</span>, <span class="kw">_ </span>=> <span class="bool-val">false</span>, });</code></pre></div> |
| <p>If you want to find that whole <em>range</em> of matching items, rather than |
| an arbitrary matching one, that can be done using <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.partition_point" title="method slice::partition_point"><code>partition_point</code></a>:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>s = [<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">8</span>, <span class="number">13</span>, <span class="number">21</span>, <span class="number">34</span>, <span class="number">55</span>]; |
| |
| <span class="kw">let </span>low = s.partition_point(|x| x < <span class="kw-2">&</span><span class="number">1</span>); |
| <span class="macro">assert_eq!</span>(low, <span class="number">1</span>); |
| <span class="kw">let </span>high = s.partition_point(|x| x <= <span class="kw-2">&</span><span class="number">1</span>); |
| <span class="macro">assert_eq!</span>(high, <span class="number">5</span>); |
| <span class="kw">let </span>r = s.binary_search(<span class="kw-2">&</span><span class="number">1</span>); |
| <span class="macro">assert!</span>((low..high).contains(<span class="kw-2">&</span>r.unwrap())); |
| |
| <span class="macro">assert!</span>(s[..low].iter().all(|<span class="kw-2">&</span>x| x < <span class="number">1</span>)); |
| <span class="macro">assert!</span>(s[low..high].iter().all(|<span class="kw-2">&</span>x| x == <span class="number">1</span>)); |
| <span class="macro">assert!</span>(s[high..].iter().all(|<span class="kw-2">&</span>x| x > <span class="number">1</span>)); |
| |
| <span class="comment">// For something not found, the "range" of equal items is empty |
| </span><span class="macro">assert_eq!</span>(s.partition_point(|x| x < <span class="kw-2">&</span><span class="number">11</span>), <span class="number">9</span>); |
| <span class="macro">assert_eq!</span>(s.partition_point(|x| x <= <span class="kw-2">&</span><span class="number">11</span>), <span class="number">9</span>); |
| <span class="macro">assert_eq!</span>(s.binary_search(<span class="kw-2">&</span><span class="number">11</span>), <span class="prelude-val">Err</span>(<span class="number">9</span>));</code></pre></div> |
| <p>If you want to insert an item to a sorted vector, while maintaining |
| sort order, consider using <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.partition_point" title="method slice::partition_point"><code>partition_point</code></a>:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>s = <span class="macro">vec!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">8</span>, <span class="number">13</span>, <span class="number">21</span>, <span class="number">34</span>, <span class="number">55</span>]; |
| <span class="kw">let </span>num = <span class="number">42</span>; |
| <span class="kw">let </span>idx = s.partition_point(|<span class="kw-2">&</span>x| x <= num); |
| <span class="comment">// If `num` is unique, `s.partition_point(|&x| x < num)` (with `<`) is equivalent to |
| // `s.binary_search(&num).unwrap_or_else(|x| x)`, but using `<=` will allow `insert` |
| // to shift less elements. |
| </span>s.insert(idx, num); |
| <span class="macro">assert_eq!</span>(s, [<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">8</span>, <span class="number">13</span>, <span class="number">21</span>, <span class="number">34</span>, <span class="number">42</span>, <span class="number">55</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.binary_search_by" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#2984-2986">Source</a></span><h4 class="code-header">pub fn <a href="#method.binary_search_by" class="fn">binary_search_by</a><'a, F>(&'a self, f: F) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>><div class="where">where |
| F: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&'a T</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>,</div></h4></section></summary><div class="docblock"><p>Binary searches this slice with a comparator function.</p> |
| <p>The comparator function should return an order code that indicates |
| whether its argument is <code>Less</code>, <code>Equal</code> or <code>Greater</code> the desired |
| target. |
| If the slice is not sorted or if the comparator function does not |
| implement an order consistent with the sort order of the underlying |
| slice, the returned result is unspecified and meaningless.</p> |
| <p>If the value is found then <a href="https://doc.rust-lang.org/1.99.1/core/result/enum.Result.html#variant.Ok" title="variant core::result::Result::Ok"><code>Result::Ok</code></a> is returned, containing the |
| index of the matching element. If there are multiple matches, then any |
| one of the matches could be returned. The index is chosen |
| deterministically, but is subject to change in future versions of Rust. |
| If the value is not found then <a href="https://doc.rust-lang.org/1.99.1/core/result/enum.Result.html#variant.Err" title="variant core::result::Result::Err"><code>Result::Err</code></a> is returned, containing |
| the index where a matching element could be inserted while maintaining |
| sorted order.</p> |
| <p>See also <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.binary_search" title="method slice::binary_search"><code>binary_search</code></a>, <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.binary_search_by_key" title="method slice::binary_search_by_key"><code>binary_search_by_key</code></a>, and <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.partition_point" title="method slice::partition_point"><code>partition_point</code></a>.</p> |
| <h5 id="examples-48"><a class="doc-anchor" href="#examples-48">§</a>Examples</h5> |
| <p>Looks up a series of four elements. The first is found, with a |
| uniquely determined position; the second and third are not |
| found; the fourth could match any position in <code>[1, 4]</code>.</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>s = [<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">8</span>, <span class="number">13</span>, <span class="number">21</span>, <span class="number">34</span>, <span class="number">55</span>]; |
| |
| <span class="kw">let </span>seek = <span class="number">13</span>; |
| <span class="macro">assert_eq!</span>(s.binary_search_by(|probe| probe.cmp(<span class="kw-2">&</span>seek)), <span class="prelude-val">Ok</span>(<span class="number">9</span>)); |
| <span class="kw">let </span>seek = <span class="number">4</span>; |
| <span class="macro">assert_eq!</span>(s.binary_search_by(|probe| probe.cmp(<span class="kw-2">&</span>seek)), <span class="prelude-val">Err</span>(<span class="number">7</span>)); |
| <span class="kw">let </span>seek = <span class="number">100</span>; |
| <span class="macro">assert_eq!</span>(s.binary_search_by(|probe| probe.cmp(<span class="kw-2">&</span>seek)), <span class="prelude-val">Err</span>(<span class="number">13</span>)); |
| <span class="kw">let </span>seek = <span class="number">1</span>; |
| <span class="kw">let </span>r = s.binary_search_by(|probe| probe.cmp(<span class="kw-2">&</span>seek)); |
| <span class="macro">assert!</span>(<span class="kw">match </span>r { <span class="prelude-val">Ok</span>(<span class="number">1</span>..=<span class="number">4</span>) => <span class="bool-val">true</span>, <span class="kw">_ </span>=> <span class="bool-val">false</span>, });</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.binary_search_by_key" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.10.0">1.10.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#3086-3089">Source</a></span><h4 class="code-header">pub fn <a href="#method.binary_search_by_key" class="fn">binary_search_by_key</a><'a, B, F>( |
| &'a self, |
| b: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&B</a>, |
| f: F, |
| ) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>><div class="where">where |
| F: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&'a T</a>) -> B, |
| B: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h4></section></summary><div class="docblock"><p>Binary searches this slice with a key extraction function.</p> |
| <p>Assumes that the slice is sorted by the key, for instance with |
| <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.sort_by_key" title="method slice::sort_by_key"><code>sort_by_key</code></a> using the same key extraction function. |
| If the slice is not sorted by the key, the returned result is |
| unspecified and meaningless.</p> |
| <p>If the value is found then <a href="https://doc.rust-lang.org/1.99.1/core/result/enum.Result.html#variant.Ok" title="variant core::result::Result::Ok"><code>Result::Ok</code></a> is returned, containing the |
| index of the matching element. If there are multiple matches, then any |
| one of the matches could be returned. The index is chosen |
| deterministically, but is subject to change in future versions of Rust. |
| If the value is not found then <a href="https://doc.rust-lang.org/1.99.1/core/result/enum.Result.html#variant.Err" title="variant core::result::Result::Err"><code>Result::Err</code></a> is returned, containing |
| the index where a matching element could be inserted while maintaining |
| sorted order.</p> |
| <p>See also <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.binary_search" title="method slice::binary_search"><code>binary_search</code></a>, <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.binary_search_by" title="method slice::binary_search_by"><code>binary_search_by</code></a>, and <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.partition_point" title="method slice::partition_point"><code>partition_point</code></a>.</p> |
| <h5 id="examples-49"><a class="doc-anchor" href="#examples-49">§</a>Examples</h5> |
| <p>Looks up a series of four elements in a slice of pairs sorted by |
| their second elements. The first is found, with a uniquely |
| determined position; the second and third are not found; the |
| fourth could match any position in <code>[1, 4]</code>.</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>s = [(<span class="number">0</span>, <span class="number">0</span>), (<span class="number">2</span>, <span class="number">1</span>), (<span class="number">4</span>, <span class="number">1</span>), (<span class="number">5</span>, <span class="number">1</span>), (<span class="number">3</span>, <span class="number">1</span>), |
| (<span class="number">1</span>, <span class="number">2</span>), (<span class="number">2</span>, <span class="number">3</span>), (<span class="number">4</span>, <span class="number">5</span>), (<span class="number">5</span>, <span class="number">8</span>), (<span class="number">3</span>, <span class="number">13</span>), |
| (<span class="number">1</span>, <span class="number">21</span>), (<span class="number">2</span>, <span class="number">34</span>), (<span class="number">4</span>, <span class="number">55</span>)]; |
| |
| <span class="macro">assert_eq!</span>(s.binary_search_by_key(<span class="kw-2">&</span><span class="number">13</span>, |<span class="kw-2">&</span>(a, b)| b), <span class="prelude-val">Ok</span>(<span class="number">9</span>)); |
| <span class="macro">assert_eq!</span>(s.binary_search_by_key(<span class="kw-2">&</span><span class="number">4</span>, |<span class="kw-2">&</span>(a, b)| b), <span class="prelude-val">Err</span>(<span class="number">7</span>)); |
| <span class="macro">assert_eq!</span>(s.binary_search_by_key(<span class="kw-2">&</span><span class="number">100</span>, |<span class="kw-2">&</span>(a, b)| b), <span class="prelude-val">Err</span>(<span class="number">13</span>)); |
| <span class="kw">let </span>r = s.binary_search_by_key(<span class="kw-2">&</span><span class="number">1</span>, |<span class="kw-2">&</span>(a, b)| b); |
| <span class="macro">assert!</span>(<span class="kw">match </span>r { <span class="prelude-val">Ok</span>(<span class="number">1</span>..=<span class="number">4</span>) => <span class="bool-val">true</span>, <span class="kw">_ </span>=> <span class="bool-val">false</span>, });</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.align_to" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.30.0">1.30.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#4519">Source</a></span><h4 class="code-header">pub unsafe fn <a href="#method.align_to" class="fn">align_to</a><U>(&self) -> (&<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>, &<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[U]</a>, &<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>)</h4></section></summary><div class="docblock"><p>Transmutes the slice to a slice of another type, ensuring alignment of the types is |
| maintained.</p> |
| <p>This method splits the slice into three distinct slices: prefix, correctly aligned middle |
| slice of a new type, and the suffix slice. The middle part will be as big as possible under |
| the given alignment constraint and element size.</p> |
| <p>This method has no purpose when either input element <code>T</code> or output element <code>U</code> are |
| zero-sized and will return the original slice without splitting anything.</p> |
| <h5 id="safety-5"><a class="doc-anchor" href="#safety-5">§</a>Safety</h5> |
| <p>This method is essentially a <code>transmute</code> with respect to the elements in the returned |
| middle slice, so all the usual caveats pertaining to <code>transmute::<T, U></code> also apply here.</p> |
| <h5 id="examples-50"><a class="doc-anchor" href="#examples-50">§</a>Examples</h5> |
| <p>Basic usage:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">unsafe </span>{ |
| <span class="kw">let </span>bytes: [u8; <span class="number">7</span>] = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>, <span class="number">7</span>]; |
| <span class="kw">let </span>(prefix, shorts, suffix) = bytes.align_to::<u16>(); |
| <span class="comment">// less_efficient_algorithm_for_bytes(prefix); |
| // more_efficient_algorithm_for_aligned_shorts(shorts); |
| // less_efficient_algorithm_for_bytes(suffix); |
| </span>}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.as_simd" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#4675-4678">Source</a><h4 class="code-header">pub fn <a href="#method.as_simd" class="fn">as_simd</a><const LANES: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>>(&self) -> (&<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>, &[<a class="struct" href="https://doc.rust-lang.org/1.99.1/core/core_simd/vector/struct.Simd.html" title="struct core::core_simd::vector::Simd">Simd</a><T, LANES>], &<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>)<div class="where">where |
| <a class="struct" href="https://doc.rust-lang.org/1.99.1/core/core_simd/vector/struct.Simd.html" title="struct core::core_simd::vector::Simd">Simd</a><T, LANES>: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.array.html">[T; LANES]</a>>, |
| T: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/core_simd/vector/trait.SimdElement.html" title="trait core::core_simd::vector::SimdElement">SimdElement</a>,</div></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>portable_simd</code>)</span></div></span></summary><div class="docblock"><p>Splits a slice into a prefix, a middle of aligned SIMD types, and a suffix.</p> |
| <p>This is a safe wrapper around <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.align_to" title="method slice::align_to"><code>slice::align_to</code></a>, so inherits the same |
| guarantees as that method.</p> |
| <h5 id="panics-9"><a class="doc-anchor" href="#panics-9">§</a>Panics</h5> |
| <p>This will panic if the size of the SIMD type is different from |
| <code>LANES</code> times that of the scalar.</p> |
| <p>At the time of writing, the trait restrictions on <code>Simd<T, LANES></code> keeps |
| that from ever happening, as only power-of-two numbers of lanes are |
| supported. It’s possible that, in the future, those restrictions might |
| be lifted in a way that would make it possible to see panics from this |
| method for something like <code>LANES == 3</code>.</p> |
| <h5 id="examples-51"><a class="doc-anchor" href="#examples-51">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(portable_simd)] |
| </span><span class="kw">use </span>core::simd::prelude::<span class="kw-2">*</span>; |
| |
| <span class="kw">let </span>short = <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>]; |
| <span class="kw">let </span>(prefix, middle, suffix) = short.as_simd::<<span class="number">4</span>>(); |
| <span class="macro">assert_eq!</span>(middle, []); <span class="comment">// Not enough elements for anything in the middle |
| |
| // They might be split in any possible way between prefix and suffix |
| </span><span class="kw">let </span>it = prefix.iter().chain(suffix).copied(); |
| <span class="macro">assert_eq!</span>(it.collect::<Vec<<span class="kw">_</span>>>(), <span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>]); |
| |
| <span class="kw">fn </span>basic_simd_sum(x: <span class="kw-2">&</span>[f32]) -> f32 { |
| <span class="kw">use </span>std::ops::Add; |
| <span class="kw">let </span>(prefix, middle, suffix) = x.as_simd(); |
| <span class="kw">let </span>sums = f32x4::from_array([ |
| prefix.iter().copied().sum(), |
| <span class="number">0.0</span>, |
| <span class="number">0.0</span>, |
| suffix.iter().copied().sum(), |
| ]); |
| <span class="kw">let </span>sums = middle.iter().copied().fold(sums, f32x4::add); |
| sums.reduce_sum() |
| } |
| |
| <span class="kw">let </span>numbers: Vec<f32> = (<span class="number">1</span>..<span class="number">101</span>).map(|x| x <span class="kw">as _</span>).collect(); |
| <span class="macro">assert_eq!</span>(basic_simd_sum(<span class="kw-2">&</span>numbers[<span class="number">1</span>..<span class="number">99</span>]), <span class="number">4949.0</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.is_sorted" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.82.0">1.82.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#4748-4750">Source</a></span><h4 class="code-header">pub fn <a href="#method.is_sorted" class="fn">is_sorted</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a><div class="where">where |
| T: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>,</div></h4></section></summary><div class="docblock"><p>Checks if the elements of this slice are sorted.</p> |
| <p>That is, for each element <code>a</code> and its following element <code>b</code>, <code>a <= b</code> must hold. If the |
| slice yields exactly zero or one element, <code>true</code> is returned.</p> |
| <p>Note that if <code>Self::Item</code> is only <code>PartialOrd</code>, but not <code>Ord</code>, the above definition |
| implies that this function returns <code>false</code> if any two consecutive items are not |
| comparable.</p> |
| <h5 id="examples-52"><a class="doc-anchor" href="#examples-52">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>empty: [i32; <span class="number">0</span>] = []; |
| |
| <span class="macro">assert!</span>([<span class="number">1</span>, <span class="number">2</span>, <span class="number">2</span>, <span class="number">9</span>].is_sorted()); |
| <span class="macro">assert!</span>(![<span class="number">1</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">4</span>].is_sorted()); |
| <span class="macro">assert!</span>([<span class="number">0</span>].is_sorted()); |
| <span class="macro">assert!</span>(empty.is_sorted()); |
| <span class="macro">assert!</span>(![<span class="number">0.0</span>, <span class="number">1.0</span>, f32::NAN].is_sorted());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.is_sorted_by" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.82.0">1.82.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#4791-4793">Source</a></span><h4 class="code-header">pub fn <a href="#method.is_sorted_by" class="fn">is_sorted_by</a><'a, F>(&'a self, compare: F) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a><div class="where">where |
| F: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&'a T</a>, <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&'a T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Checks if the elements of this slice are sorted using the given comparator function.</p> |
| <p>Instead of using <code>PartialOrd::partial_cmp</code>, this function uses the given <code>compare</code> |
| function to determine whether two elements are to be considered in sorted order.</p> |
| <h5 id="examples-53"><a class="doc-anchor" href="#examples-53">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert!</span>([<span class="number">1</span>, <span class="number">2</span>, <span class="number">2</span>, <span class="number">9</span>].is_sorted_by(|a, b| a <= b)); |
| <span class="macro">assert!</span>(![<span class="number">1</span>, <span class="number">2</span>, <span class="number">2</span>, <span class="number">9</span>].is_sorted_by(|a, b| a < b)); |
| |
| <span class="macro">assert!</span>([<span class="number">0</span>].is_sorted_by(|a, b| <span class="bool-val">true</span>)); |
| <span class="macro">assert!</span>([<span class="number">0</span>].is_sorted_by(|a, b| <span class="bool-val">false</span>)); |
| |
| <span class="kw">let </span>empty: [i32; <span class="number">0</span>] = []; |
| <span class="macro">assert!</span>(empty.is_sorted_by(|a, b| <span class="bool-val">false</span>)); |
| <span class="macro">assert!</span>(empty.is_sorted_by(|a, b| <span class="bool-val">true</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.is_sorted_by_key" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.82.0">1.82.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#4815-4818">Source</a></span><h4 class="code-header">pub fn <a href="#method.is_sorted_by_key" class="fn">is_sorted_by_key</a><'a, F, K>(&'a self, f: F) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a><div class="where">where |
| F: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&'a T</a>) -> K, |
| K: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>,</div></h4></section></summary><div class="docblock"><p>Checks if the elements of this slice are sorted using the given key extraction function.</p> |
| <p>Instead of comparing the slice’s elements directly, this function compares the keys of the |
| elements, as determined by <code>f</code>. Apart from that, it’s equivalent to <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.is_sorted" title="method slice::is_sorted"><code>is_sorted</code></a>; see its |
| documentation for more information.</p> |
| <h5 id="examples-54"><a class="doc-anchor" href="#examples-54">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert!</span>([<span class="string">"c"</span>, <span class="string">"bb"</span>, <span class="string">"aaa"</span>].is_sorted_by_key(|s| s.len())); |
| <span class="macro">assert!</span>(![-<span class="number">2i32</span>, -<span class="number">1</span>, <span class="number">0</span>, <span class="number">3</span>].is_sorted_by_key(|n| n.abs()));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.partition_point" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.52.0">1.52.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#4875-4877">Source</a></span><h4 class="code-header">pub fn <a href="#method.partition_point" class="fn">partition_point</a><P>(&self, pred: P) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a><div class="where">where |
| P: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Returns the index of the partition point according to the given predicate |
| (the index of the first element of the second partition).</p> |
| <p>The slice is assumed to be partitioned according to the given predicate. |
| This means that all elements for which the predicate returns true are at the start of the slice |
| and all elements for which the predicate returns false are at the end. |
| For example, <code>[7, 15, 3, 5, 4, 12, 6]</code> is partitioned under the predicate <code>x % 2 != 0</code> |
| (all odd numbers are at the start, all even at the end).</p> |
| <p>If this slice is not partitioned, the returned result is unspecified and meaningless, |
| as this method performs a kind of binary search.</p> |
| <p>See also <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.binary_search" title="method slice::binary_search"><code>binary_search</code></a>, <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.binary_search_by" title="method slice::binary_search_by"><code>binary_search_by</code></a>, and <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.binary_search_by_key" title="method slice::binary_search_by_key"><code>binary_search_by_key</code></a>.</p> |
| <h5 id="examples-55"><a class="doc-anchor" href="#examples-55">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">6</span>, <span class="number">7</span>]; |
| <span class="kw">let </span>i = v.partition_point(|<span class="kw-2">&</span>x| x < <span class="number">5</span>); |
| |
| <span class="macro">assert_eq!</span>(i, <span class="number">4</span>); |
| <span class="macro">assert!</span>(v[..i].iter().all(|<span class="kw-2">&</span>x| x < <span class="number">5</span>)); |
| <span class="macro">assert!</span>(v[i..].iter().all(|<span class="kw-2">&</span>x| !(x < <span class="number">5</span>)));</code></pre></div> |
| <p>If all elements of the slice match the predicate, including if the slice |
| is empty, then the length of the slice will be returned:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>a = [<span class="number">2</span>, <span class="number">4</span>, <span class="number">8</span>]; |
| <span class="macro">assert_eq!</span>(a.partition_point(|x| x < <span class="kw-2">&</span><span class="number">100</span>), a.len()); |
| <span class="kw">let </span>a: [i32; <span class="number">0</span>] = []; |
| <span class="macro">assert_eq!</span>(a.partition_point(|x| x < <span class="kw-2">&</span><span class="number">100</span>), <span class="number">0</span>);</code></pre></div> |
| <p>If you want to insert an item to a sorted vector, while maintaining |
| sort order:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>s = <span class="macro">vec!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">8</span>, <span class="number">13</span>, <span class="number">21</span>, <span class="number">34</span>, <span class="number">55</span>]; |
| <span class="kw">let </span>num = <span class="number">42</span>; |
| <span class="kw">let </span>idx = s.partition_point(|<span class="kw-2">&</span>x| x <= num); |
| s.insert(idx, num); |
| <span class="macro">assert_eq!</span>(s, [<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">8</span>, <span class="number">13</span>, <span class="number">21</span>, <span class="number">34</span>, <span class="number">42</span>, <span class="number">55</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.element_offset" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.94.0">1.94.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#5282">Source</a></span><h4 class="code-header">pub fn <a href="#method.element_offset" class="fn">element_offset</a>(&self, element: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&T</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>></h4></section></summary><div class="docblock"><p>Returns the index that an element reference points to.</p> |
| <p>Returns <code>None</code> if <code>element</code> does not point to the start of an element within the slice.</p> |
| <p>This method is useful for extending slice iterators like <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.split" title="method slice::split"><code>slice::split</code></a>.</p> |
| <p>Note that this uses pointer arithmetic and <strong>does not compare elements</strong>. |
| To find the index of an element via comparison, use |
| <a href="https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html#method.position" title="method core::iter::traits::iterator::Iterator::position"><code>.iter().position()</code></a> instead.</p> |
| <h5 id="panics-10"><a class="doc-anchor" href="#panics-10">§</a>Panics</h5> |
| <p>Panics if <code>T</code> is zero-sized.</p> |
| <h5 id="examples-56"><a class="doc-anchor" href="#examples-56">§</a>Examples</h5> |
| <p>Basic usage:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>nums: <span class="kw-2">&</span>[u32] = <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">7</span>, <span class="number">1</span>, <span class="number">1</span>]; |
| <span class="kw">let </span>num = <span class="kw-2">&</span>nums[<span class="number">2</span>]; |
| |
| <span class="macro">assert_eq!</span>(num, <span class="kw-2">&</span><span class="number">1</span>); |
| <span class="macro">assert_eq!</span>(nums.element_offset(num), <span class="prelude-val">Some</span>(<span class="number">2</span>));</code></pre></div> |
| <p>Returning <code>None</code> with an unaligned element:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>arr: <span class="kw-2">&</span>[[u32; <span class="number">2</span>]] = <span class="kw-2">&</span>[[<span class="number">0</span>, <span class="number">1</span>], [<span class="number">2</span>, <span class="number">3</span>]]; |
| <span class="kw">let </span>flat_arr: <span class="kw-2">&</span>[u32] = arr.as_flattened(); |
| |
| <span class="kw">let </span>ok_elm: <span class="kw-2">&</span>[u32; <span class="number">2</span>] = flat_arr[<span class="number">0</span>..<span class="number">2</span>].try_into().unwrap(); |
| <span class="kw">let </span>weird_elm: <span class="kw-2">&</span>[u32; <span class="number">2</span>] = flat_arr[<span class="number">1</span>..<span class="number">3</span>].try_into().unwrap(); |
| |
| <span class="macro">assert_eq!</span>(ok_elm, <span class="kw-2">&</span>[<span class="number">0</span>, <span class="number">1</span>]); |
| <span class="macro">assert_eq!</span>(weird_elm, <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">2</span>]); |
| |
| <span class="macro">assert_eq!</span>(arr.element_offset(ok_elm), <span class="prelude-val">Some</span>(<span class="number">0</span>)); <span class="comment">// Points to element 0 |
| </span><span class="macro">assert_eq!</span>(arr.element_offset(weird_elm), <span class="prelude-val">None</span>); <span class="comment">// Points between element 0 and 1</span></code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.subslice_range" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.98.0">1.98.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#5336">Source</a></span><h4 class="code-header">pub fn <a href="#method.subslice_range" class="fn">subslice_range</a>(&self, subslice: &<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/1.99.1/core/range/struct.Range.html" title="struct core::range::Range">Range</a><<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>>></h4></section></summary><div class="docblock"><p>Returns the range of indices that a subslice points to.</p> |
| <p>Returns <code>None</code> if <code>subslice</code> does not point within the slice or if it is not aligned with the |
| elements in the slice.</p> |
| <p>This method <strong>does not compare elements</strong>. Instead, this method finds the location in the slice that |
| <code>subslice</code> was obtained from. To find the index of a subslice via comparison, instead use |
| <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.windows" title="method slice::windows"><code>.windows()</code></a><a href="https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html#method.position" title="method core::iter::traits::iterator::Iterator::position"><code>.position()</code></a>.</p> |
| <p>This method is useful for extending slice iterators like <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.split" title="method slice::split"><code>slice::split</code></a>.</p> |
| <p>Note that this may return a false positive (either <code>Some(0..0)</code> or <code>Some(self.len()..self.len())</code>) |
| if <code>subslice</code> has a length of zero and points to the beginning or end of another, separate, slice.</p> |
| <h5 id="panics-11"><a class="doc-anchor" href="#panics-11">§</a>Panics</h5> |
| <p>Panics if <code>T</code> is zero-sized.</p> |
| <h5 id="examples-57"><a class="doc-anchor" href="#examples-57">§</a>Examples</h5> |
| <p>Basic usage:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>core::range::Range; |
| |
| <span class="kw">let </span>nums = <span class="kw-2">&</span>[<span class="number">0</span>, <span class="number">5</span>, <span class="number">10</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">5</span>]; |
| |
| <span class="kw">let </span><span class="kw-2">mut </span>iter = nums |
| .split(|t| <span class="kw-2">*</span>t == <span class="number">0</span>) |
| .map(|n| nums.subslice_range(n).unwrap()); |
| |
| <span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(Range { start: <span class="number">0</span>, end: <span class="number">0 </span>})); |
| <span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(Range { start: <span class="number">1</span>, end: <span class="number">3 </span>})); |
| <span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(Range { start: <span class="number">4</span>, end: <span class="number">4 </span>})); |
| <span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(Range { start: <span class="number">5</span>, end: <span class="number">6 </span>}));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.as_slice-1" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#5367">Source</a><h4 class="code-header">pub fn <a href="#method.as_slice-1" class="fn">as_slice</a>(&self) -> &<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>str_as_str</code>)</span></div></span></summary><div class="docblock"><p>Returns the same slice <code>&[T]</code>.</p> |
| <p>This method is redundant when used directly on <code>&[T]</code>, but |
| it helps dereferencing other “container” types to slices, |
| for example <code>Box<[T]></code> or <code>Arc<[T]></code>.</p> |
| </div></details><details class="toggle method-toggle" open><summary><section id="method.as_flattened" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.80.0">1.80.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/slice/mod.rs.html#5466">Source</a></span><h4 class="code-header">pub fn <a href="#method.as_flattened" class="fn">as_flattened</a>(&self) -> &<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a></h4></section></summary><div class="docblock"><p>Takes a <code>&[[T; N]]</code>, and flattens it to a <code>&[T]</code>.</p> |
| <p>For the opposite operation, see <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.as_chunks" title="method slice::as_chunks"><code>as_chunks</code></a> and <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.as_rchunks" title="method slice::as_rchunks"><code>as_rchunks</code></a>.</p> |
| <h5 id="panics-12"><a class="doc-anchor" href="#panics-12">§</a>Panics</h5> |
| <p>This panics if the length of the resulting slice would overflow a <code>usize</code>.</p> |
| <p>This is only possible when flattening a slice of arrays of zero-sized |
| types, and thus tends to be irrelevant in practice. If |
| <code>size_of::<T>() > 0</code>, this will never panic.</p> |
| <h5 id="examples-58"><a class="doc-anchor" href="#examples-58">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert_eq!</span>([[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>], [<span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>]].as_flattened(), <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>]); |
| |
| <span class="macro">assert_eq!</span>( |
| [[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>], [<span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>]].as_flattened(), |
| [[<span class="number">1</span>, <span class="number">2</span>], [<span class="number">3</span>, <span class="number">4</span>], [<span class="number">5</span>, <span class="number">6</span>]].as_flattened(), |
| ); |
| |
| <span class="kw">let </span>slice_of_empty_arrays: <span class="kw-2">&</span>[[i32; <span class="number">0</span>]] = <span class="kw-2">&</span>[[], [], [], [], []]; |
| <span class="macro">assert!</span>(slice_of_empty_arrays.as_flattened().is_empty()); |
| |
| <span class="kw">let </span>empty_slice_of_arrays: <span class="kw-2">&</span>[[u32; <span class="number">10</span>]] = <span class="kw-2">&</span>[]; |
| <span class="macro">assert!</span>(empty_slice_of_arrays.as_flattened().is_empty());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.utf8_chunks" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.79.0">1.79.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/str/lossy.rs.html#45">Source</a></span><h4 class="code-header">pub fn <a href="#method.utf8_chunks" class="fn">utf8_chunks</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.99.1/core/str/lossy/struct.Utf8Chunks.html" title="struct core::str::lossy::Utf8Chunks">Utf8Chunks</a><'_> <a href="#" class="tooltip" data-notable-ty="Utf8Chunks<'_>">ⓘ</a></h4></section></summary><div class="docblock"><p>Creates an iterator over the contiguous valid UTF-8 ranges of this |
| slice, and the non-UTF-8 fragments in between.</p> |
| <p>See the <a href="https://doc.rust-lang.org/1.99.1/core/str/lossy/struct.Utf8Chunk.html" title="struct core::str::lossy::Utf8Chunk"><code>Utf8Chunk</code></a> type for documentation of the items yielded by this iterator.</p> |
| <h5 id="examples-59"><a class="doc-anchor" href="#examples-59">§</a>Examples</h5> |
| <p>This function formats arbitrary but mostly-UTF-8 bytes into Rust source |
| code in the form of a C-string literal (<code>c"..."</code>).</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::fmt::Write <span class="kw">as _</span>; |
| |
| <span class="kw">pub fn </span>cstr_literal(bytes: <span class="kw-2">&</span>[u8]) -> String { |
| <span class="kw">let </span><span class="kw-2">mut </span>repr = String::new(); |
| repr.push_str(<span class="string">"c\""</span>); |
| <span class="kw">for </span>chunk <span class="kw">in </span>bytes.utf8_chunks() { |
| <span class="kw">for </span>ch <span class="kw">in </span>chunk.valid().chars() { |
| <span class="comment">// Escapes \0, \t, \r, \n, \\, \', \", and uses \u{...} for non-printable characters. |
| </span><span class="macro">write!</span>(repr, <span class="string">"{}"</span>, ch.escape_debug()).unwrap(); |
| } |
| <span class="kw">for </span>byte <span class="kw">in </span>chunk.invalid() { |
| <span class="macro">write!</span>(repr, <span class="string">"\\x{:02X}"</span>, byte).unwrap(); |
| } |
| } |
| repr.push(<span class="string">'"'</span>); |
| repr |
| } |
| |
| <span class="kw">fn </span>main() { |
| <span class="kw">let </span>lit = cstr_literal(<span class="string">b"\xferris the \xf0\x9f\xa6\x80\x07"</span>); |
| <span class="kw">let </span>expected = <span class="macro">stringify!</span>(<span class="string">c"\xFErris the 🦀\u{7}"</span>); |
| <span class="macro">assert_eq!</span>(lit, expected); |
| }</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.to_vec" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/alloc/slice.rs.html#372-374">Source</a></span><h4 class="code-header">pub fn <a href="#method.to_vec" class="fn">to_vec</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.99.1/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><T><div class="where">where |
| T: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h4></section></summary><div class="docblock"><p>Copies <code>self</code> into a new <code>Vec</code>.</p> |
| <h5 id="examples-60"><a class="doc-anchor" href="#examples-60">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>s = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>]; |
| <span class="kw">let </span>x = s.to_vec(); |
| <span class="comment">// Here, `s` and `x` can be modified independently.</span></code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.to_vec_in" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/alloc/slice.rs.html#396-398">Source</a><h4 class="code-header">pub fn <a href="#method.to_vec_in" class="fn">to_vec_in</a><A>(&self, alloc: A) -> <a class="struct" href="https://doc.rust-lang.org/1.99.1/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><T, A><div class="where">where |
| A: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/alloc/trait.Allocator.html" title="trait core::alloc::Allocator">Allocator</a>, |
| T: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>allocator_api</code>)</span></div></span></summary><div class="docblock"><p>Copies <code>self</code> into a new <code>Vec</code> with an allocator.</p> |
| <h5 id="examples-61"><a class="doc-anchor" href="#examples-61">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(allocator_api)] |
| |
| </span><span class="kw">use </span>std::alloc::System; |
| |
| <span class="kw">let </span>s = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>]; |
| <span class="kw">let </span>x = s.to_vec_in(System); |
| <span class="comment">// Here, `s` and `x` can be modified independently.</span></code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.repeat" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.40.0">1.40.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/alloc/slice.rs.html#510-512">Source</a></span><h4 class="code-header">pub fn <a href="#method.repeat" class="fn">repeat</a>(&self, n: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.99.1/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><T><div class="where">where |
| T: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a>,</div></h4></section></summary><div class="docblock"><p>Creates a vector by copying a slice <code>n</code> times.</p> |
| <h5 id="panics-13"><a class="doc-anchor" href="#panics-13">§</a>Panics</h5> |
| <p>This function will panic if the capacity would overflow.</p> |
| <h5 id="examples-62"><a class="doc-anchor" href="#examples-62">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert_eq!</span>([<span class="number">1</span>, <span class="number">2</span>].repeat(<span class="number">3</span>), <span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">2</span>]);</code></pre></div> |
| <p>A panic upon overflow:</p> |
| |
| <div class="example-wrap should_panic"><a href="#" class="tooltip" title="This example panics">ⓘ</a><pre class="rust rust-example-rendered"><code><span class="comment">// this will panic at runtime |
| </span><span class="string">b"0123456789abcdef"</span>.repeat(usize::MAX);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.concat" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/alloc/slice.rs.html#578-580">Source</a></span><h4 class="code-header">pub fn <a href="#method.concat" class="fn">concat</a><Item>(&self) -> <<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a> as <a class="trait" href="https://doc.rust-lang.org/1.99.1/alloc/slice/trait.Concat.html" title="trait alloc::slice::Concat">Concat</a><Item>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.99.1/alloc/slice/trait.Concat.html#associatedtype.Output" title="type alloc::slice::Concat::Output">Output</a> <a href="#" class="tooltip" data-notable-ty="<[T] as Concat<Item>>::Output">ⓘ</a><div class="where">where |
| <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>: <a class="trait" href="https://doc.rust-lang.org/1.99.1/alloc/slice/trait.Concat.html" title="trait alloc::slice::Concat">Concat</a><Item>, |
| Item: ?<a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Flattens a slice of <code>T</code> into a single value <code>Self::Output</code>.</p> |
| <h5 id="examples-63"><a class="doc-anchor" href="#examples-63">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert_eq!</span>([<span class="string">"hello"</span>, <span class="string">"world"</span>].concat(), <span class="string">"helloworld"</span>); |
| <span class="macro">assert_eq!</span>([[<span class="number">1</span>, <span class="number">2</span>], [<span class="number">3</span>, <span class="number">4</span>]].concat(), [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.join" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.3.0">1.3.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/alloc/slice.rs.html#597-599">Source</a></span><h4 class="code-header">pub fn <a href="#method.join" class="fn">join</a><Separator>( |
| &self, |
| sep: Separator, |
| ) -> <<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a> as <a class="trait" href="https://doc.rust-lang.org/1.99.1/alloc/slice/trait.Join.html" title="trait alloc::slice::Join">Join</a><Separator>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.99.1/alloc/slice/trait.Join.html#associatedtype.Output" title="type alloc::slice::Join::Output">Output</a> <a href="#" class="tooltip" data-notable-ty="<[T] as Join<Separator>>::Output">ⓘ</a><div class="where">where |
| <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>: <a class="trait" href="https://doc.rust-lang.org/1.99.1/alloc/slice/trait.Join.html" title="trait alloc::slice::Join">Join</a><Separator>,</div></h4></section></summary><div class="docblock"><p>Flattens a slice of <code>T</code> into a single value <code>Self::Output</code>, placing a |
| given separator between each.</p> |
| <h5 id="examples-64"><a class="doc-anchor" href="#examples-64">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert_eq!</span>([<span class="string">"hello"</span>, <span class="string">"world"</span>].join(<span class="string">" "</span>), <span class="string">"hello world"</span>); |
| <span class="macro">assert_eq!</span>([[<span class="number">1</span>, <span class="number">2</span>], [<span class="number">3</span>, <span class="number">4</span>]].join(<span class="kw-2">&</span><span class="number">0</span>), [<span class="number">1</span>, <span class="number">2</span>, <span class="number">0</span>, <span class="number">3</span>, <span class="number">4</span>]); |
| <span class="macro">assert_eq!</span>([[<span class="number">1</span>, <span class="number">2</span>], [<span class="number">3</span>, <span class="number">4</span>]].join(<span class="kw-2">&</span>[<span class="number">0</span>, <span class="number">0</span>][..]), [<span class="number">1</span>, <span class="number">2</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">3</span>, <span class="number">4</span>]);</code></pre></div></div></details><details class="toggle method-toggle deprecated" open><summary><section id="method.connect" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/alloc/slice.rs.html#617-619">Source</a></span><h4 class="code-header">pub fn <a href="#method.connect" class="fn">connect</a><Separator>( |
| &self, |
| sep: Separator, |
| ) -> <<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a> as <a class="trait" href="https://doc.rust-lang.org/1.99.1/alloc/slice/trait.Join.html" title="trait alloc::slice::Join">Join</a><Separator>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.99.1/alloc/slice/trait.Join.html#associatedtype.Output" title="type alloc::slice::Join::Output">Output</a> <a href="#" class="tooltip" data-notable-ty="<[T] as Join<Separator>>::Output">ⓘ</a><div class="where">where |
| <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>: <a class="trait" href="https://doc.rust-lang.org/1.99.1/alloc/slice/trait.Join.html" title="trait alloc::slice::Join">Join</a><Separator>,</div></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 1.3.0: <p>renamed to join</p> |
| </span></div></span></summary><div class="docblock"><p>Flattens a slice of <code>T</code> into a single value <code>Self::Output</code>, placing a |
| given separator between each.</p> |
| <h5 id="examples-65"><a class="doc-anchor" href="#examples-65">§</a>Examples</h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert_eq!</span>([<span class="string">"hello"</span>, <span class="string">"world"</span>].connect(<span class="string">" "</span>), <span class="string">"hello world"</span>); |
| <span class="macro">assert_eq!</span>([[<span class="number">1</span>, <span class="number">2</span>], [<span class="number">3</span>, <span class="number">4</span>]].connect(<span class="kw-2">&</span><span class="number">0</span>), [<span class="number">1</span>, <span class="number">2</span>, <span class="number">0</span>, <span class="number">3</span>, <span class="number">4</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.to_ascii_uppercase" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.23.0">1.23.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/alloc/slice.rs.html#641">Source</a></span><h4 class="code-header">pub fn <a href="#method.to_ascii_uppercase" class="fn">to_ascii_uppercase</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.99.1/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.u8.html">u8</a>> <a href="#" class="tooltip" data-notable-ty="Vec<u8>">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns a vector containing a copy of this slice where each byte |
| is mapped to its ASCII upper case equivalent.</p> |
| <p>ASCII letters ‘a’ to ‘z’ are mapped to ‘A’ to ‘Z’, |
| but non-ASCII letters are unchanged.</p> |
| <p>To uppercase the value in-place, use <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.make_ascii_uppercase" title="method slice::make_ascii_uppercase"><code>make_ascii_uppercase</code></a>.</p> |
| </div></details><details class="toggle method-toggle" open><summary><section id="method.to_ascii_lowercase" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.23.0">1.23.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/alloc/slice.rs.html#660">Source</a></span><h4 class="code-header">pub fn <a href="#method.to_ascii_lowercase" class="fn">to_ascii_lowercase</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.99.1/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.u8.html">u8</a>> <a href="#" class="tooltip" data-notable-ty="Vec<u8>">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns a vector containing a copy of this slice where each byte |
| is mapped to its ASCII lower case equivalent.</p> |
| <p>ASCII letters ‘A’ to ‘Z’ are mapped to ‘a’ to ‘z’, |
| but non-ASCII letters are unchanged.</p> |
| <p>To lowercase the value in-place, use <a href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html#method.make_ascii_lowercase" title="method slice::make_ascii_lowercase"><code>make_ascii_lowercase</code></a>.</p> |
| </div></details></div></details><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Clone-for-RegionAssumptions%3C'db%3E" class="impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#impl-Clone-for-RegionAssumptions%3C'db%3E" class="anchor">§</a><h3 class="code-header">impl<'db> <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="struct.RegionAssumptions.html" title="struct hir_ty::next_solver::RegionAssumptions">RegionAssumptions</a><'db></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.clone" class="method trait-impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#method.clone" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.99.1/core/clone/trait.Clone.html#tymethod.clone" class="fn">clone</a>(&self) -> <a class="struct" href="struct.RegionAssumptions.html" title="struct hir_ty::next_solver::RegionAssumptions">RegionAssumptions</a><'db></h4></section></summary><div class='docblock'>Returns a duplicate of the value. <a href="https://doc.rust-lang.org/1.99.1/core/clone/trait.Clone.html#tymethod.clone">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_from" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0, const unstable">1.0.0 (const: <a href="https://github.com/rust-lang/rust/issues/142757" title="Tracking issue for const_clone">unstable</a>)</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/clone.rs.html#245-247">Source</a></span><a href="#method.clone_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.99.1/core/clone/trait.Clone.html#method.clone_from" class="fn">clone_from</a>(&mut self, source: &Self)</h4></section></summary><div class='docblock'>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/1.99.1/core/clone/trait.Clone.html#method.clone_from">Read more</a></div></details></div></details><section id="impl-Copy-for-RegionAssumptions%3C'db%3E" class="impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#impl-Copy-for-RegionAssumptions%3C'db%3E" class="anchor">§</a><h3 class="code-header">impl<'db> <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a> for <a class="struct" href="struct.RegionAssumptions.html" title="struct hir_ty::next_solver::RegionAssumptions">RegionAssumptions</a><'db></h3></section><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-RegionAssumptions%3C'db%3E" class="impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#impl-Debug-for-RegionAssumptions%3C'db%3E" class="anchor">§</a><h3 class="code-header">impl<'db> <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.RegionAssumptions.html" title="struct hir_ty::next_solver::RegionAssumptions">RegionAssumptions</a><'db></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.99.1/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&self, fmt: &mut <a class="struct" href="https://doc.rust-lang.org/1.99.1/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.99.1/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.99.1/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Default-for-RegionAssumptions%3C'db%3E" class="impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#impl-Default-for-RegionAssumptions%3C'db%3E" class="anchor">§</a><h3 class="code-header">impl<'db> <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="struct.RegionAssumptions.html" title="struct hir_ty::next_solver::RegionAssumptions">RegionAssumptions</a><'db></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.default" class="method trait-impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#method.default" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.99.1/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -> Self</h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/1.99.1/core/default/trait.Default.html#tymethod.default">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Deref-for-RegionAssumptions%3C'db%3E" class="impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#impl-Deref-for-RegionAssumptions%3C'db%3E" class="anchor">§</a><h3 class="code-header">impl<'db> <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a> for <a class="struct" href="struct.RegionAssumptions.html" title="struct hir_ty::next_solver::RegionAssumptions">RegionAssumptions</a><'db></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Target" class="associatedtype trait-impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#associatedtype.Target" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.99.1/core/ops/deref/trait.Deref.html#associatedtype.Target" class="associatedtype">Target</a> = [OutlivesPredicate<<a class="struct" href="interner/struct.DbInterner.html" title="struct hir_ty::next_solver::interner::DbInterner">DbInterner</a><'db>, <a class="struct" href="struct.GenericArg.html" title="struct hir_ty::next_solver::GenericArg">GenericArg</a><'db>>]</h4></section></summary><div class='docblock'>The resulting type after dereferencing.</div></details><details class="toggle method-toggle" open><summary><section id="method.deref" class="method trait-impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#method.deref" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.99.1/core/ops/deref/trait.Deref.html#tymethod.deref" class="fn">deref</a>(&self) -> &Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.99.1/core/ops/deref/trait.Deref.html#associatedtype.Target" title="type core::ops::deref::Deref::Target">Target</a></h4></section></summary><div class='docblock'>Dereferences the value.</div></details></div></details><section id="impl-Eq-for-RegionAssumptions%3C'db%3E" class="impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#impl-Eq-for-RegionAssumptions%3C'db%3E" class="anchor">§</a><h3 class="code-header">impl<'db> <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> for <a class="struct" href="struct.RegionAssumptions.html" title="struct hir_ty::next_solver::RegionAssumptions">RegionAssumptions</a><'db></h3></section><details class="toggle implementors-toggle" open><summary><section id="impl-GenericTypeVisitable%3CV%3E-for-RegionAssumptions%3C'db%3E" class="impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#impl-GenericTypeVisitable%3CV%3E-for-RegionAssumptions%3C'db%3E" class="anchor">§</a><h3 class="code-header">impl<'db, V: <a class="trait" href="interner/trait.WorldExposer.html" title="trait hir_ty::next_solver::interner::WorldExposer">WorldExposer</a>> GenericTypeVisitable<V> for <a class="struct" href="struct.RegionAssumptions.html" title="struct hir_ty::next_solver::RegionAssumptions">RegionAssumptions</a><'db></h3></section></summary><div class="impl-items"><section id="method.generic_visit_with" class="method trait-impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#method.generic_visit_with" class="anchor">§</a><h4 class="code-header">fn <a class="fn">generic_visit_with</a>(&self, visitor: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&mut V</a>)</h4></section></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Hash-for-RegionAssumptions%3C'db%3E" class="impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#impl-Hash-for-RegionAssumptions%3C'db%3E" class="anchor">§</a><h3 class="code-header">impl<'db> <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> for <a class="struct" href="struct.RegionAssumptions.html" title="struct hir_ty::next_solver::RegionAssumptions">RegionAssumptions</a><'db></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.hash" class="method trait-impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#method.hash" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.99.1/core/hash/trait.Hash.html#tymethod.hash" class="fn">hash</a><__H: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>>(&self, state: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&mut __H</a>)</h4></section></summary><div class='docblock'>Feeds this value into the given <a href="https://doc.rust-lang.org/1.99.1/core/hash/trait.Hasher.html" title="trait core::hash::Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/1.99.1/core/hash/trait.Hash.html#tymethod.hash">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.hash_slice" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.3.0">1.3.0</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/hash/mod.rs.html#234-236">Source</a></span><a href="#method.hash_slice" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.99.1/core/hash/trait.Hash.html#method.hash_slice" class="fn">hash_slice</a><H>(data: &[Self], state: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&mut H</a>)<div class="where">where |
| H: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>, |
| Self: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Feeds a slice of this type into the given <a href="https://doc.rust-lang.org/1.99.1/core/hash/trait.Hasher.html" title="trait core::hash::Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/1.99.1/core/hash/trait.Hash.html#method.hash_slice">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IntoIterator-for-RegionAssumptions%3C'db%3E" class="impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#impl-IntoIterator-for-RegionAssumptions%3C'db%3E" class="anchor">§</a><h3 class="code-header">impl<'db> <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a> for <a class="struct" href="struct.RegionAssumptions.html" title="struct hir_ty::next_solver::RegionAssumptions">RegionAssumptions</a><'db></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.IntoIter" class="associatedtype trait-impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#associatedtype.IntoIter" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.99.1/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" class="associatedtype">IntoIter</a> = <a class="struct" href="https://doc.rust-lang.org/1.99.1/core/iter/adapters/copied/struct.Copied.html" title="struct core::iter::adapters::copied::Copied">Copied</a><<a class="struct" href="https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.Iter.html" title="struct core::slice::iter::Iter">Iter</a><'db, OutlivesPredicate<<a class="struct" href="interner/struct.DbInterner.html" title="struct hir_ty::next_solver::interner::DbInterner">DbInterner</a><'db>, <a class="struct" href="struct.GenericArg.html" title="struct hir_ty::next_solver::GenericArg">GenericArg</a><'db>>>></h4></section></summary><div class='docblock'>Which kind of iterator are we turning this into?</div></details><details class="toggle" open><summary><section id="associatedtype.Item" class="associatedtype trait-impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#associatedtype.Item" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.99.1/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" class="associatedtype">Item</a> = OutlivesPredicate<<a class="struct" href="interner/struct.DbInterner.html" title="struct hir_ty::next_solver::interner::DbInterner">DbInterner</a><'db>, <a class="struct" href="struct.GenericArg.html" title="struct hir_ty::next_solver::GenericArg">GenericArg</a><'db>></h4></section></summary><div class='docblock'>The type of the elements being iterated over.</div></details><details class="toggle method-toggle" open><summary><section id="method.into_iter" class="method trait-impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#method.into_iter" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.99.1/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter" class="fn">into_iter</a>(self) -> Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.99.1/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a></h4></section></summary><div class='docblock'>Creates an iterator from a value. <a href="https://doc.rust-lang.org/1.99.1/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq-for-RegionAssumptions%3C'db%3E" class="impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#impl-PartialEq-for-RegionAssumptions%3C'db%3E" class="anchor">§</a><h3 class="code-header">impl<'db> <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a> for <a class="struct" href="struct.RegionAssumptions.html" title="struct hir_ty::next_solver::RegionAssumptions">RegionAssumptions</a><'db></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq" class="method trait-impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#method.eq" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.99.1/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&self, other: &<a class="struct" href="struct.RegionAssumptions.html" title="struct hir_ty::next_solver::RegionAssumptions">RegionAssumptions</a><'db>) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Equality operator <code>==</code>. <a href="https://doc.rust-lang.org/1.99.1/core/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ne" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0, const unstable">1.0.0 (const: <a href="https://github.com/rust-lang/rust/issues/143800" title="Tracking issue for const_cmp">unstable</a>)</span> · <a class="src" href="https://doc.rust-lang.org/1.99.1/src/core/cmp.rs.html#275">Source</a></span><a href="#method.ne" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.99.1/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Inequality operator <code>!=</code>. <a href="https://doc.rust-lang.org/1.99.1/core/cmp/trait.PartialEq.html#method.ne">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-SliceLike-for-RegionAssumptions%3C'db%3E" class="impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#impl-SliceLike-for-RegionAssumptions%3C'db%3E" class="anchor">§</a><h3 class="code-header">impl<'db> SliceLike for <a class="struct" href="struct.RegionAssumptions.html" title="struct hir_ty::next_solver::RegionAssumptions">RegionAssumptions</a><'db></h3></section></summary><div class="impl-items"><section id="associatedtype.Item-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#associatedtype.Item-1" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Item</a> = OutlivesPredicate<<a class="struct" href="interner/struct.DbInterner.html" title="struct hir_ty::next_solver::interner::DbInterner">DbInterner</a><'db>, <a class="struct" href="struct.GenericArg.html" title="struct hir_ty::next_solver::GenericArg">GenericArg</a><'db>></h4></section><section id="associatedtype.IntoIter-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#associatedtype.IntoIter-1" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">IntoIter</a> = <a class="struct" href="https://doc.rust-lang.org/1.99.1/core/iter/adapters/copied/struct.Copied.html" title="struct core::iter::adapters::copied::Copied">Copied</a><<a class="struct" href="https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.Iter.html" title="struct core::slice::iter::Iter">Iter</a><'db, OutlivesPredicate<<a class="struct" href="interner/struct.DbInterner.html" title="struct hir_ty::next_solver::interner::DbInterner">DbInterner</a><'db>, <a class="struct" href="struct.GenericArg.html" title="struct hir_ty::next_solver::GenericArg">GenericArg</a><'db>>>></h4></section><section id="method.iter-2" class="method trait-impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#method.iter-2" class="anchor">§</a><h4 class="code-header">fn <a class="fn">iter</a>(self) -> Self::IntoIter</h4></section><section id="method.as_slice-2" class="method trait-impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#method.as_slice-2" class="anchor">§</a><h4 class="code-header">fn <a class="fn">as_slice</a>(&self) -> &[Self::Item]</h4></section><section id="method.get-1" class="method trait-impl"><a href="#method.get-1" class="anchor">§</a><h4 class="code-header">fn <a class="fn">get</a>(self, idx: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Self::Item></h4></section><section id="method.len-2" class="method trait-impl"><a href="#method.len-2" class="anchor">§</a><h4 class="code-header">fn <a class="fn">len</a>(self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a></h4></section><section id="method.is_empty-2" class="method trait-impl"><a href="#method.is_empty-2" class="anchor">§</a><h4 class="code-header">fn <a class="fn">is_empty</a>(self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section><section id="method.contains-1" class="method trait-impl"><a href="#method.contains-1" class="anchor">§</a><h4 class="code-header">fn <a class="fn">contains</a>(self, t: &Self::Item) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a><div class="where">where |
| Self::Item: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>,</div></h4></section><section id="method.to_vec-1" class="method trait-impl"><a href="#method.to_vec-1" class="anchor">§</a><h4 class="code-header">fn <a class="fn">to_vec</a>(self) -> <a class="struct" href="https://doc.rust-lang.org/1.99.1/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><Self::Item></h4></section><section id="method.last-1" class="method trait-impl"><a href="#method.last-1" class="anchor">§</a><h4 class="code-header">fn <a class="fn">last</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Self::Item></h4></section><section id="method.split_last-1" class="method trait-impl"><a href="#method.split_last-1" class="anchor">§</a><h4 class="code-header">fn <a class="fn">split_last</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><(&Self::Item, &[Self::Item])></h4></section></div></details><section id="impl-StructuralPartialEq-for-RegionAssumptions%3C'db%3E" class="impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#314-321">Source</a><a href="#impl-StructuralPartialEq-for-RegionAssumptions%3C'db%3E" class="anchor">§</a><h3 class="code-header">impl<'db> <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.StructuralPartialEq.html" title="trait core::marker::StructuralPartialEq">StructuralPartialEq</a> for <a class="struct" href="struct.RegionAssumptions.html" title="struct hir_ty::next_solver::RegionAssumptions">RegionAssumptions</a><'db></h3></section><details class="toggle implementors-toggle" open><summary><section id="impl-TypeFoldable%3CDbInterner%3C'db%3E%3E-for-RegionAssumptions%3C'db%3E" class="impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#322">Source</a><a href="#impl-TypeFoldable%3CDbInterner%3C'db%3E%3E-for-RegionAssumptions%3C'db%3E" class="anchor">§</a><h3 class="code-header">impl<'db> TypeFoldable<<a class="struct" href="interner/struct.DbInterner.html" title="struct hir_ty::next_solver::interner::DbInterner">DbInterner</a><'db>> for <a class="struct" href="struct.RegionAssumptions.html" title="struct hir_ty::next_solver::RegionAssumptions">RegionAssumptions</a><'db></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.try_fold_with" class="method trait-impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#322">Source</a><a href="#method.try_fold_with" class="anchor">§</a><h4 class="code-header">fn <a class="fn">try_fold_with</a><F: FallibleTypeFolder<<a class="struct" href="interner/struct.DbInterner.html" title="struct hir_ty::next_solver::interner::DbInterner">DbInterner</a><'db>>>( |
| self, |
| folder: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&mut F</a>, |
| ) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self, F::Error></h4></section></summary><div class='docblock'>The entry point for folding. To fold a value <code>t</code> with a folder <code>f</code> |
| call: <code>t.try_fold_with(f)</code>. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.fold_with" class="method trait-impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#322">Source</a><a href="#method.fold_with" class="anchor">§</a><h4 class="code-header">fn <a class="fn">fold_with</a><F: TypeFolder<<a class="struct" href="interner/struct.DbInterner.html" title="struct hir_ty::next_solver::interner::DbInterner">DbInterner</a><'db>>>(self, folder: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&mut F</a>) -> Self</h4></section></summary><div class='docblock'>The entry point for folding. To fold a value <code>t</code> with a folder <code>f</code> |
| call: <code>t.fold_with(f)</code>. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-TypeVisitable%3CDbInterner%3C'db%3E%3E-for-RegionAssumptions%3C'db%3E" class="impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#322">Source</a><a href="#impl-TypeVisitable%3CDbInterner%3C'db%3E%3E-for-RegionAssumptions%3C'db%3E" class="anchor">§</a><h3 class="code-header">impl<'db> TypeVisitable<<a class="struct" href="interner/struct.DbInterner.html" title="struct hir_ty::next_solver::interner::DbInterner">DbInterner</a><'db>> for <a class="struct" href="struct.RegionAssumptions.html" title="struct hir_ty::next_solver::RegionAssumptions">RegionAssumptions</a><'db></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.visit_with" class="method trait-impl"><a class="src rightside" href="../../src/hir_ty/next_solver/region.rs.html#322">Source</a><a href="#method.visit_with" class="anchor">§</a><h4 class="code-header">fn <a class="fn">visit_with</a><V: TypeVisitor<<a class="struct" href="interner/struct.DbInterner.html" title="struct hir_ty::next_solver::interner::DbInterner">DbInterner</a><'db>>>( |
| &self, |
| visitor: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&mut V</a>, |
| ) -> V::Result</h4></section></summary><div class='docblock'>The entry point for visiting. To visit a value <code>t</code> with a visitor <code>v</code> |
| call: <code>t.visit_with(v)</code>. <a>Read more</a></div></details></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-Freeze-for-RegionAssumptions%3C'db%3E" class="impl"><a href="#impl-Freeze-for-RegionAssumptions%3C'db%3E" class="anchor">§</a><h3 class="code-header">impl<'db> <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a> for <a class="struct" href="struct.RegionAssumptions.html" title="struct hir_ty::next_solver::RegionAssumptions">RegionAssumptions</a><'db></h3></section><section id="impl-RefUnwindSafe-for-RegionAssumptions%3C'db%3E" class="impl"><a href="#impl-RefUnwindSafe-for-RegionAssumptions%3C'db%3E" class="anchor">§</a><h3 class="code-header">impl<'db> <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.RegionAssumptions.html" title="struct hir_ty::next_solver::RegionAssumptions">RegionAssumptions</a><'db></h3></section><section id="impl-Send-for-RegionAssumptions%3C'db%3E" class="impl"><a href="#impl-Send-for-RegionAssumptions%3C'db%3E" class="anchor">§</a><h3 class="code-header">impl<'db> <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.RegionAssumptions.html" title="struct hir_ty::next_solver::RegionAssumptions">RegionAssumptions</a><'db></h3></section><section id="impl-Sync-for-RegionAssumptions%3C'db%3E" class="impl"><a href="#impl-Sync-for-RegionAssumptions%3C'db%3E" class="anchor">§</a><h3 class="code-header">impl<'db> <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.RegionAssumptions.html" title="struct hir_ty::next_solver::RegionAssumptions">RegionAssumptions</a><'db></h3></section><section id="impl-Unpin-for-RegionAssumptions%3C'db%3E" class="impl"><a href="#impl-Unpin-for-RegionAssumptions%3C'db%3E" class="anchor">§</a><h3 class="code-header">impl<'db> <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.RegionAssumptions.html" title="struct hir_ty::next_solver::RegionAssumptions">RegionAssumptions</a><'db></h3></section><section id="impl-UnsafeUnpin-for-RegionAssumptions%3C'db%3E" class="impl"><a href="#impl-UnsafeUnpin-for-RegionAssumptions%3C'db%3E" class="anchor">§</a><h3 class="code-header">impl<'db> <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.UnsafeUnpin.html" title="trait core::marker::UnsafeUnpin">UnsafeUnpin</a> for <a class="struct" href="struct.RegionAssumptions.html" title="struct hir_ty::next_solver::RegionAssumptions">RegionAssumptions</a><'db></h3></section><section id="impl-UnwindSafe-for-RegionAssumptions%3C'db%3E" class="impl"><a href="#impl-UnwindSafe-for-RegionAssumptions%3C'db%3E" class="anchor">§</a><h3 class="code-header">impl<'db> <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.RegionAssumptions.html" title="struct hir_ty::next_solver::RegionAssumptions">RegionAssumptions</a><'db></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/any.rs.html#141">Source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where |
| T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/any.rs.html#142">Source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.99.1/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.99.1/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/1.99.1/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/borrow.rs.html#212">Source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T<div class="where">where |
| T: ?<a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/borrow.rs.html#214">Source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.99.1/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.99.1/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/borrow.rs.html#221">Source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T<div class="where">where |
| T: ?<a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/borrow.rs.html#222">Source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.99.1/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.99.1/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-CloneToUninit-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/clone.rs.html#648">Source</a><a href="#impl-CloneToUninit-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/clone/trait.CloneToUninit.html" title="trait core::clone::CloneToUninit">CloneToUninit</a> for T<div class="where">where |
| T: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.clone_to_uninit" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/clone.rs.html#650">Source</a><a href="#method.clone_to_uninit" class="anchor">§</a><h4 class="code-header">unsafe fn <a href="https://doc.rust-lang.org/1.99.1/core/clone/trait.CloneToUninit.html#tymethod.clone_to_uninit" class="fn">clone_to_uninit</a>(&self, dest: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.pointer.html">*mut </a><a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.u8.html">u8</a>)</h4></section></summary><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>clone_to_uninit</code>)</span></div></span><div class='docblock'>Performs copy-assignment from <code>self</code> to <code>dest</code>. <a href="https://doc.rust-lang.org/1.99.1/core/clone/trait.CloneToUninit.html#tymethod.clone_to_uninit">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-CollectAndApply%3CT,+R%3E-for-T" class="impl"><a href="#impl-CollectAndApply%3CT,+R%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, R> CollectAndApply<T, R> for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.collect_and_apply" class="method trait-impl"><a href="#method.collect_and_apply" class="anchor">§</a><h4 class="code-header">fn <a class="fn">collect_and_apply</a><I, F>(iter: I, f: F) -> R<div class="where">where |
| I: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = T>, |
| F: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(&<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.slice.html">[T]</a>) -> R,</div></h4></section></summary><div class="docblock"><p>Equivalent to <code>f(&iter.collect::<Vec<_>>())</code>.</p> |
| </div></details><section id="associatedtype.Output" class="associatedtype trait-impl"><a href="#associatedtype.Output" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Output</a> = R</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Equivalent%3CK%3E-for-Q" class="impl"><a href="#impl-Equivalent%3CK%3E-for-Q" class="anchor">§</a><h3 class="code-header">impl<Q, K> Equivalent<K> for Q<div class="where">where |
| Q: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, |
| K: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><Q> + ?<a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.equivalent" class="method trait-impl"><a href="#method.equivalent" class="anchor">§</a><h4 class="code-header">fn <a class="fn">equivalent</a>(&self, key: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&K</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Compare self to <code>key</code> and return <code>true</code> if they are equal.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Equivalent%3CK%3E-for-Q-1" class="impl"><a href="#impl-Equivalent%3CK%3E-for-Q-1" class="anchor">§</a><h3 class="code-header">impl<Q, K> Equivalent<K> for Q<div class="where">where |
| Q: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, |
| K: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><Q> + ?<a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.equivalent-1" class="method trait-impl"><a href="#method.equivalent-1" class="anchor">§</a><h4 class="code-header">fn <a class="fn">equivalent</a>(&self, key: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&K</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Checks if this value is equivalent to the given key. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Equivalent%3CK%3E-for-Q-2" class="impl"><a href="#impl-Equivalent%3CK%3E-for-Q-2" class="anchor">§</a><h3 class="code-header">impl<Q, K> Equivalent<K> for Q<div class="where">where |
| Q: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, |
| K: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><Q> + ?<a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.equivalent-2" class="method trait-impl"><a href="#method.equivalent-2" class="anchor">§</a><h4 class="code-header">fn <a class="fn">equivalent</a>(&self, key: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&K</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Checks if this value is equivalent to the given key. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/convert/mod.rs.html#788">Source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/convert/mod.rs.html#791">Source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.99.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -> T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p> |
| </div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-HashEqLike%3C%26T%3E-for-T" class="impl"><a href="#impl-HashEqLike%3C%26T%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> HashEqLike<<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&T</a>> for T<div class="where">where |
| T: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a>,</div></h3></section></summary><div class="impl-items"><section id="method.eq-1" class="method trait-impl"><a href="#method.eq-1" class="anchor">§</a><h4 class="code-header">fn <a class="fn">eq</a>(&self, data: &<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-HashEqLike%3CCow%3C'_,+T%3E%3E-for-T" class="impl"><a href="#impl-HashEqLike%3CCow%3C'_,+T%3E%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> HashEqLike<<a class="enum" href="https://doc.rust-lang.org/1.99.1/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a><'_, T>> for T<div class="where">where |
| T: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><section id="method.eq-2" class="method trait-impl"><a href="#method.eq-2" class="anchor">§</a><h4 class="code-header">fn <a class="fn">eq</a>(&self, data: &<a class="enum" href="https://doc.rust-lang.org/1.99.1/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a><'_, T>) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-HashEqLike%3CT%3E-for-T" class="impl"><a href="#impl-HashEqLike%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> HashEqLike<T> for T<div class="where">where |
| T: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a>,</div></h3></section></summary><div class="impl-items"><section id="method.eq-3" class="method trait-impl"><a href="#method.eq-3" class="anchor">§</a><h4 class="code-header">fn <a class="fn">eq</a>(&self, data: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Instrument-for-T" class="impl"><a href="#impl-Instrument-for-T" class="anchor">§</a><h3 class="code-header">impl<T> Instrument for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.instrument" class="method trait-impl"><a href="#method.instrument" class="anchor">§</a><h4 class="code-header">fn <a class="fn">instrument</a>(self, span: Span) -> Instrumented<Self> <a href="#" class="tooltip" data-notable-ty="Instrumented<Self>">ⓘ</a></h4></section></summary><div class='docblock'>Instruments this type with the provided [<code>Span</code>], returning an |
| <code>Instrumented</code> wrapper. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.in_current_span" class="method trait-impl"><a href="#method.in_current_span" class="anchor">§</a><h4 class="code-header">fn <a class="fn">in_current_span</a>(self) -> Instrumented<Self> <a href="#" class="tooltip" data-notable-ty="Instrumented<Self>">ⓘ</a></h4></section></summary><div class='docblock'>Instruments this type with the <a href="super::Span::current()">current</a> <a href="crate::Span"><code>Span</code></a>, returning an |
| <code>Instrumented</code> wrapper. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/convert/mod.rs.html#770-772">Source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T<div class="where">where |
| U: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/convert/mod.rs.html#780">Source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.99.1/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -> U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p> |
| <p>That is, this conversion is whatever the implementation of |
| <code><a href="https://doc.rust-lang.org/1.99.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for U</code> chooses to do.</p> |
| </div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-IntoBox%3Cdyn+Any+%2B+Send+%2B+Sync%3E-for-T" class="impl"><a href="#impl-IntoBox%3Cdyn+Any+%2B+Send+%2B+Sync%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> IntoBox<dyn <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/any/trait.Any.html" title="trait core::any::Any">Any</a> + <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>> for T<div class="where">where |
| T: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/any/trait.Any.html" title="trait core::any::Any">Any</a> + <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into_box" class="method trait-impl"><a href="#method.into_box" class="anchor">§</a><h4 class="code-header">fn <a class="fn">into_box</a>(self) -> <a class="struct" href="https://doc.rust-lang.org/1.99.1/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/any/trait.Any.html" title="trait core::any::Any">Any</a> + <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>></h4></section></summary><div class='docblock'>Convert self into the appropriate boxed form.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-IntoBox%3Cdyn+Any+%2B+Send%3E-for-T" class="impl"><a href="#impl-IntoBox%3Cdyn+Any+%2B+Send%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> IntoBox<dyn <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/any/trait.Any.html" title="trait core::any::Any">Any</a> + <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>> for T<div class="where">where |
| T: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/any/trait.Any.html" title="trait core::any::Any">Any</a> + <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into_box-1" class="method trait-impl"><a href="#method.into_box-1" class="anchor">§</a><h4 class="code-header">fn <a class="fn">into_box</a>(self) -> <a class="struct" href="https://doc.rust-lang.org/1.99.1/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/any/trait.Any.html" title="trait core::any::Any">Any</a> + <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>></h4></section></summary><div class='docblock'>Convert self into the appropriate boxed form.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-IntoBox%3Cdyn+Any%3E-for-T" class="impl"><a href="#impl-IntoBox%3Cdyn+Any%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> IntoBox<dyn <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/any/trait.Any.html" title="trait core::any::Any">Any</a>> for T<div class="where">where |
| T: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/any/trait.Any.html" title="trait core::any::Any">Any</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into_box-2" class="method trait-impl"><a href="#method.into_box-2" class="anchor">§</a><h4 class="code-header">fn <a class="fn">into_box</a>(self) -> <a class="struct" href="https://doc.rust-lang.org/1.99.1/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/any/trait.Any.html" title="trait core::any::Any">Any</a>></h4></section></summary><div class='docblock'>Convert self into the appropriate boxed form.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-IntoEither-for-T" class="impl"><a class="src rightside" href="https://docs.rs/either/1/src/either/into_either.rs.html#64">Source</a><a href="#impl-IntoEither-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://docs.rs/either/1/either/into_either/trait.IntoEither.html" title="trait either::into_either::IntoEither">IntoEither</a> for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into_either" class="method trait-impl"><a class="src rightside" href="https://docs.rs/either/1/src/either/into_either.rs.html#29">Source</a><a href="#method.into_either" class="anchor">§</a><h4 class="code-header">fn <a href="https://docs.rs/either/1/either/into_either/trait.IntoEither.html#method.into_either" class="fn">into_either</a>(self, into_left: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a>) -> <a class="enum" href="https://docs.rs/either/1/either/enum.Either.html" title="enum either::Either">Either</a><Self, Self> <a href="#" class="tooltip" data-notable-ty="Either<Self, Self>">ⓘ</a></h4></section></summary><div class='docblock'>Converts <code>self</code> into a <a href="https://docs.rs/either/1/either/enum.Either.html#variant.Left" title="variant either::Either::Left"><code>Left</code></a> variant of <a href="https://docs.rs/either/1/either/enum.Either.html" title="enum either::Either"><code>Either<Self, Self></code></a> |
| if <code>into_left</code> is <code>true</code>. |
| Converts <code>self</code> into a <a href="https://docs.rs/either/1/either/enum.Either.html#variant.Right" title="variant either::Either::Right"><code>Right</code></a> variant of <a href="https://docs.rs/either/1/either/enum.Either.html" title="enum either::Either"><code>Either<Self, Self></code></a> |
| otherwise. <a href="https://docs.rs/either/1/either/into_either/trait.IntoEither.html#method.into_either">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.into_either_with" class="method trait-impl"><a class="src rightside" href="https://docs.rs/either/1/src/either/into_either.rs.html#55-57">Source</a><a href="#method.into_either_with" class="anchor">§</a><h4 class="code-header">fn <a href="https://docs.rs/either/1/either/into_either/trait.IntoEither.html#method.into_either_with" class="fn">into_either_with</a><F>(self, into_left: F) -> <a class="enum" href="https://docs.rs/either/1/either/enum.Either.html" title="enum either::Either">Either</a><Self, Self> <a href="#" class="tooltip" data-notable-ty="Either<Self, Self>">ⓘ</a><div class="where">where |
| F: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(&Self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class='docblock'>Converts <code>self</code> into a <a href="https://docs.rs/either/1/either/enum.Either.html#variant.Left" title="variant either::Either::Left"><code>Left</code></a> variant of <a href="https://docs.rs/either/1/either/enum.Either.html" title="enum either::Either"><code>Either<Self, Self></code></a> |
| if <code>into_left(&self)</code> returns <code>true</code>. |
| Converts <code>self</code> into a <a href="https://docs.rs/either/1/either/enum.Either.html#variant.Right" title="variant either::Either::Right"><code>Right</code></a> variant of <a href="https://docs.rs/either/1/either/enum.Either.html" title="enum either::Either"><code>Either<Self, Self></code></a> |
| otherwise. <a href="https://docs.rs/either/1/either/into_either/trait.IntoEither.html#method.into_either_with">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Lookup%3CT%3E-for-T" class="impl"><a href="#impl-Lookup%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> Lookup<T> for T</h3></section></summary><div class="impl-items"><section id="method.into_owned" class="method trait-impl"><a href="#method.into_owned" class="anchor">§</a><h4 class="code-header">fn <a class="fn">into_owned</a>(self) -> T</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Pointable-for-T" class="impl"><a href="#impl-Pointable-for-T" class="anchor">§</a><h3 class="code-header">impl<T> Pointable for T</h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedconstant.ALIGN" class="associatedconstant trait-impl"><a href="#associatedconstant.ALIGN" class="anchor">§</a><h4 class="code-header">const <a class="constant">ALIGN</a>: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a></h4></section></summary><div class='docblock'>The alignment of pointer.</div></details><details class="toggle" open><summary><section id="associatedtype.Init" class="associatedtype trait-impl"><a href="#associatedtype.Init" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Init</a> = T</h4></section></summary><div class='docblock'>The type for initializers.</div></details><details class="toggle method-toggle" open><summary><section id="method.init" class="method trait-impl"><a href="#method.init" class="anchor">§</a><h4 class="code-header">unsafe fn <a class="fn">init</a>(init: <T as Pointable>::Init) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a></h4></section></summary><div class='docblock'>Initializes a with the given initializer. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.deref-1" class="method trait-impl"><a href="#method.deref-1" class="anchor">§</a><h4 class="code-header">unsafe fn <a class="fn">deref</a><'a>(ptr: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&'a T</a></h4></section></summary><div class='docblock'>Dereferences the given pointer. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.deref_mut" class="method trait-impl"><a href="#method.deref_mut" class="anchor">§</a><h4 class="code-header">unsafe fn <a class="fn">deref_mut</a><'a>(ptr: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&'a mut T</a></h4></section></summary><div class='docblock'>Mutably dereferences the given pointer. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.drop" class="method trait-impl"><a href="#method.drop" class="anchor">§</a><h4 class="code-header">unsafe fn <a class="fn">drop</a>(ptr: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.usize.html">usize</a>)</h4></section></summary><div class='docblock'>Drops the object pointed to by the given pointer. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Receiver-for-P" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/ops/deref.rs.html#379-381">Source</a><a href="#impl-Receiver-for-P" class="anchor">§</a><h3 class="code-header">impl<P, T> <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/ops/deref/trait.Receiver.html" title="trait core::ops::deref::Receiver">Receiver</a> for P<div class="where">where |
| P: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a><Target = T> + ?<a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, |
| T: ?<a class="trait" href="https://doc.rust-lang.org/1.99.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Target-1" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/ops/deref.rs.html#383">Source</a><a href="#associatedtype.Target-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.99.1/core/ops/deref/trait.Receiver.html#associatedtype.Target" class="associatedtype">Target</a> = T</h4></section></summary><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>arbitrary_self_types</code>)</span></div></span><div class='docblock'>The target type on which the method may be called.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-ToOwned-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/alloc/borrow.rs.html#72-74">Source</a><a href="#impl-ToOwned-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.99.1/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T<div class="where">where |
| T: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Owned" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/alloc/borrow.rs.html#76">Source</a><a href="#associatedtype.Owned" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.99.1/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="associatedtype">Owned</a> = T</h4></section></summary><div class='docblock'>The resulting type after obtaining ownership.</div></details><details class="toggle method-toggle" open><summary><section id="method.to_owned" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/alloc/borrow.rs.html#77">Source</a><a href="#method.to_owned" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.99.1/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fn">to_owned</a>(&self) -> T</h4></section></summary><div class='docblock'>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/1.99.1/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/alloc/borrow.rs.html#81">Source</a><a href="#method.clone_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.99.1/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fn">clone_into</a>(&self, target: <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.reference.html">&mut T</a>)</h4></section></summary><div class='docblock'>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/1.99.1/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/convert/mod.rs.html#830-832">Source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T<div class="where">where |
| U: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/convert/mod.rs.html#834">Source</a><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.99.1/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/convert/mod.rs.html#837">Source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.99.1/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.99.1/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/convert/mod.rs.html#814-816">Source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T<div class="where">where |
| U: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/convert/mod.rs.html#818">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.99.1/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.99.1/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.99.1/src/core/convert/mod.rs.html#821">Source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.99.1/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.99.1/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TypeVisitableExt%3CI%3E-for-T" class="impl"><a href="#impl-TypeVisitableExt%3CI%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<I, T> TypeVisitableExt<I> for T<div class="where">where |
| I: Interner, |
| T: TypeVisitable<I>,</div></h3></section></summary><div class="impl-items"><section id="method.has_type_flags" class="method trait-impl"><a href="#method.has_type_flags" class="anchor">§</a><h4 class="code-header">fn <a class="fn">has_type_flags</a>(&self, flags: TypeFlags) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section><details class="toggle method-toggle" open><summary><section id="method.has_vars_bound_at_or_above" class="method trait-impl"><a href="#method.has_vars_bound_at_or_above" class="anchor">§</a><h4 class="code-header">fn <a class="fn">has_vars_bound_at_or_above</a>(&self, binder: DebruijnIndex) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Returns <code>true</code> if <code>self</code> has any late-bound regions that are either |
| bound by <code>binder</code> or bound by some binder outside of <code>binder</code>. |
| If <code>binder</code> is <code>ty::INNERMOST</code>, this indicates whether |
| there are any late-bound regions that appear free.</div></details><section id="method.error_reported" class="method trait-impl"><a href="#method.error_reported" class="anchor">§</a><h4 class="code-header">fn <a class="fn">error_reported</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.unit.html">()</a>, <I as Interner>::ErrorGuaranteed></h4></section><section id="method.non_region_error_reported" class="method trait-impl"><a href="#method.non_region_error_reported" class="anchor">§</a><h4 class="code-header">fn <a class="fn">non_region_error_reported</a>( |
| &self, |
| ) -> <a class="enum" href="https://doc.rust-lang.org/1.99.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.unit.html">()</a>, <I as Interner>::ErrorGuaranteed></h4></section><details class="toggle method-toggle" open><summary><section id="method.has_vars_bound_above" class="method trait-impl"><a href="#method.has_vars_bound_above" class="anchor">§</a><h4 class="code-header">fn <a class="fn">has_vars_bound_above</a>(&self, binder: DebruijnIndex) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Returns <code>true</code> if this type has any regions that escape <code>binder</code> (and |
| hence are not bound by it).</div></details><details class="toggle method-toggle" open><summary><section id="method.has_escaping_bound_vars" class="method trait-impl"><a href="#method.has_escaping_bound_vars" class="anchor">§</a><h4 class="code-header">fn <a class="fn">has_escaping_bound_vars</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Returns <code>true</code> if this type has regions that are not a part of the |
| type. For example, given a <code>for<'a> fn(&'a i32)</code> this function returns |
| <code>false</code>, while given a <code>fn(&'a i32)</code> it returns <code>true</code>. The latter can |
| occur when traversing through the former. <a>Read more</a></div></details><section id="method.has_aliases" class="method trait-impl"><a href="#method.has_aliases" class="anchor">§</a><h4 class="code-header">fn <a class="fn">has_aliases</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section><section id="method.has_opaque_types" class="method trait-impl"><a href="#method.has_opaque_types" class="anchor">§</a><h4 class="code-header">fn <a class="fn">has_opaque_types</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section><section id="method.has_coroutines" class="method trait-impl"><a href="#method.has_coroutines" class="anchor">§</a><h4 class="code-header">fn <a class="fn">has_coroutines</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section><section id="method.references_error" class="method trait-impl"><a href="#method.references_error" class="anchor">§</a><h4 class="code-header">fn <a class="fn">references_error</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section><section id="method.has_non_region_param" class="method trait-impl"><a href="#method.has_non_region_param" class="anchor">§</a><h4 class="code-header">fn <a class="fn">has_non_region_param</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section><section id="method.has_regions" class="method trait-impl"><a href="#method.has_regions" class="anchor">§</a><h4 class="code-header">fn <a class="fn">has_regions</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section><section id="method.has_infer_regions" class="method trait-impl"><a href="#method.has_infer_regions" class="anchor">§</a><h4 class="code-header">fn <a class="fn">has_infer_regions</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section><section id="method.has_infer_types" class="method trait-impl"><a href="#method.has_infer_types" class="anchor">§</a><h4 class="code-header">fn <a class="fn">has_infer_types</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section><section id="method.has_non_region_infer" class="method trait-impl"><a href="#method.has_non_region_infer" class="anchor">§</a><h4 class="code-header">fn <a class="fn">has_non_region_infer</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section><section id="method.has_infer" class="method trait-impl"><a href="#method.has_infer" class="anchor">§</a><h4 class="code-header">fn <a class="fn">has_infer</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section><section id="method.has_placeholders" class="method trait-impl"><a href="#method.has_placeholders" class="anchor">§</a><h4 class="code-header">fn <a class="fn">has_placeholders</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section><section id="method.has_non_region_placeholders" class="method trait-impl"><a href="#method.has_non_region_placeholders" class="anchor">§</a><h4 class="code-header">fn <a class="fn">has_non_region_placeholders</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section><section id="method.has_param" class="method trait-impl"><a href="#method.has_param" class="anchor">§</a><h4 class="code-header">fn <a class="fn">has_param</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section><details class="toggle method-toggle" open><summary><section id="method.has_free_regions" class="method trait-impl"><a href="#method.has_free_regions" class="anchor">§</a><h4 class="code-header">fn <a class="fn">has_free_regions</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>“Free” regions in this context means that it has any region |
| that is not (a) erased or (b) late-bound.</div></details><section id="method.has_erased_regions" class="method trait-impl"><a href="#method.has_erased_regions" class="anchor">§</a><h4 class="code-header">fn <a class="fn">has_erased_regions</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section><details class="toggle method-toggle" open><summary><section id="method.has_erasable_regions" class="method trait-impl"><a href="#method.has_erasable_regions" class="anchor">§</a><h4 class="code-header">fn <a class="fn">has_erasable_regions</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>True if there are any un-erased free regions.</div></details><details class="toggle method-toggle" open><summary><section id="method.is_global" class="method trait-impl"><a href="#method.is_global" class="anchor">§</a><h4 class="code-header">fn <a class="fn">is_global</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Indicates whether this value references only ‘global’ |
| generic parameters that are the same regardless of what fn we are |
| in. This is used for caching.</div></details><details class="toggle method-toggle" open><summary><section id="method.has_bound_regions" class="method trait-impl"><a href="#method.has_bound_regions" class="anchor">§</a><h4 class="code-header">fn <a class="fn">has_bound_regions</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>True if there are any late-bound regions</div></details><details class="toggle method-toggle" open><summary><section id="method.has_non_region_bound_vars" class="method trait-impl"><a href="#method.has_non_region_bound_vars" class="anchor">§</a><h4 class="code-header">fn <a class="fn">has_non_region_bound_vars</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>True if there are any late-bound non-region variables</div></details><details class="toggle method-toggle" open><summary><section id="method.has_bound_vars" class="method trait-impl"><a href="#method.has_bound_vars" class="anchor">§</a><h4 class="code-header">fn <a class="fn">has_bound_vars</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>True if there are any bound variables</div></details><details class="toggle method-toggle" open><summary><section id="method.still_further_specializable" class="method trait-impl"><a href="#method.still_further_specializable" class="anchor">§</a><h4 class="code-header">fn <a class="fn">still_further_specializable</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Indicates whether this value still has parameters/placeholders/inference variables |
| which could be replaced later, in a way that would change the results of <code>impl</code> |
| specialization.</div></details><details class="toggle method-toggle" open><summary><section id="method.has_non_region_error" class="method trait-impl"><a href="#method.has_non_region_error" class="anchor">§</a><h4 class="code-header">fn <a class="fn">has_non_region_error</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.99.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>True if a type or const error is reachable</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Upcast%3CI,+U%3E-for-T" class="impl"><a href="#impl-Upcast%3CI,+U%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<I, T, U> Upcast<I, U> for T<div class="where">where |
| U: UpcastFrom<I, T>,</div></h3></section></summary><div class="impl-items"><section id="method.upcast" class="method trait-impl"><a href="#method.upcast" class="anchor">§</a><h4 class="code-header">fn <a class="fn">upcast</a>(self, interner: I) -> U</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-UpcastFrom%3CI,+T%3E-for-T" class="impl"><a href="#impl-UpcastFrom%3CI,+T%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<I, T> UpcastFrom<I, T> for T</h3></section></summary><div class="impl-items"><section id="method.upcast_from" class="method trait-impl"><a href="#method.upcast_from" class="anchor">§</a><h4 class="code-header">fn <a class="fn">upcast_from</a>(from: T, _tcx: I) -> T</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-WithSubscriber-for-T" class="impl"><a href="#impl-WithSubscriber-for-T" class="anchor">§</a><h3 class="code-header">impl<T> WithSubscriber for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.with_subscriber" class="method trait-impl"><a href="#method.with_subscriber" class="anchor">§</a><h4 class="code-header">fn <a class="fn">with_subscriber</a><S>(self, subscriber: S) -> WithDispatch<Self> <a href="#" class="tooltip" data-notable-ty="WithDispatch<Self>">ⓘ</a><div class="where">where |
| S: <a class="trait" href="https://doc.rust-lang.org/1.99.1/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><Dispatch>,</div></h4></section></summary><div class='docblock'>Attaches the provided <a href="super::Subscriber"><code>Subscriber</code></a> to this type, returning a |
| [<code>WithDispatch</code>] wrapper. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.with_current_subscriber" class="method trait-impl"><a href="#method.with_current_subscriber" class="anchor">§</a><h4 class="code-header">fn <a class="fn">with_current_subscriber</a>(self) -> WithDispatch<Self> <a href="#" class="tooltip" data-notable-ty="WithDispatch<Self>">ⓘ</a></h4></section></summary><div class='docblock'>Attaches the current <a href="dispatcher#setting-the-default-subscriber">default</a> <a href="super::Subscriber"><code>Subscriber</code></a> to this type, returning a |
| [<code>WithDispatch</code>] wrapper. <a>Read more</a></div></details></div></details></div><script type="text/json" id="notable-traits-data">{"&'db [OutlivesPredicate<'db, GenericArg<'db>>]":"<h3>Notable traits for <code>&[<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.u8.html\">u8</a>]</code></h3><pre><code><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/alloc/io/read/trait.Read.html\" title=\"trait alloc::io::read::Read\">Read</a> for &[<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.u8.html\">u8</a>]</div>","&[u8]":"<h3>Notable traits for <code>&[<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.u8.html\">u8</a>]</code></h3><pre><code><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/alloc/io/read/trait.Read.html\" title=\"trait alloc::io::read::Read\">Read</a> for &[<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.u8.html\">u8</a>]</div>","<[T] as Concat<Item>>::Output":"<h3>Notable traits for <code>&mut [<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.u8.html\">u8</a>]</code></h3><pre><code><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/io/write/trait.Write.html\" title=\"trait core::io::write::Write\">Write</a> for &mut [<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.u8.html\">u8</a>]</div><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/alloc/io/read/trait.Read.html\" title=\"trait alloc::io::read::Read\">Read</a> for &[<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.u8.html\">u8</a>]</div>","<[T] as Join<Separator>>::Output":"<h3>Notable traits for <code>&mut [<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.u8.html\">u8</a>]</code></h3><pre><code><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/io/write/trait.Write.html\" title=\"trait core::io::write::Write\">Write</a> for &mut [<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.u8.html\">u8</a>]</div><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/alloc/io/read/trait.Read.html\" title=\"trait alloc::io::read::Read\">Read</a> for &[<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.u8.html\">u8</a>]</div>","ArrayWindows<'_, T, N>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.ArrayWindows.html\" title=\"struct core::slice::iter::ArrayWindows\">ArrayWindows</a><'a, T, N></code></h3><pre><code><div class=\"where\">impl<'a, T, const N: <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.usize.html\">usize</a>> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.ArrayWindows.html\" title=\"struct core::slice::iter::ArrayWindows\">ArrayWindows</a><'a, T, N></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = &'a <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.array.html\">[T; N]</a>;</div>","ChunkBy<'_, T, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.ChunkBy.html\" title=\"struct core::slice::iter::ChunkBy\">ChunkBy</a><'a, T, P></code></h3><pre><code><div class=\"where\">impl<'a, T, P> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.ChunkBy.html\" title=\"struct core::slice::iter::ChunkBy\">ChunkBy</a><'a, T, P><div class=\"where\">where\n T: 'a,\n P: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/ops/function/trait.FnMut.html\" title=\"trait core::ops::function::FnMut\">FnMut</a>(<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.reference.html\">&T</a>, <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.reference.html\">&T</a>) -> <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.bool.html\">bool</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = &'a <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.slice.html\">[T]</a>;</div>","Chunks<'_, T>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.Chunks.html\" title=\"struct core::slice::iter::Chunks\">Chunks</a><'a, T></code></h3><pre><code><div class=\"where\">impl<'a, T> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.Chunks.html\" title=\"struct core::slice::iter::Chunks\">Chunks</a><'a, T></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = &'a <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.slice.html\">[T]</a>;</div>","ChunksExact<'_, T>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.ChunksExact.html\" title=\"struct core::slice::iter::ChunksExact\">ChunksExact</a><'a, T></code></h3><pre><code><div class=\"where\">impl<'a, T> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.ChunksExact.html\" title=\"struct core::slice::iter::ChunksExact\">ChunksExact</a><'a, T></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = &'a <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.slice.html\">[T]</a>;</div>","Copied<Iter<'db, OutlivesPredicate<'db, GenericArg<'db>>>>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/adapters/copied/struct.Copied.html\" title=\"struct core::iter::adapters::copied::Copied\">Copied</a><I></code></h3><pre><code><div class=\"where\">impl<'a, I, T> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/adapters/copied/struct.Copied.html\" title=\"struct core::iter::adapters::copied::Copied\">Copied</a><I><div class=\"where\">where\n T: 'a + <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/marker/trait.Copy.html\" title=\"trait core::marker::Copy\">Copy</a>,\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a><Item = <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.reference.html\">&'a T</a>>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = T;</div>","Either<Self, Self>":"<h3>Notable traits for <code><a class=\"enum\" href=\"https://docs.rs/either/1/either/enum.Either.html\" title=\"enum either::Either\">Either</a><L, R></code></h3><pre><code><div class=\"where\">impl<L, R> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"enum\" href=\"https://docs.rs/either/1/either/enum.Either.html\" title=\"enum either::Either\">Either</a><L, R><div class=\"where\">where\n L: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>,\n R: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a><Item = <L as <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>>::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <L as <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>>::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>;</div><div class=\"where\">impl<L, R> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"enum\" href=\"https://docs.rs/either/1/either/enum.Either.html\" title=\"enum either::Either\">Either</a><L, R><div class=\"where\">where\n L: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>,\n R: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a><Output = <L as <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>>::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.99.1/core/future/future/trait.Future.html#associatedtype.Output\" title=\"type core::future::future::Future::Output\">Output</a>>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.99.1/core/future/future/trait.Future.html#associatedtype.Output\" class=\"associatedtype\">Output</a> = <L as <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>>::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.99.1/core/future/future/trait.Future.html#associatedtype.Output\" title=\"type core::future::future::Future::Output\">Output</a>;</div><div class=\"where\">impl<L, R> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/alloc/io/read/trait.Read.html\" title=\"trait alloc::io::read::Read\">Read</a> for <a class=\"enum\" href=\"https://docs.rs/either/1/either/enum.Either.html\" title=\"enum either::Either\">Either</a><L, R><div class=\"where\">where\n L: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/alloc/io/read/trait.Read.html\" title=\"trait alloc::io::read::Read\">Read</a>,\n R: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/alloc/io/read/trait.Read.html\" title=\"trait alloc::io::read::Read\">Read</a>,</div></div><div class=\"where\">impl<L, R> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/io/write/trait.Write.html\" title=\"trait core::io::write::Write\">Write</a> for <a class=\"enum\" href=\"https://docs.rs/either/1/either/enum.Either.html\" title=\"enum either::Either\">Either</a><L, R><div class=\"where\">where\n L: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/io/write/trait.Write.html\" title=\"trait core::io::write::Write\">Write</a>,\n R: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/io/write/trait.Write.html\" title=\"trait core::io::write::Write\">Write</a>,</div></div>","EscapeAscii<'_>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/ascii/struct.EscapeAscii.html\" title=\"struct core::slice::ascii::EscapeAscii\">EscapeAscii</a><'a></code></h3><pre><code><div class=\"where\">impl<'a> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/ascii/struct.EscapeAscii.html\" title=\"struct core::slice::ascii::EscapeAscii\">EscapeAscii</a><'a></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.u8.html\">u8</a>;</div>","Instrumented<Self>":"<h3>Notable traits for <code>Instrumented<T></code></h3><pre><code><div class=\"where\">impl<T> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for Instrumented<T><div class=\"where\">where\n T: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.99.1/core/future/future/trait.Future.html#associatedtype.Output\" class=\"associatedtype\">Output</a> = <T as <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>>::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.99.1/core/future/future/trait.Future.html#associatedtype.Output\" title=\"type core::future::future::Future::Output\">Output</a>;</div>","Iter<'_, T>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.Iter.html\" title=\"struct core::slice::iter::Iter\">Iter</a><'a, T></code></h3><pre><code><div class=\"where\">impl<'a, T> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.Iter.html\" title=\"struct core::slice::iter::Iter\">Iter</a><'a, T></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.reference.html\">&'a T</a>;</div>","RChunks<'_, T>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.RChunks.html\" title=\"struct core::slice::iter::RChunks\">RChunks</a><'a, T></code></h3><pre><code><div class=\"where\">impl<'a, T> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.RChunks.html\" title=\"struct core::slice::iter::RChunks\">RChunks</a><'a, T></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = &'a <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.slice.html\">[T]</a>;</div>","RChunksExact<'_, T>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.RChunksExact.html\" title=\"struct core::slice::iter::RChunksExact\">RChunksExact</a><'a, T></code></h3><pre><code><div class=\"where\">impl<'a, T> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.RChunksExact.html\" title=\"struct core::slice::iter::RChunksExact\">RChunksExact</a><'a, T></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = &'a <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.slice.html\">[T]</a>;</div>","RSplit<'_, T, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.RSplit.html\" title=\"struct core::slice::iter::RSplit\">RSplit</a><'a, T, P></code></h3><pre><code><div class=\"where\">impl<'a, T, P> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.RSplit.html\" title=\"struct core::slice::iter::RSplit\">RSplit</a><'a, T, P><div class=\"where\">where\n P: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/ops/function/trait.FnMut.html\" title=\"trait core::ops::function::FnMut\">FnMut</a>(<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.reference.html\">&T</a>) -> <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.bool.html\">bool</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = &'a <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.slice.html\">[T]</a>;</div>","RSplitN<'_, T, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.RSplitN.html\" title=\"struct core::slice::iter::RSplitN\">RSplitN</a><'a, T, P></code></h3><pre><code><div class=\"where\">impl<'a, T, P> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.RSplitN.html\" title=\"struct core::slice::iter::RSplitN\">RSplitN</a><'a, T, P><div class=\"where\">where\n P: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/ops/function/trait.FnMut.html\" title=\"trait core::ops::function::FnMut\">FnMut</a>(<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.reference.html\">&T</a>) -> <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.bool.html\">bool</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = &'a <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.slice.html\">[T]</a>;</div>","Range<*const T>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/ops/range/struct.Range.html\" title=\"struct core::ops::range::Range\">Range</a><A></code></h3><pre><code><div class=\"where\">impl<A> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/ops/range/struct.Range.html\" title=\"struct core::ops::range::Range\">Range</a><A><div class=\"where\">where\n A: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/range/trait.Step.html\" title=\"trait core::iter::range::Step\">Step</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = A;</div>","Split<'_, T, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.Split.html\" title=\"struct core::slice::iter::Split\">Split</a><'a, T, P></code></h3><pre><code><div class=\"where\">impl<'a, T, P> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.Split.html\" title=\"struct core::slice::iter::Split\">Split</a><'a, T, P><div class=\"where\">where\n P: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/ops/function/trait.FnMut.html\" title=\"trait core::ops::function::FnMut\">FnMut</a>(<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.reference.html\">&T</a>) -> <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.bool.html\">bool</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = &'a <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.slice.html\">[T]</a>;</div>","SplitInclusive<'_, T, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.SplitInclusive.html\" title=\"struct core::slice::iter::SplitInclusive\">SplitInclusive</a><'a, T, P></code></h3><pre><code><div class=\"where\">impl<'a, T, P> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.SplitInclusive.html\" title=\"struct core::slice::iter::SplitInclusive\">SplitInclusive</a><'a, T, P><div class=\"where\">where\n P: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/ops/function/trait.FnMut.html\" title=\"trait core::ops::function::FnMut\">FnMut</a>(<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.reference.html\">&T</a>) -> <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.bool.html\">bool</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = &'a <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.slice.html\">[T]</a>;</div>","SplitN<'_, T, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.SplitN.html\" title=\"struct core::slice::iter::SplitN\">SplitN</a><'a, T, P></code></h3><pre><code><div class=\"where\">impl<'a, T, P> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.SplitN.html\" title=\"struct core::slice::iter::SplitN\">SplitN</a><'a, T, P><div class=\"where\">where\n P: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/ops/function/trait.FnMut.html\" title=\"trait core::ops::function::FnMut\">FnMut</a>(<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.reference.html\">&T</a>) -> <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.bool.html\">bool</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = &'a <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.slice.html\">[T]</a>;</div>","Utf8Chunks<'_>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/str/lossy/struct.Utf8Chunks.html\" title=\"struct core::str::lossy::Utf8Chunks\">Utf8Chunks</a><'a></code></h3><pre><code><div class=\"where\">impl<'a> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/str/lossy/struct.Utf8Chunks.html\" title=\"struct core::str::lossy::Utf8Chunks\">Utf8Chunks</a><'a></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/str/lossy/struct.Utf8Chunk.html\" title=\"struct core::str::lossy::Utf8Chunk\">Utf8Chunk</a><'a>;</div>","Vec<u8>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/alloc/vec/struct.Vec.html\" title=\"struct alloc::vec::Vec\">Vec</a><<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.u8.html\">u8</a>, A></code></h3><pre><code><div class=\"where\">impl<A> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/io/write/trait.Write.html\" title=\"trait core::io::write::Write\">Write</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/alloc/vec/struct.Vec.html\" title=\"struct alloc::vec::Vec\">Vec</a><<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.u8.html\">u8</a>, A><div class=\"where\">where\n A: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/alloc/trait.Allocator.html\" title=\"trait core::alloc::Allocator\">Allocator</a>,</div></div>","Windows<'_, T>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.Windows.html\" title=\"struct core::slice::iter::Windows\">Windows</a><'a, T></code></h3><pre><code><div class=\"where\">impl<'a, T> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.99.1/core/slice/iter/struct.Windows.html\" title=\"struct core::slice::iter::Windows\">Windows</a><'a, T></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.99.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = &'a <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.99.1/std/primitive.slice.html\">[T]</a>;</div>","WithDispatch<Self>":"<h3>Notable traits for <code>WithDispatch<T></code></h3><pre><code><div class=\"where\">impl<T> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for WithDispatch<T><div class=\"where\">where\n T: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.99.1/core/future/future/trait.Future.html#associatedtype.Output\" class=\"associatedtype\">Output</a> = <T as <a class=\"trait\" href=\"https://doc.rust-lang.org/1.99.1/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>>::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.99.1/core/future/future/trait.Future.html#associatedtype.Output\" title=\"type core::future::future::Future::Output\">Output</a>;</div>"}</script></section></div></main></body></html> |