Files
GopherGate/target/doc/bytes/struct.BytesMut.html
2026-02-26 12:00:21 -05:00

2900 lines
710 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A unique reference to a contiguous slice of memory."><title>BytesMut in bytes - 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-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="bytes" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.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"><!--[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="#">BytesMut</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../bytes/index.html">bytes</a><span class="version">1.11.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Bytes<wbr>Mut</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#growth" title="Growth">Growth</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.capacity" title="capacity">capacity</a></li><li><a href="#method.clear" title="clear">clear</a></li><li><a href="#method.extend_from_slice" title="extend_from_slice">extend_from_slice</a></li><li><a href="#method.freeze" title="freeze">freeze</a></li><li><a href="#method.is_empty" title="is_empty">is_empty</a></li><li><a href="#method.len" title="len">len</a></li><li><a href="#method.new" title="new">new</a></li><li><a href="#method.reserve" title="reserve">reserve</a></li><li><a href="#method.resize" title="resize">resize</a></li><li><a href="#method.set_len" title="set_len">set_len</a></li><li><a href="#method.spare_capacity_mut" title="spare_capacity_mut">spare_capacity_mut</a></li><li><a href="#method.split" title="split">split</a></li><li><a href="#method.split_off" title="split_off">split_off</a></li><li><a href="#method.split_to" title="split_to">split_to</a></li><li><a href="#method.truncate" title="truncate">truncate</a></li><li><a href="#method.try_reclaim" title="try_reclaim">try_reclaim</a></li><li><a href="#method.unsplit" title="unsplit">unsplit</a></li><li><a href="#method.with_capacity" title="with_capacity">with_capacity</a></li><li><a href="#method.zeroed" title="zeroed">zeroed</a></li></ul><h3><a href="#deref-methods-%5Bu8%5D">Methods from Deref&lt;<wbr>Target=[u8]&gt;</a></h3><ul class="block deref-methods"><li><a href="#method.align_to" title="align_to">align_to</a></li><li><a href="#method.align_to_mut" title="align_to_mut">align_to_mut</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_chunks" title="as_chunks">as_chunks</a></li><li><a href="#method.as_chunks_mut" title="as_chunks_mut">as_chunks_mut</a></li><li><a href="#method.as_chunks_unchecked" title="as_chunks_unchecked">as_chunks_unchecked</a></li><li><a href="#method.as_chunks_unchecked_mut" title="as_chunks_unchecked_mut">as_chunks_unchecked_mut</a></li><li><a href="#method.as_mut_array" title="as_mut_array">as_mut_array</a></li><li><a href="#method.as_mut_ptr" title="as_mut_ptr">as_mut_ptr</a></li><li><a href="#method.as_mut_ptr_range" title="as_mut_ptr_range">as_mut_ptr_range</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_rchunks_mut" title="as_rchunks_mut">as_rchunks_mut</a></li><li><a href="#method.as_simd" title="as_simd">as_simd</a></li><li><a href="#method.as_simd_mut" title="as_simd_mut">as_simd_mut</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.chunk_by_mut" title="chunk_by_mut">chunk_by_mut</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.chunks_exact_mut" title="chunks_exact_mut">chunks_exact_mut</a></li><li><a href="#method.chunks_mut" title="chunks_mut">chunks_mut</a></li><li><a href="#method.clone_from_slice" title="clone_from_slice">clone_from_slice</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.copy_from_slice" title="copy_from_slice">copy_from_slice</a></li><li><a href="#method.copy_within" title="copy_within">copy_within</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.fill" title="fill">fill</a></li><li><a href="#method.fill_with" title="fill_with">fill_with</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.first_chunk_mut" title="first_chunk_mut">first_chunk_mut</a></li><li><a href="#method.first_mut" title="first_mut">first_mut</a></li><li><a href="#method.get" title="get">get</a></li><li><a href="#method.get_disjoint_mut" title="get_disjoint_mut">get_disjoint_mut</a></li><li><a href="#method.get_disjoint_unchecked_mut" title="get_disjoint_unchecked_mut">get_disjoint_unchecked_mut</a></li><li><a href="#method.get_mut" title="get_mut">get_mut</a></li><li><a href="#method.get_unchecked" title="get_unchecked">get_unchecked</a></li><li><a href="#method.get_unchecked_mut" title="get_unchecked_mut">get_unchecked_mut</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" title="iter">iter</a></li><li><a href="#method.iter_mut" title="iter_mut">iter_mut</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.last_chunk_mut" title="last_chunk_mut">last_chunk_mut</a></li><li><a href="#method.last_mut" title="last_mut">last_mut</a></li><li><a href="#method.len-1" title="len">len</a></li><li><a href="#method.make_ascii_lowercase" title="make_ascii_lowercase">make_ascii_lowercase</a></li><li><a href="#method.make_ascii_uppercase" title="make_ascii_uppercase">make_ascii_uppercase</a></li><li><a href="#method.partition_dedup" title="partition_dedup">partition_dedup</a></li><li><a href="#method.partition_dedup_by" title="partition_dedup_by">partition_dedup_by</a></li><li><a href="#method.partition_dedup_by_key" title="partition_dedup_by_key">partition_dedup_by_key</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.rchunks_exact_mut" title="rchunks_exact_mut">rchunks_exact_mut</a></li><li><a href="#method.rchunks_mut" title="rchunks_mut">rchunks_mut</a></li><li><a href="#method.repeat" title="repeat">repeat</a></li><li><a href="#method.reverse" title="reverse">reverse</a></li><li><a href="#method.rotate_left" title="rotate_left">rotate_left</a></li><li><a href="#method.rotate_right" title="rotate_right">rotate_right</a></li><li><a href="#method.rsplit" title="rsplit">rsplit</a></li><li><a href="#method.rsplit_mut" title="rsplit_mut">rsplit_mut</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.rsplitn_mut" title="rsplitn_mut">rsplitn_mut</a></li><li><a href="#method.select_nth_unstable" title="select_nth_unstable">select_nth_unstable</a></li><li><a href="#method.select_nth_unstable_by" title="select_nth_unstable_by">select_nth_unstable_by</a></li><li><a href="#method.select_nth_unstable_by_key" title="select_nth_unstable_by_key">select_nth_unstable_by_key</a></li><li><a href="#method.sort" title="sort">sort</a></li><li><a href="#method.sort_by" title="sort_by">sort_by</a></li><li><a href="#method.sort_by_cached_key" title="sort_by_cached_key">sort_by_cached_key</a></li><li><a href="#method.sort_by_key" title="sort_by_key">sort_by_key</a></li><li><a href="#method.sort_unstable" title="sort_unstable">sort_unstable</a></li><li><a href="#method.sort_unstable_by" title="sort_unstable_by">sort_unstable_by</a></li><li><a href="#method.sort_unstable_by_key" title="sort_unstable_by_key">sort_unstable_by_key</a></li><li><a href="#method.split-1" 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_mut" title="split_at_mut">split_at_mut</a></li><li><a href="#method.split_at_mut_checked" title="split_at_mut_checked">split_at_mut_checked</a></li><li><a href="#method.split_at_mut_unchecked" title="split_at_mut_unchecked">split_at_mut_unchecked</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_first_chunk_mut" title="split_first_chunk_mut">split_first_chunk_mut</a></li><li><a href="#method.split_first_mut" title="split_first_mut">split_first_mut</a></li><li><a href="#method.split_inclusive" title="split_inclusive">split_inclusive</a></li><li><a href="#method.split_inclusive_mut" title="split_inclusive_mut">split_inclusive_mut</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_last_chunk_mut" title="split_last_chunk_mut">split_last_chunk_mut</a></li><li><a href="#method.split_last_mut" title="split_last_mut">split_last_mut</a></li><li><a href="#method.split_mut" title="split_mut">split_mut</a></li><li><a href="#method.split_off-1" title="split_off">split_off</a></li><li><a href="#method.split_off_first" title="split_off_first">split_off_first</a></li><li><a href="#method.split_off_first_mut" title="split_off_first_mut">split_off_first_mut</a></li><li><a href="#method.split_off_last" title="split_off_last">split_off_last</a></li><li><a href="#method.split_off_last_mut" title="split_off_last_mut">split_off_last_mut</a></li><li><a href="#method.split_off_mut" title="split_off_mut">split_off_mut</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.splitn_mut" title="splitn_mut">splitn_mut</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.swap" title="swap">swap</a></li><li><a href="#method.swap_unchecked" title="swap_unchecked">swap_unchecked</a></li><li><a href="#method.swap_with_slice" title="swap_with_slice">swap_with_slice</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-AsMut%3C%5Bu8%5D%3E-for-BytesMut" title="AsMut&#60;[u8]&#62;">AsMut&#60;[u8]&#62;</a></li><li><a href="#impl-AsRef%3C%5Bu8%5D%3E-for-BytesMut" title="AsRef&#60;[u8]&#62;">AsRef&#60;[u8]&#62;</a></li><li><a href="#impl-Borrow%3C%5Bu8%5D%3E-for-BytesMut" title="Borrow&#60;[u8]&#62;">Borrow&#60;[u8]&#62;</a></li><li><a href="#impl-BorrowMut%3C%5Bu8%5D%3E-for-BytesMut" title="BorrowMut&#60;[u8]&#62;">BorrowMut&#60;[u8]&#62;</a></li><li><a href="#impl-Buf-for-BytesMut" title="Buf">Buf</a></li><li><a href="#impl-BufMut-for-BytesMut" title="BufMut">BufMut</a></li><li><a href="#impl-Clone-for-BytesMut" title="Clone">Clone</a></li><li><a href="#impl-Debug-for-BytesMut" title="Debug">Debug</a></li><li><a href="#impl-Default-for-BytesMut" title="Default">Default</a></li><li><a href="#impl-Deref-for-BytesMut" title="Deref">Deref</a></li><li><a href="#impl-DerefMut-for-BytesMut" title="DerefMut">DerefMut</a></li><li><a href="#impl-Drop-for-BytesMut" title="Drop">Drop</a></li><li><a href="#impl-Eq-for-BytesMut" title="Eq">Eq</a></li><li><a href="#impl-Extend%3C%26u8%3E-for-BytesMut" title="Extend&#60;&#38;&#39;a u8&#62;">Extend&#60;&#38;&#39;a u8&#62;</a></li><li><a href="#impl-Extend%3CBytes%3E-for-BytesMut" title="Extend&#60;Bytes&#62;">Extend&#60;Bytes&#62;</a></li><li><a href="#impl-Extend%3Cu8%3E-for-BytesMut" title="Extend&#60;u8&#62;">Extend&#60;u8&#62;</a></li><li><a href="#impl-From%3C%26%5Bu8%5D%3E-for-BytesMut" title="From&#60;&#38;&#39;a [u8]&#62;">From&#60;&#38;&#39;a [u8]&#62;</a></li><li><a href="#impl-From%3C%26str%3E-for-BytesMut" title="From&#60;&#38;&#39;a str&#62;">From&#60;&#38;&#39;a str&#62;</a></li><li><a href="#impl-From%3CBytes%3E-for-BytesMut" title="From&#60;Bytes&#62;">From&#60;Bytes&#62;</a></li><li><a href="#impl-From%3CBytesMut%3E-for-Bytes" title="From&#60;BytesMut&#62;">From&#60;BytesMut&#62;</a></li><li><a href="#impl-From%3CBytesMut%3E-for-Vec%3Cu8%3E" title="From&#60;BytesMut&#62;">From&#60;BytesMut&#62;</a></li><li><a href="#impl-FromIterator%3C%26u8%3E-for-BytesMut" title="FromIterator&#60;&#38;&#39;a u8&#62;">FromIterator&#60;&#38;&#39;a u8&#62;</a></li><li><a href="#impl-FromIterator%3Cu8%3E-for-BytesMut" title="FromIterator&#60;u8&#62;">FromIterator&#60;u8&#62;</a></li><li><a href="#impl-Hash-for-BytesMut" title="Hash">Hash</a></li><li><a href="#impl-IntoIterator-for-%26BytesMut" title="IntoIterator">IntoIterator</a></li><li><a href="#impl-IntoIterator-for-BytesMut" title="IntoIterator">IntoIterator</a></li><li><a href="#impl-LowerHex-for-BytesMut" title="LowerHex">LowerHex</a></li><li><a href="#impl-Ord-for-BytesMut" title="Ord">Ord</a></li><li><a href="#impl-PartialEq-for-BytesMut" title="PartialEq">PartialEq</a></li><li><a href="#impl-PartialEq%3C%26T%3E-for-BytesMut" title="PartialEq&#60;&#38;&#39;a T&#62;">PartialEq&#60;&#38;&#39;a T&#62;</a></li><li><a href="#impl-PartialEq%3CBytes%3E-for-BytesMut" title="PartialEq&#60;Bytes&#62;">PartialEq&#60;Bytes&#62;</a></li><li><a href="#impl-PartialEq%3CBytesMut%3E-for-%26%5Bu8%5D" title="PartialEq&#60;BytesMut&#62;">PartialEq&#60;BytesMut&#62;</a></li><li><a href="#impl-PartialEq%3CBytesMut%3E-for-%26str" title="PartialEq&#60;BytesMut&#62;">PartialEq&#60;BytesMut&#62;</a></li><li><a href="#impl-PartialEq%3CBytesMut%3E-for-%5Bu8%5D" title="PartialEq&#60;BytesMut&#62;">PartialEq&#60;BytesMut&#62;</a></li><li><a href="#impl-PartialEq%3CBytesMut%3E-for-Bytes" title="PartialEq&#60;BytesMut&#62;">PartialEq&#60;BytesMut&#62;</a></li><li><a href="#impl-PartialEq%3CBytesMut%3E-for-String" title="PartialEq&#60;BytesMut&#62;">PartialEq&#60;BytesMut&#62;</a></li><li><a href="#impl-PartialEq%3CBytesMut%3E-for-Vec%3Cu8%3E" title="PartialEq&#60;BytesMut&#62;">PartialEq&#60;BytesMut&#62;</a></li><li><a href="#impl-PartialEq%3CBytesMut%3E-for-str" title="PartialEq&#60;BytesMut&#62;">PartialEq&#60;BytesMut&#62;</a></li><li><a href="#impl-PartialEq%3CString%3E-for-BytesMut" title="PartialEq&#60;String&#62;">PartialEq&#60;String&#62;</a></li><li><a href="#impl-PartialEq%3CVec%3Cu8%3E%3E-for-BytesMut" title="PartialEq&#60;Vec&#60;u8&#62;&#62;">PartialEq&#60;Vec&#60;u8&#62;&#62;</a></li><li><a href="#impl-PartialEq%3C%5Bu8%5D%3E-for-BytesMut" title="PartialEq&#60;[u8]&#62;">PartialEq&#60;[u8]&#62;</a></li><li><a href="#impl-PartialEq%3Cstr%3E-for-BytesMut" title="PartialEq&#60;str&#62;">PartialEq&#60;str&#62;</a></li><li><a href="#impl-PartialOrd-for-BytesMut" title="PartialOrd">PartialOrd</a></li><li><a href="#impl-PartialOrd%3C%26T%3E-for-BytesMut" title="PartialOrd&#60;&#38;&#39;a T&#62;">PartialOrd&#60;&#38;&#39;a T&#62;</a></li><li><a href="#impl-PartialOrd%3CBytesMut%3E-for-%26%5Bu8%5D" title="PartialOrd&#60;BytesMut&#62;">PartialOrd&#60;BytesMut&#62;</a></li><li><a href="#impl-PartialOrd%3CBytesMut%3E-for-%26str" title="PartialOrd&#60;BytesMut&#62;">PartialOrd&#60;BytesMut&#62;</a></li><li><a href="#impl-PartialOrd%3CBytesMut%3E-for-%5Bu8%5D" title="PartialOrd&#60;BytesMut&#62;">PartialOrd&#60;BytesMut&#62;</a></li><li><a href="#impl-PartialOrd%3CBytesMut%3E-for-String" title="PartialOrd&#60;BytesMut&#62;">PartialOrd&#60;BytesMut&#62;</a></li><li><a href="#impl-PartialOrd%3CBytesMut%3E-for-Vec%3Cu8%3E" title="PartialOrd&#60;BytesMut&#62;">PartialOrd&#60;BytesMut&#62;</a></li><li><a href="#impl-PartialOrd%3CBytesMut%3E-for-str" title="PartialOrd&#60;BytesMut&#62;">PartialOrd&#60;BytesMut&#62;</a></li><li><a href="#impl-PartialOrd%3CString%3E-for-BytesMut" title="PartialOrd&#60;String&#62;">PartialOrd&#60;String&#62;</a></li><li><a href="#impl-PartialOrd%3CVec%3Cu8%3E%3E-for-BytesMut" title="PartialOrd&#60;Vec&#60;u8&#62;&#62;">PartialOrd&#60;Vec&#60;u8&#62;&#62;</a></li><li><a href="#impl-PartialOrd%3C%5Bu8%5D%3E-for-BytesMut" title="PartialOrd&#60;[u8]&#62;">PartialOrd&#60;[u8]&#62;</a></li><li><a href="#impl-PartialOrd%3Cstr%3E-for-BytesMut" title="PartialOrd&#60;str&#62;">PartialOrd&#60;str&#62;</a></li><li><a href="#impl-Send-for-BytesMut" title="Send">Send</a></li><li><a href="#impl-Sync-for-BytesMut" title="Sync">Sync</a></li><li><a href="#impl-UpperHex-for-BytesMut" title="UpperHex">UpperHex</a></li><li><a href="#impl-Write-for-BytesMut" title="Write">Write</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-Freeze-for-BytesMut" title="Freeze">Freeze</a></li><li><a href="#impl-RefUnwindSafe-for-BytesMut" title="RefUnwindSafe">RefUnwindSafe</a></li><li><a href="#impl-Unpin-for-BytesMut" title="Unpin">Unpin</a></li><li><a href="#impl-UnwindSafe-for-BytesMut" 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&#60;T&#62;">Borrow&#60;T&#62;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T" title="BorrowMut&#60;T&#62;">BorrowMut&#60;T&#62;</a></li><li><a href="#impl-CloneToUninit-for-T" title="CloneToUninit">CloneToUninit</a></li><li><a href="#impl-From%3CT%3E-for-T" title="From&#60;T&#62;">From&#60;T&#62;</a></li><li><a href="#impl-Into%3CU%3E-for-T" title="Into&#60;U&#62;">Into&#60;U&#62;</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&#60;U&#62;">TryFrom&#60;U&#62;</a></li><li><a href="#impl-TryInto%3CU%3E-for-T" title="TryInto&#60;U&#62;">TryInto&#60;U&#62;</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate bytes</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"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="index.html">bytes</a></div><h1>Struct <span class="struct">Bytes<wbr>Mut</span>&nbsp;<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/bytes/bytes_mut.rs.html#60-65">Source</a> </span></div><pre class="rust item-decl"><code>pub struct BytesMut { <span class="comment">/* private fields */</span> }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A unique reference to a contiguous slice of memory.</p>
<p><code>BytesMut</code> represents a unique view into a potentially shared memory region.
Given the uniqueness guarantee, owners of <code>BytesMut</code> handles are able to
mutate the memory.</p>
<p><code>BytesMut</code> can be thought of as containing a <code>buf: Arc&lt;Vec&lt;u8&gt;&gt;</code>, an offset
into <code>buf</code>, a slice length, and a guarantee that no other <code>BytesMut</code> for the
same <code>buf</code> overlaps with its slice. That guarantee means that a write lock
is not required.</p>
<h2 id="growth"><a class="doc-anchor" href="#growth">§</a>Growth</h2>
<p><code>BytesMut</code>s <code>BufMut</code> implementation will implicitly grow its buffer as
necessary. However, explicitly reserving the required space up-front before
a series of inserts will be more efficient.</p>
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::{BytesMut, BufMut};
<span class="kw">let </span><span class="kw-2">mut </span>buf = BytesMut::with_capacity(<span class="number">64</span>);
buf.put_u8(<span class="string">b'h'</span>);
buf.put_u8(<span class="string">b'e'</span>);
buf.put(<span class="kw-2">&amp;</span><span class="string">b"llo"</span>[..]);
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>buf[..], <span class="string">b"hello"</span>);
<span class="comment">// Freeze the buffer so that it can be shared
</span><span class="kw">let </span>a = buf.freeze();
<span class="comment">// This does not allocate, instead `b` points to the same memory.
</span><span class="kw">let </span>b = a.clone();
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>a[..], <span class="string">b"hello"</span>);
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>b[..], <span class="string">b"hello"</span>);</code></pre></div></div></details><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-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#123-1124">Source</a><a href="#impl-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.with_capacity" class="method"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#147-149">Source</a><h4 class="code-header">pub fn <a href="#method.with_capacity" class="fn">with_capacity</a>(capacity: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h4></section></summary><div class="docblock"><p>Creates a new <code>BytesMut</code> with the specified capacity.</p>
<p>The returned <code>BytesMut</code> will be able to hold at least <code>capacity</code> bytes
without reallocating.</p>
<p>It is important to note that this function does not specify the length
of the returned <code>BytesMut</code>, but only the capacity.</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">use </span>bytes::{BytesMut, BufMut};
<span class="kw">let </span><span class="kw-2">mut </span>bytes = BytesMut::with_capacity(<span class="number">64</span>);
<span class="comment">// `bytes` contains no data, even though there is capacity
</span><span class="macro">assert_eq!</span>(bytes.len(), <span class="number">0</span>);
bytes.put(<span class="kw-2">&amp;</span><span class="string">b"hello world"</span>[..]);
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>bytes[..], <span class="string">b"hello world"</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#171-173">Source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -&gt; <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h4></section></summary><div class="docblock"><p>Creates a new <code>BytesMut</code> with default capacity.</p>
<p>Resulting object has length 0 and unspecified capacity.
This function does not allocate.</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="kw">use </span>bytes::{BytesMut, BufMut};
<span class="kw">let </span><span class="kw-2">mut </span>bytes = BytesMut::new();
<span class="macro">assert_eq!</span>(<span class="number">0</span>, bytes.len());
bytes.reserve(<span class="number">2</span>);
bytes.put_slice(<span class="string">b"xy"</span>);
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span><span class="string">b"xy"</span>[..], <span class="kw-2">&amp;</span>bytes[..]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.len" class="method"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#186-188">Source</a><h4 class="code-header">pub fn <a href="#method.len" class="fn">len</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Returns the number of bytes contained in this <code>BytesMut</code>.</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="kw">use </span>bytes::BytesMut;
<span class="kw">let </span>b = BytesMut::from(<span class="kw-2">&amp;</span><span class="string">b"hello"</span>[..]);
<span class="macro">assert_eq!</span>(b.len(), <span class="number">5</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.is_empty" class="method"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#201-203">Source</a><h4 class="code-header">pub fn <a href="#method.is_empty" class="fn">is_empty</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Returns true if the <code>BytesMut</code> has a length of 0.</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="kw">use </span>bytes::BytesMut;
<span class="kw">let </span>b = BytesMut::with_capacity(<span class="number">64</span>);
<span class="macro">assert!</span>(b.is_empty());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.capacity" class="method"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#216-218">Source</a><h4 class="code-header">pub fn <a href="#method.capacity" class="fn">capacity</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Returns the number of bytes the <code>BytesMut</code> can hold without reallocating.</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">use </span>bytes::BytesMut;
<span class="kw">let </span>b = BytesMut::with_capacity(<span class="number">64</span>);
<span class="macro">assert_eq!</span>(b.capacity(), <span class="number">64</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.freeze" class="method"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#245-264">Source</a><h4 class="code-header">pub fn <a href="#method.freeze" class="fn">freeze</a>(self) -&gt; <a class="struct" href="struct.Bytes.html" title="struct bytes::Bytes">Bytes</a></h4></section></summary><div class="docblock"><p>Converts <code>self</code> into an immutable <code>Bytes</code>.</p>
<p>The conversion is zero cost and is used to indicate that the slice
referenced by the handle will no longer be mutated. Once the conversion
is done, the handle can be cloned and shared across threads.</p>
<h5 id="examples-6"><a class="doc-anchor" href="#examples-6">§</a>Examples</h5>
<div class="example-wrap ignore"><a href="#" class="tooltip" title="This example is not tested on wasm"></a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::{BytesMut, BufMut};
<span class="kw">use </span>std::thread;
<span class="kw">let </span><span class="kw-2">mut </span>b = BytesMut::with_capacity(<span class="number">64</span>);
b.put(<span class="kw-2">&amp;</span><span class="string">b"hello world"</span>[..]);
<span class="kw">let </span>b1 = b.freeze();
<span class="kw">let </span>b2 = b1.clone();
<span class="kw">let </span>th = thread::spawn(<span class="kw">move </span>|| {
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>b1[..], <span class="string">b"hello world"</span>);
});
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>b2[..], <span class="string">b"hello world"</span>);
th.join().unwrap();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.zeroed" class="method"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#286-288">Source</a><h4 class="code-header">pub fn <a href="#method.zeroed" class="fn">zeroed</a>(len: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h4></section></summary><div class="docblock"><p>Creates a new <code>BytesMut</code> containing <code>len</code> zeros.</p>
<p>The resulting object has a length of <code>len</code> and a capacity greater
than or equal to <code>len</code>. The entire length of the object will be filled
with zeros.</p>
<p>On some platforms or allocators this function may be faster than
a manual implementation.</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">use </span>bytes::BytesMut;
<span class="kw">let </span>zeros = BytesMut::zeroed(<span class="number">42</span>);
<span class="macro">assert!</span>(zeros.capacity() &gt;= <span class="number">42</span>);
<span class="macro">assert_eq!</span>(zeros.len(), <span class="number">42</span>);
zeros.into_iter().for_each(|x| <span class="macro">assert_eq!</span>(x, <span class="number">0</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_off" class="method"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#319-334">Source</a><h4 class="code-header">pub fn <a href="#method.split_off" class="fn">split_off</a>(&amp;mut self, at: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h4></section></summary><div class="docblock"><p>Splits the bytes into two at the given index.</p>
<p>Afterwards <code>self</code> contains elements <code>[0, at)</code>, and the returned
<code>BytesMut</code> contains elements <code>[at, capacity)</code>. Its guaranteed that the
memory does not move, that is, the address of <code>self</code> does not change,
and the address of the returned slice is <code>at</code> bytes after that.</p>
<p>This is an <code>O(1)</code> operation that just increases the reference count
and sets a few indices.</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">use </span>bytes::BytesMut;
<span class="kw">let </span><span class="kw-2">mut </span>a = BytesMut::from(<span class="kw-2">&amp;</span><span class="string">b"hello world"</span>[..]);
<span class="kw">let </span><span class="kw-2">mut </span>b = a.split_off(<span class="number">5</span>);
a[<span class="number">0</span>] = <span class="string">b'j'</span>;
b[<span class="number">0</span>] = <span class="string">b'!'</span>;
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>a[..], <span class="string">b"jello"</span>);
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>b[..], <span class="string">b"!world"</span>);</code></pre></div><h5 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h5>
<p>Panics if <code>at &gt; capacity</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.split" class="method"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#362-365">Source</a><h4 class="code-header">pub fn <a href="#method.split" class="fn">split</a>(&amp;mut self) -&gt; <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h4></section></summary><div class="docblock"><p>Removes the bytes from the current view, returning them in a new
<code>BytesMut</code> handle.</p>
<p>Afterwards, <code>self</code> will be empty, but will retain any additional
capacity that it had before the operation. This is identical to
<code>self.split_to(self.len())</code>.</p>
<p>This is an <code>O(1)</code> operation that just increases the reference count and
sets a few indices.</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">use </span>bytes::{BytesMut, BufMut};
<span class="kw">let </span><span class="kw-2">mut </span>buf = BytesMut::with_capacity(<span class="number">1024</span>);
buf.put(<span class="kw-2">&amp;</span><span class="string">b"hello world"</span>[..]);
<span class="kw">let </span>other = buf.split();
<span class="macro">assert!</span>(buf.is_empty());
<span class="macro">assert_eq!</span>(<span class="number">1013</span>, buf.capacity());
<span class="macro">assert_eq!</span>(other, <span class="string">b"hello world"</span>[..]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_to" class="method"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#394-411">Source</a><h4 class="code-header">pub fn <a href="#method.split_to" class="fn">split_to</a>(&amp;mut self, at: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h4></section></summary><div class="docblock"><p>Splits the buffer into two at the given index.</p>
<p>Afterwards <code>self</code> contains elements <code>[at, len)</code>, and the returned <code>BytesMut</code>
contains elements <code>[0, at)</code>.</p>
<p>This is an <code>O(1)</code> operation that just increases the reference count and
sets a few indices.</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">use </span>bytes::BytesMut;
<span class="kw">let </span><span class="kw-2">mut </span>a = BytesMut::from(<span class="kw-2">&amp;</span><span class="string">b"hello world"</span>[..]);
<span class="kw">let </span><span class="kw-2">mut </span>b = a.split_to(<span class="number">5</span>);
a[<span class="number">0</span>] = <span class="string">b'!'</span>;
b[<span class="number">0</span>] = <span class="string">b'j'</span>;
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>a[..], <span class="string">b"!world"</span>);
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>b[..], <span class="string">b"jello"</span>);</code></pre></div><h5 id="panics-1"><a class="doc-anchor" href="#panics-1">§</a>Panics</h5>
<p>Panics if <code>at &gt; len</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.truncate" class="method"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#433-438">Source</a><h4 class="code-header">pub fn <a href="#method.truncate" class="fn">truncate</a>(&amp;mut self, len: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Shortens the buffer, keeping the first <code>len</code> bytes and dropping the
rest.</p>
<p>If <code>len</code> is greater than the buffers current length, this has no
effect.</p>
<p>Existing underlying capacity is preserved.</p>
<p>The <a href="struct.BytesMut.html#method.split_off" title="method bytes::BytesMut::split_off">split_off</a> method can emulate <code>truncate</code>, but this causes the
excess bytes to be returned instead of dropped.</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">use </span>bytes::BytesMut;
<span class="kw">let </span><span class="kw-2">mut </span>buf = BytesMut::from(<span class="kw-2">&amp;</span><span class="string">b"hello world"</span>[..]);
buf.truncate(<span class="number">5</span>);
<span class="macro">assert_eq!</span>(buf, <span class="string">b"hello"</span>[..]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.clear" class="method"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#451-454">Source</a><h4 class="code-header">pub fn <a href="#method.clear" class="fn">clear</a>(&amp;mut self)</h4></section></summary><div class="docblock"><p>Clears the buffer, removing all data. Existing capacity is preserved.</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">use </span>bytes::BytesMut;
<span class="kw">let </span><span class="kw-2">mut </span>buf = BytesMut::from(<span class="kw-2">&amp;</span><span class="string">b"hello world"</span>[..]);
buf.clear();
<span class="macro">assert!</span>(buf.is_empty());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.resize" class="method"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#478-499">Source</a><h4 class="code-header">pub fn <a href="#method.resize" class="fn">resize</a>(&amp;mut self, new_len: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>, value: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>)</h4></section></summary><div class="docblock"><p>Resizes the buffer so that <code>len</code> is equal to <code>new_len</code>.</p>
<p>If <code>new_len</code> is greater than <code>len</code>, the buffer is extended by the
difference with each additional byte set to <code>value</code>. If <code>new_len</code> is
less than <code>len</code>, the buffer is simply truncated.</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">use </span>bytes::BytesMut;
<span class="kw">let </span><span class="kw-2">mut </span>buf = BytesMut::new();
buf.resize(<span class="number">3</span>, <span class="number">0x1</span>);
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>buf[..], <span class="kw-2">&amp;</span>[<span class="number">0x1</span>, <span class="number">0x1</span>, <span class="number">0x1</span>]);
buf.resize(<span class="number">2</span>, <span class="number">0x2</span>);
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>buf[..], <span class="kw-2">&amp;</span>[<span class="number">0x1</span>, <span class="number">0x1</span>]);
buf.resize(<span class="number">4</span>, <span class="number">0x3</span>);
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>buf[..], <span class="kw-2">&amp;</span>[<span class="number">0x1</span>, <span class="number">0x1</span>, <span class="number">0x3</span>, <span class="number">0x3</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.set_len" class="method"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#527-530">Source</a><h4 class="code-header">pub unsafe fn <a href="#method.set_len" class="fn">set_len</a>(&amp;mut self, len: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Sets the length of the buffer.</p>
<p>This will explicitly set the size of the buffer without actually
modifying the data, so it is up to the caller to ensure that the data
has been initialized.</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">use </span>bytes::BytesMut;
<span class="kw">let </span><span class="kw-2">mut </span>b = BytesMut::from(<span class="kw-2">&amp;</span><span class="string">b"hello world"</span>[..]);
<span class="kw">unsafe </span>{
b.set_len(<span class="number">5</span>);
}
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>b[..], <span class="string">b"hello"</span>);
<span class="kw">unsafe </span>{
b.set_len(<span class="number">11</span>);
}
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>b[..], <span class="string">b"hello world"</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.reserve" class="method"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#591-603">Source</a><h4 class="code-header">pub fn <a href="#method.reserve" class="fn">reserve</a>(&amp;mut self, additional: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Reserves capacity for at least <code>additional</code> more bytes to be inserted
into the given <code>BytesMut</code>.</p>
<p>More than <code>additional</code> bytes may be reserved in order to avoid frequent
reallocations. A call to <code>reserve</code> may result in an allocation.</p>
<p>Before allocating new buffer space, the function will attempt to reclaim
space in the existing buffer. If the current handle references a view
into a larger original buffer, and all other handles referencing part
of the same original buffer have been dropped, then the current view
can be copied/shifted to the front of the buffer and the handle can take
ownership of the full buffer, provided that the full buffer is large
enough to fit the requested additional capacity.</p>
<p>This optimization will only happen if shifting the data from the current
view to the front of the buffer is not too expensive in terms of the
(amortized) time required. The precise condition is subject to change;
as of now, the length of the data being shifted needs to be at least as
large as the distance that its shifted by. If the current view is empty
and the original buffer is large enough to fit the requested additional
capacity, then reallocations will never happen.</p>
<h5 id="examples-15"><a class="doc-anchor" href="#examples-15">§</a>Examples</h5>
<p>In the following example, a new buffer is allocated.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::BytesMut;
<span class="kw">let </span><span class="kw-2">mut </span>buf = BytesMut::from(<span class="kw-2">&amp;</span><span class="string">b"hello"</span>[..]);
buf.reserve(<span class="number">64</span>);
<span class="macro">assert!</span>(buf.capacity() &gt;= <span class="number">69</span>);</code></pre></div>
<p>In the following example, the existing buffer is reclaimed.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::{BytesMut, BufMut};
<span class="kw">let </span><span class="kw-2">mut </span>buf = BytesMut::with_capacity(<span class="number">128</span>);
buf.put(<span class="kw-2">&amp;</span>[<span class="number">0</span>; <span class="number">64</span>][..]);
<span class="kw">let </span>ptr = buf.as_ptr();
<span class="kw">let </span>other = buf.split();
<span class="macro">assert!</span>(buf.is_empty());
<span class="macro">assert_eq!</span>(buf.capacity(), <span class="number">64</span>);
drop(other);
buf.reserve(<span class="number">128</span>);
<span class="macro">assert_eq!</span>(buf.capacity(), <span class="number">128</span>);
<span class="macro">assert_eq!</span>(buf.as_ptr(), ptr);</code></pre></div><h5 id="panics-2"><a class="doc-anchor" href="#panics-2">§</a>Panics</h5>
<p>Panics if the new capacity overflows <code>usize</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_reclaim" class="method"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#836-847">Source</a><h4 class="code-header">pub fn <a href="#method.try_reclaim" class="fn">try_reclaim</a>(&amp;mut self, additional: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Attempts to cheaply reclaim already allocated capacity for at least <code>additional</code> more
bytes to be inserted into the given <code>BytesMut</code> and returns <code>true</code> if it succeeded.</p>
<p><code>try_reclaim</code> behaves exactly like <code>reserve</code>, except that it never allocates new storage
and returns a <code>bool</code> indicating whether it was successful in doing so:</p>
<p><code>try_reclaim</code> returns false under these conditions:</p>
<ul>
<li>The spare capacity left is less than <code>additional</code> bytes AND</li>
<li>The existing allocation cannot be reclaimed cheaply or it was less than
<code>additional</code> bytes in size</li>
</ul>
<p>Reclaiming the allocation cheaply is possible if the <code>BytesMut</code> has no outstanding
references through other <code>BytesMut</code>s or <code>Bytes</code> which point to the same underlying
storage.</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">use </span>bytes::BytesMut;
<span class="kw">let </span><span class="kw-2">mut </span>buf = BytesMut::with_capacity(<span class="number">64</span>);
<span class="macro">assert_eq!</span>(<span class="bool-val">true</span>, buf.try_reclaim(<span class="number">64</span>));
<span class="macro">assert_eq!</span>(<span class="number">64</span>, buf.capacity());
buf.extend_from_slice(<span class="string">b"abcd"</span>);
<span class="kw">let </span><span class="kw-2">mut </span>split = buf.split();
<span class="macro">assert_eq!</span>(<span class="number">60</span>, buf.capacity());
<span class="macro">assert_eq!</span>(<span class="number">4</span>, split.capacity());
<span class="macro">assert_eq!</span>(<span class="bool-val">false</span>, split.try_reclaim(<span class="number">64</span>));
<span class="macro">assert_eq!</span>(<span class="bool-val">false</span>, buf.try_reclaim(<span class="number">64</span>));
<span class="comment">// The split buffer is filled with "abcd"
</span><span class="macro">assert_eq!</span>(<span class="bool-val">false</span>, split.try_reclaim(<span class="number">4</span>));
<span class="comment">// buf is empty and has capacity for 60 bytes
</span><span class="macro">assert_eq!</span>(<span class="bool-val">true</span>, buf.try_reclaim(<span class="number">60</span>));
drop(buf);
<span class="macro">assert_eq!</span>(<span class="bool-val">false</span>, split.try_reclaim(<span class="number">64</span>));
split.clear();
<span class="macro">assert_eq!</span>(<span class="number">4</span>, split.capacity());
<span class="macro">assert_eq!</span>(<span class="bool-val">true</span>, split.try_reclaim(<span class="number">64</span>));
<span class="macro">assert_eq!</span>(<span class="number">64</span>, split.capacity());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.extend_from_slice" class="method"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#866-881">Source</a><h4 class="code-header">pub fn <a href="#method.extend_from_slice" class="fn">extend_from_slice</a>(&amp;mut self, extend: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>])</h4></section></summary><div class="docblock"><p>Appends given bytes to this <code>BytesMut</code>.</p>
<p>If this <code>BytesMut</code> object does not have enough capacity, it is resized
first.</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">use </span>bytes::BytesMut;
<span class="kw">let </span><span class="kw-2">mut </span>buf = BytesMut::with_capacity(<span class="number">0</span>);
buf.extend_from_slice(<span class="string">b"aaabbb"</span>);
buf.extend_from_slice(<span class="string">b"cccddd"</span>);
<span class="macro">assert_eq!</span>(<span class="string">b"aaabbbcccddd"</span>, <span class="kw-2">&amp;</span>buf[..]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.unsplit" class="method"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#907-916">Source</a><h4 class="code-header">pub fn <a href="#method.unsplit" class="fn">unsplit</a>(&amp;mut self, other: <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>)</h4></section></summary><div class="docblock"><p>Absorbs a <code>BytesMut</code> that was previously split off.</p>
<p>If the two <code>BytesMut</code> objects were previously contiguous and not mutated
in a way that causes re-allocation i.e., if <code>other</code> was created by
calling <code>split_off</code> on this <code>BytesMut</code>, then this is an <code>O(1)</code> operation
that just decreases a reference count and sets a few indices.
Otherwise this method degenerates to
<code>self.extend_from_slice(other.as_ref())</code>.</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">use </span>bytes::BytesMut;
<span class="kw">let </span><span class="kw-2">mut </span>buf = BytesMut::with_capacity(<span class="number">64</span>);
buf.extend_from_slice(<span class="string">b"aaabbbcccddd"</span>);
<span class="kw">let </span>split = buf.split_off(<span class="number">6</span>);
<span class="macro">assert_eq!</span>(<span class="string">b"aaabbb"</span>, <span class="kw-2">&amp;</span>buf[..]);
<span class="macro">assert_eq!</span>(<span class="string">b"cccddd"</span>, <span class="kw-2">&amp;</span>split[..]);
buf.unsplit(split);
<span class="macro">assert_eq!</span>(<span class="string">b"aaabbbcccddd"</span>, <span class="kw-2">&amp;</span>buf[..]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.spare_capacity_mut" class="method"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1116-1123">Source</a><h4 class="code-header">pub fn <a href="#method.spare_capacity_mut" class="fn">spare_capacity_mut</a>(&amp;mut self) -&gt; &amp;mut [<a class="union" href="https://doc.rust-lang.org/1.93.1/core/mem/maybe_uninit/union.MaybeUninit.html" title="union core::mem::maybe_uninit::MaybeUninit">MaybeUninit</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>&gt;]</h4></section></summary><div class="docblock"><p>Returns the remaining spare capacity of the buffer as a slice of <code>MaybeUninit&lt;u8&gt;</code>.</p>
<p>The returned slice can be used to fill the buffer with data (e.g. by
reading from a file) before marking the data as initialized using the
<a href="struct.BytesMut.html#method.set_len" title="method bytes::BytesMut::set_len"><code>set_len</code></a> method.</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">use </span>bytes::BytesMut;
<span class="comment">// Allocate buffer big enough for 10 bytes.
</span><span class="kw">let </span><span class="kw-2">mut </span>buf = BytesMut::with_capacity(<span class="number">10</span>);
<span class="comment">// Fill in the first 3 elements.
</span><span class="kw">let </span>uninit = buf.spare_capacity_mut();
uninit[<span class="number">0</span>].write(<span class="number">0</span>);
uninit[<span class="number">1</span>].write(<span class="number">1</span>);
uninit[<span class="number">2</span>].write(<span class="number">2</span>);
<span class="comment">// Mark the first 3 bytes of the buffer as being initialized.
</span><span class="kw">unsafe </span>{
buf.set_len(<span class="number">3</span>);
}
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>buf[..], <span class="kw-2">&amp;</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>]);</code></pre></div></div></details></div></details></div><details class="toggle big-toggle" open><summary><h2 id="deref-methods-%5Bu8%5D" class="section-header"><span>Methods from <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a>&lt;Target = [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]&gt;</span><a href="#deref-methods-%5Bu8%5D" class="anchor">§</a></h2></summary><div id="deref-methods-%5Bu8%5D-1" class="impl-items"><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.93.1/src/core/slice/ascii.rs.html#21">Source</a></span><h4 class="code-header">pub fn <a href="#method.is_ascii" class="fn">is_ascii</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.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.93.1/src/core/slice/ascii.rs.html#30">Source</a><h4 class="code-header">pub fn <a href="#method.as_ascii" class="fn">as_ascii</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;[<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/ascii/ascii_char/enum.AsciiChar.html" title="enum core::ascii::ascii_char::AsciiChar">AsciiChar</a>]&gt;</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.93.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.93.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.93.1/src/core/slice/ascii.rs.html#48">Source</a><h4 class="code-header">pub unsafe fn <a href="#method.as_ascii_unchecked" class="fn">as_ascii_unchecked</a>(&amp;self) -&gt; &amp;[<a class="enum" href="https://doc.rust-lang.org/1.93.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 theyre valid.</p>
<h5 id="safety"><a class="doc-anchor" href="#safety">§</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.93.1/src/core/slice/ascii.rs.html#63">Source</a></span><h4 class="code-header">pub fn <a href="#method.eq_ignore_ascii_case" class="fn">eq_ignore_ascii_case</a>(&amp;self, other: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.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.make_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.93.1/src/core/slice/ascii.rs.html#98">Source</a></span><h4 class="code-header">pub fn <a href="#method.make_ascii_uppercase" class="fn">make_ascii_uppercase</a>(&amp;mut self)</h4></section></summary><div class="docblock"><p>Converts this slice to its ASCII upper case equivalent in-place.</p>
<p>ASCII letters a to z are mapped to A to Z,
but non-ASCII letters are unchanged.</p>
<p>To return a new uppercased value without modifying the existing one, use
<a href="#method.to_ascii_uppercase"><code>to_ascii_uppercase</code></a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.make_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.93.1/src/core/slice/ascii.rs.html#120">Source</a></span><h4 class="code-header">pub fn <a href="#method.make_ascii_lowercase" class="fn">make_ascii_lowercase</a>(&amp;mut self)</h4></section></summary><div class="docblock"><p>Converts this slice to its ASCII lower case equivalent in-place.</p>
<p>ASCII letters A to Z are mapped to a to z,
but non-ASCII letters are unchanged.</p>
<p>To return a new lowercased value without modifying the existing one, use
<a href="#method.to_ascii_lowercase"><code>to_ascii_lowercase</code></a>.</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.93.1/src/core/slice/ascii.rs.html#143">Source</a></span><h4 class="code-header">pub fn <a href="#method.escape_ascii" class="fn">escape_ascii</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/slice/ascii/struct.EscapeAscii.html" title="struct core::slice::ascii::EscapeAscii">EscapeAscii</a>&lt;'_&gt;</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-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>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.93.1/src/core/slice/ascii.rs.html#162">Source</a></span><h4 class="code-header">pub fn <a href="#method.trim_ascii_start" class="fn">trim_ascii_start</a>(&amp;self) -&gt; &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>] <a href="#" class="tooltip" data-notable-ty="&amp;[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.93.1/std/primitive.u8.html#method.is_ascii_whitespace" title="method u8::is_ascii_whitespace"><code>u8::is_ascii_whitespace</code></a>.</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="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.93.1/src/core/slice/ascii.rs.html#191">Source</a></span><h4 class="code-header">pub fn <a href="#method.trim_ascii_end" class="fn">trim_ascii_end</a>(&amp;self) -&gt; &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>] <a href="#" class="tooltip" data-notable-ty="&amp;[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.93.1/std/primitive.u8.html#method.is_ascii_whitespace" title="method u8::is_ascii_whitespace"><code>u8::is_ascii_whitespace</code></a>.</p>
<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="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.93.1/src/core/slice/ascii.rs.html#221">Source</a></span><h4 class="code-header">pub fn <a href="#method.trim_ascii" class="fn">trim_ascii</a>(&amp;self) -&gt; &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>] <a href="#" class="tooltip" data-notable-ty="&amp;[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.93.1/std/primitive.u8.html#method.is_ascii_whitespace" title="method u8::is_ascii_whitespace"><code>u8::is_ascii_whitespace</code></a>.</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="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.93.1/src/core/slice/mod.rs.html#115">Source</a></span><h4 class="code-header">pub fn <a href="#method.len-1" class="fn">len</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.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-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>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.93.1/src/core/slice/mod.rs.html#135">Source</a></span><h4 class="code-header">pub fn <a href="#method.is_empty-1" class="fn">is_empty</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.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-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>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">&amp;</span>[i32] = <span class="kw-2">&amp;</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.93.1/src/core/slice/mod.rs.html#154">Source</a></span><h4 class="code-header">pub fn <a href="#method.first" class="fn">first</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>&gt;</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-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>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">&amp;</span><span class="number">10</span>), v.first());
<span class="kw">let </span>w: <span class="kw-2">&amp;</span>[i32] = <span class="kw-2">&amp;</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.first_mut" 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.93.1/src/core/slice/mod.rs.html#177">Source</a></span><h4 class="code-header">pub fn <a href="#method.first_mut" class="fn">first_mut</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut T</a>&gt;</h4></section></summary><div class="docblock"><p>Returns a mutable reference to the first element of the slice, or <code>None</code> if it is empty.</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>x = <span class="kw-2">&amp;mut </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) = x.first_mut() {
<span class="kw-2">*</span>first = <span class="number">5</span>;
}
<span class="macro">assert_eq!</span>(x, <span class="kw-2">&amp;</span>[<span class="number">5</span>, <span class="number">1</span>, <span class="number">2</span>]);
<span class="kw">let </span>y: <span class="kw-2">&amp;mut </span>[i32] = <span class="kw-2">&amp;mut </span>[];
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, y.first_mut());</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.93.1/src/core/slice/mod.rs.html#197">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_first" class="fn">split_first</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;(<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>, &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>)&gt;</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-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>x = <span class="kw-2">&amp;</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">&amp;</span><span class="number">0</span>);
<span class="macro">assert_eq!</span>(elements, <span class="kw-2">&amp;</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_first_mut" 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.93.1/src/core/slice/mod.rs.html#219">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_first_mut" class="fn">split_first_mut</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;(<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut T</a>, &amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>)&gt;</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-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>x = <span class="kw-2">&amp;mut </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_mut() {
<span class="kw-2">*</span>first = <span class="number">3</span>;
elements[<span class="number">0</span>] = <span class="number">4</span>;
elements[<span class="number">1</span>] = <span class="number">5</span>;
}
<span class="macro">assert_eq!</span>(x, <span class="kw-2">&amp;</span>[<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</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.93.1/src/core/slice/mod.rs.html#239">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_last" class="fn">split_last</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;(<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>, &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>)&gt;</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-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>x = <span class="kw-2">&amp;</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">&amp;</span><span class="number">2</span>);
<span class="macro">assert_eq!</span>(elements, <span class="kw-2">&amp;</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.split_last_mut" 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.93.1/src/core/slice/mod.rs.html#261">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_last_mut" class="fn">split_last_mut</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;(<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut T</a>, &amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>)&gt;</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-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>x = <span class="kw-2">&amp;mut </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_mut() {
<span class="kw-2">*</span>last = <span class="number">3</span>;
elements[<span class="number">0</span>] = <span class="number">4</span>;
elements[<span class="number">1</span>] = <span class="number">5</span>;
}
<span class="macro">assert_eq!</span>(x, <span class="kw-2">&amp;</span>[<span class="number">4</span>, <span class="number">5</span>, <span class="number">3</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.93.1/src/core/slice/mod.rs.html#280">Source</a></span><h4 class="code-header">pub fn <a href="#method.last" class="fn">last</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>&gt;</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-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>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">&amp;</span><span class="number">30</span>), v.last());
<span class="kw">let </span>w: <span class="kw-2">&amp;</span>[i32] = <span class="kw-2">&amp;</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.last_mut" 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.93.1/src/core/slice/mod.rs.html#303">Source</a></span><h4 class="code-header">pub fn <a href="#method.last_mut" class="fn">last_mut</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut T</a>&gt;</h4></section></summary><div class="docblock"><p>Returns a mutable reference to the last item in the slice, or <code>None</code> if it is empty.</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>x = <span class="kw-2">&amp;mut </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) = x.last_mut() {
<span class="kw-2">*</span>last = <span class="number">10</span>;
}
<span class="macro">assert_eq!</span>(x, <span class="kw-2">&amp;</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">10</span>]);
<span class="kw">let </span>y: <span class="kw-2">&amp;mut </span>[i32] = <span class="kw-2">&amp;mut </span>[];
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, y.last_mut());</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.93.1/src/core/slice/mod.rs.html#326">Source</a></span><h4 class="code-header">pub fn <a href="#method.first_chunk" class="fn">first_chunk</a>&lt;const N: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.array.html">[T; N]</a>&gt;</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-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>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">&amp;</span>[<span class="number">10</span>, <span class="number">40</span>]), u.first_chunk::&lt;<span class="number">2</span>&gt;());
<span class="kw">let </span>v: <span class="kw-2">&amp;</span>[i32] = <span class="kw-2">&amp;</span>[<span class="number">10</span>];
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, v.first_chunk::&lt;<span class="number">2</span>&gt;());
<span class="kw">let </span>w: <span class="kw-2">&amp;</span>[i32] = <span class="kw-2">&amp;</span>[];
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>[]), w.first_chunk::&lt;<span class="number">0</span>&gt;());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.first_chunk_mut" 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.93.1/src/core/slice/mod.rs.html#356">Source</a></span><h4 class="code-header">pub fn <a href="#method.first_chunk_mut" class="fn">first_chunk_mut</a>&lt;const N: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.array.html">[T; N]</a>&gt;</h4></section></summary><div class="docblock"><p>Returns a mutable 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-35"><a class="doc-anchor" href="#examples-35">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="kw-2">&amp;mut </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) = x.first_chunk_mut::&lt;<span class="number">2</span>&gt;() {
first[<span class="number">0</span>] = <span class="number">5</span>;
first[<span class="number">1</span>] = <span class="number">4</span>;
}
<span class="macro">assert_eq!</span>(x, <span class="kw-2">&amp;</span>[<span class="number">5</span>, <span class="number">4</span>, <span class="number">2</span>]);
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, x.first_chunk_mut::&lt;<span class="number">4</span>&gt;());</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.93.1/src/core/slice/mod.rs.html#386">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_first_chunk" class="fn">split_first_chunk</a>&lt;const N: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;(&amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.array.html">[T; N]</a>, &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>)&gt;</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-36"><a class="doc-anchor" href="#examples-36">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="kw-2">&amp;</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::&lt;<span class="number">2</span>&gt;() {
<span class="macro">assert_eq!</span>(first, <span class="kw-2">&amp;</span>[<span class="number">0</span>, <span class="number">1</span>]);
<span class="macro">assert_eq!</span>(elements, <span class="kw-2">&amp;</span>[<span class="number">2</span>]);
}
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, x.split_first_chunk::&lt;<span class="number">4</span>&gt;());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_first_chunk_mut" 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.93.1/src/core/slice/mod.rs.html#416-418">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_first_chunk_mut" class="fn">split_first_chunk_mut</a>&lt;const N: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;(
&amp;mut self,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;(&amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.array.html">[T; N]</a>, &amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>)&gt;</h4></section></summary><div class="docblock"><p>Returns a mutable 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-37"><a class="doc-anchor" href="#examples-37">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="kw-2">&amp;mut </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_mut::&lt;<span class="number">2</span>&gt;() {
first[<span class="number">0</span>] = <span class="number">3</span>;
first[<span class="number">1</span>] = <span class="number">4</span>;
elements[<span class="number">0</span>] = <span class="number">5</span>;
}
<span class="macro">assert_eq!</span>(x, <span class="kw-2">&amp;</span>[<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>]);
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, x.split_first_chunk_mut::&lt;<span class="number">4</span>&gt;());</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.93.1/src/core/slice/mod.rs.html#446">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_last_chunk" class="fn">split_last_chunk</a>&lt;const N: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;(&amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>, &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.array.html">[T; N]</a>)&gt;</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-38"><a class="doc-anchor" href="#examples-38">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="kw-2">&amp;</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::&lt;<span class="number">2</span>&gt;() {
<span class="macro">assert_eq!</span>(elements, <span class="kw-2">&amp;</span>[<span class="number">0</span>]);
<span class="macro">assert_eq!</span>(last, <span class="kw-2">&amp;</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::&lt;<span class="number">4</span>&gt;());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_last_chunk_mut" 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.93.1/src/core/slice/mod.rs.html#477-479">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_last_chunk_mut" class="fn">split_last_chunk_mut</a>&lt;const N: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;(
&amp;mut self,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;(&amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>, &amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.array.html">[T; N]</a>)&gt;</h4></section></summary><div class="docblock"><p>Returns a mutable 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-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>x = <span class="kw-2">&amp;mut </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_mut::&lt;<span class="number">2</span>&gt;() {
last[<span class="number">0</span>] = <span class="number">3</span>;
last[<span class="number">1</span>] = <span class="number">4</span>;
elements[<span class="number">0</span>] = <span class="number">5</span>;
}
<span class="macro">assert_eq!</span>(x, <span class="kw-2">&amp;</span>[<span class="number">5</span>, <span class="number">3</span>, <span class="number">4</span>]);
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, x.split_last_chunk_mut::&lt;<span class="number">4</span>&gt;());</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.93.1/src/core/slice/mod.rs.html#508">Source</a></span><h4 class="code-header">pub fn <a href="#method.last_chunk" class="fn">last_chunk</a>&lt;const N: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.array.html">[T; N]</a>&gt;</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-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>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">&amp;</span>[<span class="number">40</span>, <span class="number">30</span>]), u.last_chunk::&lt;<span class="number">2</span>&gt;());
<span class="kw">let </span>v: <span class="kw-2">&amp;</span>[i32] = <span class="kw-2">&amp;</span>[<span class="number">10</span>];
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, v.last_chunk::&lt;<span class="number">2</span>&gt;());
<span class="kw">let </span>w: <span class="kw-2">&amp;</span>[i32] = <span class="kw-2">&amp;</span>[];
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>[]), w.last_chunk::&lt;<span class="number">0</span>&gt;());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.last_chunk_mut" 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.93.1/src/core/slice/mod.rs.html#538">Source</a></span><h4 class="code-header">pub fn <a href="#method.last_chunk_mut" class="fn">last_chunk_mut</a>&lt;const N: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.array.html">[T; N]</a>&gt;</h4></section></summary><div class="docblock"><p>Returns a mutable 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-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>x = <span class="kw-2">&amp;mut </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) = x.last_chunk_mut::&lt;<span class="number">2</span>&gt;() {
last[<span class="number">0</span>] = <span class="number">10</span>;
last[<span class="number">1</span>] = <span class="number">20</span>;
}
<span class="macro">assert_eq!</span>(x, <span class="kw-2">&amp;</span>[<span class="number">0</span>, <span class="number">10</span>, <span class="number">20</span>]);
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, x.last_chunk_mut::&lt;<span class="number">4</span>&gt;());</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.93.1/src/core/slice/mod.rs.html#571-573">Source</a></span><h4 class="code-header">pub fn <a href="#method.get" class="fn">get</a>&lt;I&gt;(&amp;self, index: I) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;&lt;I as <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.1/core/slice/index/trait.SliceIndex.html#associatedtype.Output" title="type core::slice::index::SliceIndex::Output">Output</a>&gt;<div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>&gt;,</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-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="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">&amp;</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">&amp;</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_mut" 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.93.1/src/core/slice/mod.rs.html#598-600">Source</a></span><h4 class="code-header">pub fn <a href="#method.get_mut" class="fn">get_mut</a>&lt;I&gt;(
&amp;mut self,
index: I,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;mut &lt;I as <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.1/core/slice/index/trait.SliceIndex.html#associatedtype.Output" title="type core::slice::index::SliceIndex::Output">Output</a>&gt;<div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>&gt;,</div></h4></section></summary><div class="docblock"><p>Returns a mutable reference to an element or subslice depending on the
type of index (see <a href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html#method.get" title="method slice::get"><code>get</code></a>) or <code>None</code> if the index is out of bounds.</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>x = <span class="kw-2">&amp;mut </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>(elem) = x.get_mut(<span class="number">1</span>) {
<span class="kw-2">*</span>elem = <span class="number">42</span>;
}
<span class="macro">assert_eq!</span>(x, <span class="kw-2">&amp;</span>[<span class="number">0</span>, <span class="number">42</span>, <span class="number">2</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.93.1/src/core/slice/mod.rs.html#638-640">Source</a></span><h4 class="code-header">pub unsafe fn <a href="#method.get_unchecked" class="fn">get_unchecked</a>&lt;I&gt;(
&amp;self,
index: I,
) -&gt; &amp;&lt;I as <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.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.93.1/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>&gt;,</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.93.1/std/primitive.slice.html#method.get" title="method slice::get"><code>get</code></a>.</p>
<h5 id="safety-1"><a class="doc-anchor" href="#safety-1">§</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>. Its UB
to call <code>.get_unchecked(len)</code>, even if you immediately convert to a
pointer. And its UB to call <code>.get_unchecked(..len + 1)</code>,
<code>.get_unchecked(..=len)</code>, or similar.</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>x = <span class="kw-2">&amp;</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">&amp;</span><span class="number">2</span>);
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.get_unchecked_mut" 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.93.1/src/core/slice/mod.rs.html#683-685">Source</a></span><h4 class="code-header">pub unsafe fn <a href="#method.get_unchecked_mut" class="fn">get_unchecked_mut</a>&lt;I&gt;(
&amp;mut self,
index: I,
) -&gt; &amp;mut &lt;I as <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.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.93.1/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>&gt;,</div></h4></section></summary><div class="docblock"><p>Returns a mutable 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.93.1/std/primitive.slice.html#method.get_mut" title="method slice::get_mut"><code>get_mut</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_mut(index).unwrap_unchecked()</code>. Its
UB to call <code>.get_unchecked_mut(len)</code>, even if you immediately convert
to a pointer. And its UB to call <code>.get_unchecked_mut(..len + 1)</code>,
<code>.get_unchecked_mut(..=len)</code>, or similar.</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="kw">let </span>x = <span class="kw-2">&amp;mut </span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>];
<span class="kw">unsafe </span>{
<span class="kw">let </span>elem = x.get_unchecked_mut(<span class="number">1</span>);
<span class="kw-2">*</span>elem = <span class="number">13</span>;
}
<span class="macro">assert_eq!</span>(x, <span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">13</span>, <span class="number">4</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.93.1/src/core/slice/mod.rs.html#725">Source</a></span><h4 class="code-header">pub fn <a href="#method.as_ptr" class="fn">as_ptr</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.pointer.html">*const T</a></h4></section></summary><div class="docblock"><p>Returns a raw pointer to the slices 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.93.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-46"><a class="doc-anchor" href="#examples-46">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="kw-2">&amp;</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">&amp;*</span>x_ptr.add(i));
}
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.as_mut_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.93.1/src/core/slice/mod.rs.html#756">Source</a></span><h4 class="code-header">pub fn <a href="#method.as_mut_ptr" class="fn">as_mut_ptr</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.pointer.html">*mut T</a></h4></section></summary><div class="docblock"><p>Returns an unsafe mutable pointer to the slices 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>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-47"><a class="doc-anchor" href="#examples-47">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="kw-2">&amp;mut </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_mut_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="kw-2">*</span>x_ptr.add(i) += <span class="number">2</span>;
}
}
<span class="macro">assert_eq!</span>(x, <span class="kw-2">&amp;</span>[<span class="number">3</span>, <span class="number">4</span>, <span class="number">6</span>]);</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.93.1/src/core/slice/mod.rs.html#792">Source</a></span><h4 class="code-header">pub fn <a href="#method.as_ptr_range" class="fn">as_ptr_range</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/ops/range/struct.Range.html" title="struct core::ops::range::Range">Range</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.pointer.html">*const T</a>&gt;</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.93.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">&amp;</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">&amp;</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">&amp;</span>x));
<span class="macro">assert!</span>(!a.as_ptr_range().contains(<span class="kw-2">&amp;</span>y));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.as_mut_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.93.1/src/core/slice/mod.rs.html#835">Source</a></span><h4 class="code-header">pub fn <a href="#method.as_mut_ptr_range" class="fn">as_mut_ptr_range</a>(&amp;mut self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/ops/range/struct.Range.html" title="struct core::ops::range::Range">Range</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.pointer.html">*mut T</a>&gt;</h4></section></summary><div class="docblock"><p>Returns the two unsafe mutable 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.93.1/std/primitive.slice.html#method.as_mut_ptr" title="method slice::as_mut_ptr"><code>as_mut_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>
</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.93.1/src/core/slice/mod.rs.html#849">Source</a></span><h4 class="code-header">pub fn <a href="#method.as_array" class="fn">as_array</a>&lt;const N: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.array.html">[T; N]</a>&gt;</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.as_mut_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.93.1/src/core/slice/mod.rs.html#868">Source</a></span><h4 class="code-header">pub fn <a href="#method.as_mut_array" class="fn">as_mut_array</a>&lt;const N: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.array.html">[T; N]</a>&gt;</h4></section></summary><div class="docblock"><p>Gets a mutable reference to the slices 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.swap" 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.93.1/src/core/slice/mod.rs.html#904">Source</a></span><h4 class="code-header">pub fn <a href="#method.swap" class="fn">swap</a>(&amp;mut self, a: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>, b: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Swaps two elements in the slice.</p>
<p>If <code>a</code> equals to <code>b</code>, its guaranteed that elements wont change value.</p>
<h5 id="arguments"><a class="doc-anchor" href="#arguments">§</a>Arguments</h5>
<ul>
<li>a - The index of the first element</li>
<li>b - The index of the second element</li>
</ul>
<h5 id="panics-3"><a class="doc-anchor" href="#panics-3">§</a>Panics</h5>
<p>Panics if <code>a</code> or <code>b</code> are out of bounds.</p>
<h5 id="examples-48"><a class="doc-anchor" href="#examples-48">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>v = [<span class="string">"a"</span>, <span class="string">"b"</span>, <span class="string">"c"</span>, <span class="string">"d"</span>, <span class="string">"e"</span>];
v.swap(<span class="number">2</span>, <span class="number">4</span>);
<span class="macro">assert!</span>(v == [<span class="string">"a"</span>, <span class="string">"b"</span>, <span class="string">"e"</span>, <span class="string">"d"</span>, <span class="string">"c"</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.swap_unchecked" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#947">Source</a><h4 class="code-header">pub unsafe fn <a href="#method.swap_unchecked" class="fn">swap_unchecked</a>(&amp;mut self, a: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>, b: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>)</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_swap_unchecked</code>)</span></div></span></summary><div class="docblock"><p>Swaps two elements in the slice, without doing bounds checking.</p>
<p>For a safe alternative see <a href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html#method.swap" title="method slice::swap"><code>swap</code></a>.</p>
<h5 id="arguments-1"><a class="doc-anchor" href="#arguments-1">§</a>Arguments</h5>
<ul>
<li>a - The index of the first element</li>
<li>b - The index of the second element</li>
</ul>
<h5 id="safety-3"><a class="doc-anchor" href="#safety-3">§</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>.
The caller has to ensure that <code>a &lt; self.len()</code> and <code>b &lt; self.len()</code>.</p>
<h5 id="examples-49"><a class="doc-anchor" href="#examples-49">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(slice_swap_unchecked)]
</span><span class="kw">let </span><span class="kw-2">mut </span>v = [<span class="string">"a"</span>, <span class="string">"b"</span>, <span class="string">"c"</span>, <span class="string">"d"</span>];
<span class="comment">// SAFETY: we know that 1 and 3 are both indices of the slice
</span><span class="kw">unsafe </span>{ v.swap_unchecked(<span class="number">1</span>, <span class="number">3</span>) };
<span class="macro">assert!</span>(v == [<span class="string">"a"</span>, <span class="string">"d"</span>, <span class="string">"c"</span>, <span class="string">"b"</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.reverse" 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.93.1/src/core/slice/mod.rs.html#977">Source</a></span><h4 class="code-header">pub fn <a href="#method.reverse" class="fn">reverse</a>(&amp;mut self)</h4></section></summary><div class="docblock"><p>Reverses the order of elements in the slice, in place.</p>
<h5 id="examples-50"><a class="doc-anchor" href="#examples-50">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>v = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>];
v.reverse();
<span class="macro">assert!</span>(v == [<span class="number">3</span>, <span class="number">2</span>, <span class="number">1</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.iter" 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.93.1/src/core/slice/mod.rs.html#1039">Source</a></span><h4 class="code-header">pub fn <a href="#method.iter" class="fn">iter</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/slice/iter/struct.Iter.html" title="struct core::slice::iter::Iter">Iter</a>&lt;'_, T&gt;</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-51"><a class="doc-anchor" href="#examples-51">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="kw-2">&amp;</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">&amp;</span><span class="number">1</span>));
<span class="macro">assert_eq!</span>(iterator.next(), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="number">2</span>));
<span class="macro">assert_eq!</span>(iterator.next(), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</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.iter_mut" 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.93.1/src/core/slice/mod.rs.html#1059">Source</a></span><h4 class="code-header">pub fn <a href="#method.iter_mut" class="fn">iter_mut</a>(&amp;mut self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/slice/iter/struct.IterMut.html" title="struct core::slice::iter::IterMut">IterMut</a>&lt;'_, T&gt;</h4></section></summary><div class="docblock"><p>Returns an iterator that allows modifying each value.</p>
<p>The iterator yields all items from start to end.</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>x = <span class="kw-2">&amp;mut </span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>];
<span class="kw">for </span>elem <span class="kw">in </span>x.iter_mut() {
<span class="kw-2">*</span>elem += <span class="number">2</span>;
}
<span class="macro">assert_eq!</span>(x, <span class="kw-2">&amp;</span>[<span class="number">3</span>, <span class="number">4</span>, <span class="number">6</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.93.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>(&amp;self, size: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/slice/iter/struct.Windows.html" title="struct core::slice::iter::Windows">Windows</a>&lt;'_, T&gt;</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-4"><a class="doc-anchor" href="#panics-4">§</a>Panics</h5>
<p>Panics if <code>size</code> is zero.</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="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">&amp;</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">&amp;</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">&amp;</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.93.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.93.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">&amp;mut </span>array[..];
<span class="kw">let </span>slice_of_cells: <span class="kw-2">&amp;</span>[Cell&lt;char&gt;] = 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">&amp;</span>w[<span class="number">0</span>], <span class="kw-2">&amp;</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.93.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>(&amp;self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/slice/iter/struct.Chunks.html" title="struct core::slice::iter::Chunks">Chunks</a>&lt;'_, T&gt;</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.93.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.93.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.93.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-5"><a class="doc-anchor" href="#panics-5">§</a>Panics</h5>
<p>Panics if <code>chunk_size</code> is zero.</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="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">&amp;</span>[<span class="string">'l'</span>, <span class="string">'o'</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</span>[<span class="string">'r'</span>, <span class="string">'e'</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</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_mut" 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.93.1/src/core/slice/mod.rs.html#1198">Source</a></span><h4 class="code-header">pub fn <a href="#method.chunks_mut" class="fn">chunks_mut</a>(&amp;mut self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/slice/iter/struct.ChunksMut.html" title="struct core::slice::iter::ChunksMut">ChunksMut</a>&lt;'_, T&gt;</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 mutable 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.93.1/std/primitive.slice.html#method.chunks_exact_mut" title="method slice::chunks_exact_mut"><code>chunks_exact_mut</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.93.1/std/primitive.slice.html#method.rchunks_mut" title="method slice::rchunks_mut"><code>rchunks_mut</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.93.1/std/primitive.slice.html#method.as_chunks_mut" title="method slice::as_chunks_mut"><code>as_chunks_mut</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-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="kw-2">&amp;mut </span>[<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>];
<span class="kw">let </span><span class="kw-2">mut </span>count = <span class="number">1</span>;
<span class="kw">for </span>chunk <span class="kw">in </span>v.chunks_mut(<span class="number">2</span>) {
<span class="kw">for </span>elem <span class="kw">in </span>chunk.iter_mut() {
<span class="kw-2">*</span>elem += count;
}
count += <span class="number">1</span>;
}
<span class="macro">assert_eq!</span>(v, <span class="kw-2">&amp;</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>]);</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.93.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>(&amp;self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/slice/iter/struct.ChunksExact.html" title="struct core::slice::iter::ChunksExact">ChunksExact</a>&lt;'_, T&gt;</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.93.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.93.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.93.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.93.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-7"><a class="doc-anchor" href="#panics-7">§</a>Panics</h5>
<p>Panics if <code>chunk_size</code> is zero.</p>
<h5 id="examples-56"><a class="doc-anchor" href="#examples-56">§</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">&amp;</span>[<span class="string">'l'</span>, <span class="string">'o'</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</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">&amp;</span>[<span class="string">'m'</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.chunks_exact_mut" 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.93.1/src/core/slice/mod.rs.html#1289">Source</a></span><h4 class="code-header">pub fn <a href="#method.chunks_exact_mut" class="fn">chunks_exact_mut</a>(&amp;mut self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/slice/iter/struct.ChunksExactMut.html" title="struct core::slice::iter::ChunksExactMut">ChunksExactMut</a>&lt;'_, T&gt;</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 mutable 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>into_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.93.1/std/primitive.slice.html#method.chunks_mut" title="method slice::chunks_mut"><code>chunks_mut</code></a>.</p>
<p>See <a href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html#method.chunks_mut" title="method slice::chunks_mut"><code>chunks_mut</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.93.1/std/primitive.slice.html#method.rchunks_exact_mut" title="method slice::rchunks_exact_mut"><code>rchunks_exact_mut</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.93.1/std/primitive.slice.html#method.as_chunks_mut" title="method slice::as_chunks_mut"><code>as_chunks_mut</code></a> instead, which will
give references to arrays of exactly that length, rather than slices.</p>
<h5 id="panics-8"><a class="doc-anchor" href="#panics-8">§</a>Panics</h5>
<p>Panics if <code>chunk_size</code> is zero.</p>
<h5 id="examples-57"><a class="doc-anchor" href="#examples-57">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = <span class="kw-2">&amp;mut </span>[<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>];
<span class="kw">let </span><span class="kw-2">mut </span>count = <span class="number">1</span>;
<span class="kw">for </span>chunk <span class="kw">in </span>v.chunks_exact_mut(<span class="number">2</span>) {
<span class="kw">for </span>elem <span class="kw">in </span>chunk.iter_mut() {
<span class="kw-2">*</span>elem += count;
}
count += <span class="number">1</span>;
}
<span class="macro">assert_eq!</span>(v, <span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">2</span>, <span class="number">0</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.93.1/src/core/slice/mod.rs.html#1337">Source</a></span><h4 class="code-header">pub unsafe fn <a href="#method.as_chunks_unchecked" class="fn">as_chunks_unchecked</a>&lt;const N: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;(&amp;self) -&gt; &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.93.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 theres no remainder.</p>
<p>This is the inverse operation to <a href="https://doc.rust-lang.org/1.93.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.93.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.93.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-4"><a class="doc-anchor" href="#safety-4">§</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-58"><a class="doc-anchor" href="#examples-58">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice: <span class="kw-2">&amp;</span>[char] = <span class="kw-2">&amp;</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">&amp;</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">&amp;</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">&amp;</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">&amp;</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: &amp;[[_; 5]] = slice.as_chunks_unchecked() // The slice length is not a multiple of 5
// let chunks: &amp;[[_; 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.93.1/src/core/slice/mod.rs.html#1395">Source</a></span><h4 class="code-header">pub fn <a href="#method.as_chunks" class="fn">as_chunks</a>&lt;const N: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;(&amp;self) -&gt; (&amp;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.array.html">[T; N]</a>], &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.slice.html#method.as_flattened" title="method slice::as_flattened"><code>as_flattened</code></a>.</p>
<h5 id="panics-9"><a class="doc-anchor" href="#panics-9">§</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-59"><a class="doc-anchor" href="#examples-59">§</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">&amp;</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">&amp;</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::&lt;<span class="number">2</span>&gt;() <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">&amp;</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.93.1/src/core/slice/mod.rs.html#1442">Source</a></span><h4 class="code-header">pub fn <a href="#method.as_rchunks" class="fn">as_rchunks</a>&lt;const N: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;(&amp;self) -&gt; (&amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>, &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.slice.html#method.as_flattened" title="method slice::as_flattened"><code>as_flattened</code></a>.</p>
<h5 id="panics-10"><a class="doc-anchor" href="#panics-10">§</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-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>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">&amp;</span>[<span class="string">'l'</span>]);
<span class="macro">assert_eq!</span>(chunks, <span class="kw-2">&amp;</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.as_chunks_unchecked_mut" 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.93.1/src/core/slice/mod.rs.html#1497">Source</a></span><h4 class="code-header">pub unsafe fn <a href="#method.as_chunks_unchecked_mut" class="fn">as_chunks_unchecked_mut</a>&lt;const N: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;(
&amp;mut self,
) -&gt; &amp;mut [<a class="primitive" href="https://doc.rust-lang.org/1.93.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 theres no remainder.</p>
<p>This is the inverse operation to <a href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html#method.as_flattened_mut" title="method slice::as_flattened_mut"><code>as_flattened_mut</code></a>.</p>
<p>As this is <code>unsafe</code>, consider whether you could use <a href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html#method.as_chunks_mut" title="method slice::as_chunks_mut"><code>as_chunks_mut</code></a> or
<a href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html#method.as_rchunks_mut" title="method slice::as_rchunks_mut"><code>as_rchunks_mut</code></a> instead, perhaps via something like
<code>if let (chunks, []) = slice.as_chunks_mut()</code> or
<code>let (chunks, []) = slice.as_chunks_mut() else { unreachable!() };</code>.</p>
<h5 id="safety-5"><a class="doc-anchor" href="#safety-5">§</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-61"><a class="doc-anchor" href="#examples-61">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice: <span class="kw-2">&amp;mut </span>[char] = <span class="kw-2">&amp;mut </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">&amp;mut </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_mut() };
chunks[<span class="number">0</span>] = [<span class="string">'L'</span>];
<span class="macro">assert_eq!</span>(chunks, <span class="kw-2">&amp;</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">&amp;mut </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_mut() };
chunks[<span class="number">1</span>] = [<span class="string">'a'</span>, <span class="string">'x'</span>, <span class="string">'?'</span>];
<span class="macro">assert_eq!</span>(slice, <span class="kw-2">&amp;</span>[<span class="string">'L'</span>, <span class="string">'o'</span>, <span class="string">'r'</span>, <span class="string">'a'</span>, <span class="string">'x'</span>, <span class="string">'?'</span>]);
<span class="comment">// These would be unsound:
// let chunks: &amp;[[_; 5]] = slice.as_chunks_unchecked_mut() // The slice length is not a multiple of 5
// let chunks: &amp;[[_; 0]] = slice.as_chunks_unchecked_mut() // Zero-length chunks are never allowed</span></code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.as_chunks_mut" 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.93.1/src/core/slice/mod.rs.html#1551">Source</a></span><h4 class="code-header">pub fn <a href="#method.as_chunks_mut" class="fn">as_chunks_mut</a>&lt;const N: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;(&amp;mut self) -&gt; (&amp;mut [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.array.html">[T; N]</a>], &amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.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_mut()</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.93.1/std/primitive.slice.html#method.as_flattened_mut" title="method slice::as_flattened_mut"><code>as_flattened_mut</code></a>.</p>
<h5 id="panics-11"><a class="doc-anchor" href="#panics-11">§</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-62"><a class="doc-anchor" href="#examples-62">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = <span class="kw-2">&amp;mut </span>[<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>];
<span class="kw">let </span><span class="kw-2">mut </span>count = <span class="number">1</span>;
<span class="kw">let </span>(chunks, remainder) = v.as_chunks_mut();
remainder[<span class="number">0</span>] = <span class="number">9</span>;
<span class="kw">for </span>chunk <span class="kw">in </span>chunks {
<span class="kw-2">*</span>chunk = [count; <span class="number">2</span>];
count += <span class="number">1</span>;
}
<span class="macro">assert_eq!</span>(v, <span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">2</span>, <span class="number">9</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.as_rchunks_mut" 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.93.1/src/core/slice/mod.rs.html#1604">Source</a></span><h4 class="code-header">pub fn <a href="#method.as_rchunks_mut" class="fn">as_rchunks_mut</a>&lt;const N: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;(&amp;mut self) -&gt; (&amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>, &amp;mut [<a class="primitive" href="https://doc.rust-lang.org/1.93.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_mut()</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.93.1/std/primitive.slice.html#method.as_flattened_mut" title="method slice::as_flattened_mut"><code>as_flattened_mut</code></a>.</p>
<h5 id="panics-12"><a class="doc-anchor" href="#panics-12">§</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-63"><a class="doc-anchor" href="#examples-63">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = <span class="kw-2">&amp;mut </span>[<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>];
<span class="kw">let </span><span class="kw-2">mut </span>count = <span class="number">1</span>;
<span class="kw">let </span>(remainder, chunks) = v.as_rchunks_mut();
remainder[<span class="number">0</span>] = <span class="number">9</span>;
<span class="kw">for </span>chunk <span class="kw">in </span>chunks {
<span class="kw-2">*</span>chunk = [count; <span class="number">2</span>];
count += <span class="number">1</span>;
}
<span class="macro">assert_eq!</span>(v, <span class="kw-2">&amp;</span>[<span class="number">9</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">2</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.array_windows" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#1643">Source</a><h4 class="code-header">pub fn <a href="#method.array_windows" class="fn">array_windows</a>&lt;const N: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/slice/iter/struct.ArrayWindows.html" title="struct core::slice::iter::ArrayWindows">ArrayWindows</a>&lt;'_, T, N&gt;</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>array_windows</code>)</span></div></span></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.93.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-13"><a class="doc-anchor" href="#panics-13">§</a>Panics</h5>
<p>Panics if <code>N</code> is zero. This check will most probably get changed to a compile time
error before this method gets stabilized.</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="attr">#![feature(array_windows)]
</span><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">&amp;</span>[<span class="number">0</span>, <span class="number">1</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">2</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</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.93.1/src/core/slice/mod.rs.html#1683">Source</a></span><h4 class="code-header">pub fn <a href="#method.rchunks" class="fn">rchunks</a>(&amp;self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/slice/iter/struct.RChunks.html" title="struct core::slice::iter::RChunks">RChunks</a>&lt;'_, T&gt;</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.93.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.93.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.93.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-14"><a class="doc-anchor" href="#panics-14">§</a>Panics</h5>
<p>Panics if <code>chunk_size</code> is zero.</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="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">&amp;</span>[<span class="string">'e'</span>, <span class="string">'m'</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</span>[<span class="string">'o'</span>, <span class="string">'r'</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</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_mut" 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.93.1/src/core/slice/mod.rs.html#1727">Source</a></span><h4 class="code-header">pub fn <a href="#method.rchunks_mut" class="fn">rchunks_mut</a>(&amp;mut self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/slice/iter/struct.RChunksMut.html" title="struct core::slice::iter::RChunksMut">RChunksMut</a>&lt;'_, T&gt;</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 mutable 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.93.1/std/primitive.slice.html#method.rchunks_exact_mut" title="method slice::rchunks_exact_mut"><code>rchunks_exact_mut</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.93.1/std/primitive.slice.html#method.chunks_mut" title="method slice::chunks_mut"><code>chunks_mut</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.93.1/std/primitive.slice.html#method.as_rchunks_mut" title="method slice::as_rchunks_mut"><code>as_rchunks_mut</code></a> instead, which will
give references to arrays of exactly that length, rather than slices.</p>
<h5 id="panics-15"><a class="doc-anchor" href="#panics-15">§</a>Panics</h5>
<p>Panics if <code>chunk_size</code> is zero.</p>
<h5 id="examples-66"><a class="doc-anchor" href="#examples-66">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = <span class="kw-2">&amp;mut </span>[<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>];
<span class="kw">let </span><span class="kw-2">mut </span>count = <span class="number">1</span>;
<span class="kw">for </span>chunk <span class="kw">in </span>v.rchunks_mut(<span class="number">2</span>) {
<span class="kw">for </span>elem <span class="kw">in </span>chunk.iter_mut() {
<span class="kw-2">*</span>elem += count;
}
count += <span class="number">1</span>;
}
<span class="macro">assert_eq!</span>(v, <span class="kw-2">&amp;</span>[<span class="number">3</span>, <span class="number">2</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">1</span>]);</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.93.1/src/core/slice/mod.rs.html#1772">Source</a></span><h4 class="code-header">pub fn <a href="#method.rchunks_exact" class="fn">rchunks_exact</a>(&amp;self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/slice/iter/struct.RChunksExact.html" title="struct core::slice::iter::RChunksExact">RChunksExact</a>&lt;'_, T&gt;</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.93.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.93.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.93.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.93.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-16"><a class="doc-anchor" href="#panics-16">§</a>Panics</h5>
<p>Panics if <code>chunk_size</code> is zero.</p>
<h5 id="examples-67"><a class="doc-anchor" href="#examples-67">§</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">&amp;</span>[<span class="string">'e'</span>, <span class="string">'m'</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</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">&amp;</span>[<span class="string">'l'</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.rchunks_exact_mut" 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.93.1/src/core/slice/mod.rs.html#1821">Source</a></span><h4 class="code-header">pub fn <a href="#method.rchunks_exact_mut" class="fn">rchunks_exact_mut</a>(&amp;mut self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/slice/iter/struct.RChunksExactMut.html" title="struct core::slice::iter::RChunksExactMut">RChunksExactMut</a>&lt;'_, T&gt;</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 mutable 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>into_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.93.1/std/primitive.slice.html#method.chunks_mut" title="method slice::chunks_mut"><code>chunks_mut</code></a>.</p>
<p>See <a href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html#method.rchunks_mut" title="method slice::rchunks_mut"><code>rchunks_mut</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.93.1/std/primitive.slice.html#method.chunks_exact_mut" title="method slice::chunks_exact_mut"><code>chunks_exact_mut</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.93.1/std/primitive.slice.html#method.as_rchunks_mut" title="method slice::as_rchunks_mut"><code>as_rchunks_mut</code></a> instead, which will
give references to arrays of exactly that length, rather than slices.</p>
<h5 id="panics-17"><a class="doc-anchor" href="#panics-17">§</a>Panics</h5>
<p>Panics if <code>chunk_size</code> is zero.</p>
<h5 id="examples-68"><a class="doc-anchor" href="#examples-68">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = <span class="kw-2">&amp;mut </span>[<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>];
<span class="kw">let </span><span class="kw-2">mut </span>count = <span class="number">1</span>;
<span class="kw">for </span>chunk <span class="kw">in </span>v.rchunks_exact_mut(<span class="number">2</span>) {
<span class="kw">for </span>elem <span class="kw">in </span>chunk.iter_mut() {
<span class="kw-2">*</span>elem += count;
}
count += <span class="number">1</span>;
}
<span class="macro">assert_eq!</span>(v, <span class="kw-2">&amp;</span>[<span class="number">0</span>, <span class="number">2</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">1</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.93.1/src/core/slice/mod.rs.html#1861-1863">Source</a></span><h4 class="code-header">pub fn <a href="#method.chunk_by" class="fn">chunk_by</a>&lt;F&gt;(&amp;self, pred: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/slice/iter/struct.ChunkBy.html" title="struct core::slice::iter::ChunkBy">ChunkBy</a>&lt;'_, T, F&gt;<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;T</a>, <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.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-69"><a class="doc-anchor" href="#examples-69">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = <span class="kw-2">&amp;</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">&amp;</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">&amp;</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">&amp;</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">&amp;</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 &lt;= b);
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</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">&amp;</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">&amp;</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.chunk_by_mut" 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.93.1/src/core/slice/mod.rs.html#1903-1905">Source</a></span><h4 class="code-header">pub fn <a href="#method.chunk_by_mut" class="fn">chunk_by_mut</a>&lt;F&gt;(&amp;mut self, pred: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/slice/iter/struct.ChunkByMut.html" title="struct core::slice::iter::ChunkByMut">ChunkByMut</a>&lt;'_, T, F&gt;<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;T</a>, <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Returns an iterator over the slice producing non-overlapping mutable
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-70"><a class="doc-anchor" href="#examples-70">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = <span class="kw-2">&amp;mut </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_mut(|a, b| a == b);
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;mut </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">&amp;mut </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">&amp;mut </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">&amp;mut </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_mut(|a, b| a &lt;= b);
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;mut </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">&amp;mut </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">&amp;mut </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.93.1/src/core/slice/mod.rs.html#1949">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_at" class="fn">split_at</a>(&amp;self, mid: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; (&amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>, &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.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-18"><a class="doc-anchor" href="#panics-18">§</a>Panics</h5>
<p>Panics if <code>mid &gt; len</code>. For a non-panicking alternative see
<a href="https://doc.rust-lang.org/1.93.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-71"><a class="doc-anchor" href="#examples-71">§</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_mut" 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.93.1/src/core/slice/mod.rs.html#1983">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_at_mut" class="fn">split_at_mut</a>(&amp;mut self, mid: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; (&amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>, &amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>)</h4></section></summary><div class="docblock"><p>Divides one mutable 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-19"><a class="doc-anchor" href="#panics-19">§</a>Panics</h5>
<p>Panics if <code>mid &gt; len</code>. For a non-panicking alternative see
<a href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html#method.split_at_mut_checked" title="method slice::split_at_mut_checked"><code>split_at_mut_checked</code></a>.</p>
<h5 id="examples-72"><a class="doc-anchor" href="#examples-72">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>v = [<span class="number">1</span>, <span class="number">0</span>, <span class="number">3</span>, <span class="number">0</span>, <span class="number">5</span>, <span class="number">6</span>];
<span class="kw">let </span>(left, right) = v.split_at_mut(<span class="number">2</span>);
<span class="macro">assert_eq!</span>(left, [<span class="number">1</span>, <span class="number">0</span>]);
<span class="macro">assert_eq!</span>(right, [<span class="number">3</span>, <span class="number">0</span>, <span class="number">5</span>, <span class="number">6</span>]);
left[<span class="number">1</span>] = <span class="number">2</span>;
right[<span class="number">1</span>] = <span class="number">4</span>;
<span class="macro">assert_eq!</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>]);</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.93.1/src/core/slice/mod.rs.html#2035">Source</a></span><h4 class="code-header">pub unsafe fn <a href="#method.split_at_unchecked" class="fn">split_at_unchecked</a>(&amp;self, mid: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; (&amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>, &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.slice.html#method.split_at" title="method slice::split_at"><code>split_at</code></a>.</p>
<h5 id="safety-6"><a class="doc-anchor" href="#safety-6">§</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 &lt;= mid &lt;= self.len()</code>.</p>
<h5 id="examples-73"><a class="doc-anchor" href="#examples-73">§</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_mut_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.93.1/src/core/slice/mod.rs.html#2089">Source</a></span><h4 class="code-header">pub unsafe fn <a href="#method.split_at_mut_unchecked" class="fn">split_at_mut_unchecked</a>(
&amp;mut self,
mid: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>,
) -&gt; (&amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>, &amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>)</h4></section></summary><div class="docblock"><p>Divides one mutable 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.93.1/std/primitive.slice.html#method.split_at_mut" title="method slice::split_at_mut"><code>split_at_mut</code></a>.</p>
<h5 id="safety-7"><a class="doc-anchor" href="#safety-7">§</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 &lt;= mid &lt;= self.len()</code>.</p>
<h5 id="examples-74"><a class="doc-anchor" href="#examples-74">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>v = [<span class="number">1</span>, <span class="number">0</span>, <span class="number">3</span>, <span class="number">0</span>, <span class="number">5</span>, <span class="number">6</span>];
<span class="comment">// scoped to restrict the lifetime of the borrows
</span><span class="kw">unsafe </span>{
<span class="kw">let </span>(left, right) = v.split_at_mut_unchecked(<span class="number">2</span>);
<span class="macro">assert_eq!</span>(left, [<span class="number">1</span>, <span class="number">0</span>]);
<span class="macro">assert_eq!</span>(right, [<span class="number">3</span>, <span class="number">0</span>, <span class="number">5</span>, <span class="number">6</span>]);
left[<span class="number">1</span>] = <span class="number">2</span>;
right[<span class="number">1</span>] = <span class="number">4</span>;
}
<span class="macro">assert_eq!</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>]);</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.93.1/src/core/slice/mod.rs.html#2150">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_at_checked" class="fn">split_at_checked</a>(&amp;self, mid: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;(&amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>, &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>)&gt;</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 &gt; len</code>, returns <code>None</code>.</p>
<h5 id="examples-75"><a class="doc-anchor" href="#examples-75">§</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_at_mut_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.93.1/src/core/slice/mod.rs.html#2189">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_at_mut_checked" class="fn">split_at_mut_checked</a>(
&amp;mut self,
mid: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;(&amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>, &amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>)&gt;</h4></section></summary><div class="docblock"><p>Divides one mutable 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 &gt; len</code>, returns <code>None</code>.</p>
<h5 id="examples-76"><a class="doc-anchor" href="#examples-76">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>v = [<span class="number">1</span>, <span class="number">0</span>, <span class="number">3</span>, <span class="number">0</span>, <span class="number">5</span>, <span class="number">6</span>];
<span class="kw">if let </span><span class="prelude-val">Some</span>((left, right)) = v.split_at_mut_checked(<span class="number">2</span>) {
<span class="macro">assert_eq!</span>(left, [<span class="number">1</span>, <span class="number">0</span>]);
<span class="macro">assert_eq!</span>(right, [<span class="number">3</span>, <span class="number">0</span>, <span class="number">5</span>, <span class="number">6</span>]);
left[<span class="number">1</span>] = <span class="number">2</span>;
right[<span class="number">1</span>] = <span class="number">4</span>;
}
<span class="macro">assert_eq!</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="macro">assert_eq!</span>(<span class="prelude-val">None</span>, v.split_at_mut_checked(<span class="number">7</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split-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.93.1/src/core/slice/mod.rs.html#2241-2243">Source</a></span><h4 class="code-header">pub fn <a href="#method.split-1" class="fn">split</a>&lt;F&gt;(&amp;self, pred: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/slice/iter/struct.Split.html" title="struct core::slice::iter::Split">Split</a>&lt;'_, T, F&gt;<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.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-77"><a class="doc-anchor" href="#examples-77">§</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">&amp;</span>[<span class="number">10</span>, <span class="number">40</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</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">&amp;</span>[<span class="number">10</span>, <span class="number">40</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</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">&amp;</span>[<span class="number">10</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</span>[]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</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_mut" 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.93.1/src/core/slice/mod.rs.html#2263-2265">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_mut" class="fn">split_mut</a>&lt;F&gt;(&amp;mut self, pred: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/slice/iter/struct.SplitMut.html" title="struct core::slice::iter::SplitMut">SplitMut</a>&lt;'_, T, F&gt;<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Returns an iterator over mutable subslices separated by elements that
match <code>pred</code>. The matched element is not contained in the subslices.</p>
<h5 id="examples-78"><a class="doc-anchor" href="#examples-78">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </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.split_mut(|num| <span class="kw-2">*</span>num % <span class="number">3 </span>== <span class="number">0</span>) {
group[<span class="number">0</span>] = <span class="number">1</span>;
}
<span class="macro">assert_eq!</span>(v, [<span class="number">1</span>, <span class="number">40</span>, <span class="number">30</span>, <span class="number">1</span>, <span class="number">60</span>, <span class="number">1</span>]);</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.93.1/src/core/slice/mod.rs.html#2299-2301">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_inclusive" class="fn">split_inclusive</a>&lt;F&gt;(&amp;self, pred: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/slice/iter/struct.SplitInclusive.html" title="struct core::slice::iter::SplitInclusive">SplitInclusive</a>&lt;'_, T, F&gt;<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.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-79"><a class="doc-anchor" href="#examples-79">§</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">&amp;</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">&amp;</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">&amp;</span>[<span class="number">3</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</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.split_inclusive_mut" 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.93.1/src/core/slice/mod.rs.html#2323-2325">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_inclusive_mut" class="fn">split_inclusive_mut</a>&lt;F&gt;(&amp;mut self, pred: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/slice/iter/struct.SplitInclusiveMut.html" title="struct core::slice::iter::SplitInclusiveMut">SplitInclusiveMut</a>&lt;'_, T, F&gt;<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Returns an iterator over mutable subslices separated by elements that
match <code>pred</code>. The matched element is contained in the previous
subslice as a terminator.</p>
<h5 id="examples-80"><a class="doc-anchor" href="#examples-80">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </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.split_inclusive_mut(|num| <span class="kw-2">*</span>num % <span class="number">3 </span>== <span class="number">0</span>) {
<span class="kw">let </span>terminator_idx = group.len()-<span class="number">1</span>;
group[terminator_idx] = <span class="number">1</span>;
}
<span class="macro">assert_eq!</span>(v, [<span class="number">10</span>, <span class="number">40</span>, <span class="number">1</span>, <span class="number">20</span>, <span class="number">1</span>, <span class="number">1</span>]);</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.93.1/src/core/slice/mod.rs.html#2359-2361">Source</a></span><h4 class="code-header">pub fn <a href="#method.rsplit" class="fn">rsplit</a>&lt;F&gt;(&amp;self, pred: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/slice/iter/struct.RSplit.html" title="struct core::slice::iter::RSplit">RSplit</a>&lt;'_, T, F&gt;<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.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-81"><a class="doc-anchor" href="#examples-81">§</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">&amp;</span>[<span class="number">44</span>, <span class="number">55</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</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">&amp;</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">&amp;</span>[]);
<span class="macro">assert_eq!</span>(it.next().unwrap(), <span class="kw-2">&amp;</span>[<span class="number">3</span>, <span class="number">5</span>]);
<span class="macro">assert_eq!</span>(it.next().unwrap(), <span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">1</span>]);
<span class="macro">assert_eq!</span>(it.next().unwrap(), <span class="kw-2">&amp;</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.rsplit_mut" 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.93.1/src/core/slice/mod.rs.html#2385-2387">Source</a></span><h4 class="code-header">pub fn <a href="#method.rsplit_mut" class="fn">rsplit_mut</a>&lt;F&gt;(&amp;mut self, pred: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/slice/iter/struct.RSplitMut.html" title="struct core::slice::iter::RSplitMut">RSplitMut</a>&lt;'_, T, F&gt;<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Returns an iterator over mutable 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-82"><a class="doc-anchor" href="#examples-82">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>v = [<span class="number">100</span>, <span class="number">400</span>, <span class="number">300</span>, <span class="number">200</span>, <span class="number">600</span>, <span class="number">500</span>];
<span class="kw">let </span><span class="kw-2">mut </span>count = <span class="number">0</span>;
<span class="kw">for </span>group <span class="kw">in </span>v.rsplit_mut(|num| <span class="kw-2">*</span>num % <span class="number">3 </span>== <span class="number">0</span>) {
count += <span class="number">1</span>;
group[<span class="number">0</span>] = count;
}
<span class="macro">assert_eq!</span>(v, [<span class="number">3</span>, <span class="number">400</span>, <span class="number">300</span>, <span class="number">2</span>, <span class="number">600</span>, <span class="number">1</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.93.1/src/core/slice/mod.rs.html#2413-2415">Source</a></span><h4 class="code-header">pub fn <a href="#method.splitn" class="fn">splitn</a>&lt;F&gt;(&amp;self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>, pred: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/slice/iter/struct.SplitN.html" title="struct core::slice::iter::SplitN">SplitN</a>&lt;'_, T, F&gt;<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.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-83"><a class="doc-anchor" href="#examples-83">§</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.splitn_mut" 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.93.1/src/core/slice/mod.rs.html#2439-2441">Source</a></span><h4 class="code-header">pub fn <a href="#method.splitn_mut" class="fn">splitn_mut</a>&lt;F&gt;(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>, pred: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/slice/iter/struct.SplitNMut.html" title="struct core::slice::iter::SplitNMut">SplitNMut</a>&lt;'_, T, F&gt;<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Returns an iterator over mutable 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-84"><a class="doc-anchor" href="#examples-84">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </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_mut(<span class="number">2</span>, |num| <span class="kw-2">*</span>num % <span class="number">3 </span>== <span class="number">0</span>) {
group[<span class="number">0</span>] = <span class="number">1</span>;
}
<span class="macro">assert_eq!</span>(v, [<span class="number">1</span>, <span class="number">40</span>, <span class="number">30</span>, <span class="number">1</span>, <span class="number">60</span>, <span class="number">50</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.93.1/src/core/slice/mod.rs.html#2468-2470">Source</a></span><h4 class="code-header">pub fn <a href="#method.rsplitn" class="fn">rsplitn</a>&lt;F&gt;(&amp;self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>, pred: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/slice/iter/struct.RSplitN.html" title="struct core::slice::iter::RSplitN">RSplitN</a>&lt;'_, T, F&gt;<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.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-85"><a class="doc-anchor" href="#examples-85">§</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.rsplitn_mut" 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.93.1/src/core/slice/mod.rs.html#2495-2497">Source</a></span><h4 class="code-header">pub fn <a href="#method.rsplitn_mut" class="fn">rsplitn_mut</a>&lt;F&gt;(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>, pred: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/slice/iter/struct.RSplitNMut.html" title="struct core::slice::iter::RSplitNMut">RSplitNMut</a>&lt;'_, T, F&gt;<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.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-86"><a class="doc-anchor" href="#examples-86">§</a>Examples</h5>
<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="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>s.rsplitn_mut(<span class="number">2</span>, |num| <span class="kw-2">*</span>num % <span class="number">3 </span>== <span class="number">0</span>) {
group[<span class="number">0</span>] = <span class="number">1</span>;
}
<span class="macro">assert_eq!</span>(s, [<span class="number">1</span>, <span class="number">40</span>, <span class="number">30</span>, <span class="number">20</span>, <span class="number">60</span>, <span class="number">1</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.93.1/src/core/slice/mod.rs.html#2522-2524">Source</a><h4 class="code-header">pub fn <a href="#method.split_once" class="fn">split_once</a>&lt;F&gt;(&amp;self, pred: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;(&amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>, &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>)&gt;<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.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-87"><a class="doc-anchor" href="#examples-87">§</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">&amp;</span>x| x == <span class="number">2</span>), <span class="prelude-val">Some</span>((
<span class="kw-2">&amp;</span>[<span class="number">1</span>][..],
<span class="kw-2">&amp;</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">&amp;</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.93.1/src/core/slice/mod.rs.html#2550-2552">Source</a><h4 class="code-header">pub fn <a href="#method.rsplit_once" class="fn">rsplit_once</a>&lt;F&gt;(&amp;self, pred: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;(&amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>, &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>)&gt;<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.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-88"><a class="doc-anchor" href="#examples-88">§</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">&amp;</span>x| x == <span class="number">2</span>), <span class="prelude-val">Some</span>((
<span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>][..],
<span class="kw-2">&amp;</span>[<span class="number">4</span>][..]
)));
<span class="macro">assert_eq!</span>(s.rsplit_once(|<span class="kw-2">&amp;</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.93.1/src/core/slice/mod.rs.html#2586-2588">Source</a></span><h4 class="code-header">pub fn <a href="#method.contains" class="fn">contains</a>(&amp;self, x: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a><div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.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-89"><a class="doc-anchor" href="#examples-89">§</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">&amp;</span><span class="number">30</span>));
<span class="macro">assert!</span>(!v.contains(<span class="kw-2">&amp;</span><span class="number">50</span>));</code></pre></div>
<p>If you do not have a <code>&amp;T</code>, but some other value that you can compare
with one (for example, <code>String</code> implements <code>PartialEq&lt;str&gt;</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 `&amp;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.93.1/src/core/slice/mod.rs.html#2616-2618">Source</a></span><h4 class="code-header">pub fn <a href="#method.starts_with" class="fn">starts_with</a>(&amp;self, needle: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a><div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.93.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-90"><a class="doc-anchor" href="#examples-90">§</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">&amp;</span>[<span class="number">10</span>]));
<span class="macro">assert!</span>(v.starts_with(<span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">40</span>]));
<span class="macro">assert!</span>(v.starts_with(<span class="kw-2">&amp;</span>v));
<span class="macro">assert!</span>(!v.starts_with(<span class="kw-2">&amp;</span>[<span class="number">50</span>]));
<span class="macro">assert!</span>(!v.starts_with(<span class="kw-2">&amp;</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">&amp;</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">&amp;</span>[]));
<span class="kw">let </span>v: <span class="kw-2">&amp;</span>[u8] = <span class="kw-2">&amp;</span>[];
<span class="macro">assert!</span>(v.starts_with(<span class="kw-2">&amp;</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.93.1/src/core/slice/mod.rs.html#2647-2649">Source</a></span><h4 class="code-header">pub fn <a href="#method.ends_with" class="fn">ends_with</a>(&amp;self, needle: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a><div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.93.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-91"><a class="doc-anchor" href="#examples-91">§</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">&amp;</span>[<span class="number">30</span>]));
<span class="macro">assert!</span>(v.ends_with(<span class="kw-2">&amp;</span>[<span class="number">40</span>, <span class="number">30</span>]));
<span class="macro">assert!</span>(v.ends_with(<span class="kw-2">&amp;</span>v));
<span class="macro">assert!</span>(!v.ends_with(<span class="kw-2">&amp;</span>[<span class="number">50</span>]));
<span class="macro">assert!</span>(!v.ends_with(<span class="kw-2">&amp;</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">&amp;</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">&amp;</span>[]));
<span class="kw">let </span>v: <span class="kw-2">&amp;</span>[u8] = <span class="kw-2">&amp;</span>[];
<span class="macro">assert!</span>(v.ends_with(<span class="kw-2">&amp;</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.93.1/src/core/slice/mod.rs.html#2679-2681">Source</a></span><h4 class="code-header">pub fn <a href="#method.strip_prefix" class="fn">strip_prefix</a>&lt;P&gt;(&amp;self, prefix: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;P</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>&gt;<div class="where">where
P: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/slice/trait.SlicePattern.html" title="trait core::slice::SlicePattern">SlicePattern</a>&lt;Item = T&gt; + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
T: <a class="trait" href="https://doc.rust-lang.org/1.93.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-92"><a class="doc-anchor" href="#examples-92">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = <span class="kw-2">&amp;</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">&amp;</span>[<span class="number">10</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>[<span class="number">40</span>, <span class="number">30</span>][..]));
<span class="macro">assert_eq!</span>(v.strip_prefix(<span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">40</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>[<span class="number">30</span>][..]));
<span class="macro">assert_eq!</span>(v.strip_prefix(<span class="kw-2">&amp;</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">&amp;</span>[][..]));
<span class="macro">assert_eq!</span>(v.strip_prefix(<span class="kw-2">&amp;</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">&amp;</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">&amp;</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.93.1/src/core/slice/mod.rs.html#2715-2717">Source</a></span><h4 class="code-header">pub fn <a href="#method.strip_suffix" class="fn">strip_suffix</a>&lt;P&gt;(&amp;self, suffix: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;P</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>&gt;<div class="where">where
P: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/slice/trait.SlicePattern.html" title="trait core::slice::SlicePattern">SlicePattern</a>&lt;Item = T&gt; + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
T: <a class="trait" href="https://doc.rust-lang.org/1.93.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-93"><a class="doc-anchor" href="#examples-93">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = <span class="kw-2">&amp;</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">&amp;</span>[<span class="number">30</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">40</span>][..]));
<span class="macro">assert_eq!</span>(v.strip_suffix(<span class="kw-2">&amp;</span>[<span class="number">40</span>, <span class="number">30</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>[<span class="number">10</span>][..]));
<span class="macro">assert_eq!</span>(v.strip_suffix(<span class="kw-2">&amp;</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">&amp;</span>[][..]));
<span class="macro">assert_eq!</span>(v.strip_suffix(<span class="kw-2">&amp;</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">&amp;</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"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#2754-2758">Source</a><h4 class="code-header">pub fn <a href="#method.strip_circumfix" class="fn">strip_circumfix</a>&lt;S, P&gt;(&amp;self, prefix: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;P</a>, suffix: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;S</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>&gt;<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>,
S: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/slice/trait.SlicePattern.html" title="trait core::slice::SlicePattern">SlicePattern</a>&lt;Item = T&gt; + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
P: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/slice/trait.SlicePattern.html" title="trait core::slice::SlicePattern">SlicePattern</a>&lt;Item = T&gt; + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</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>strip_circumfix</code>)</span></div></span></summary><div class="docblock"><p>Returns a subslice with the prefix and suffix removed.</p>
<p>If the slice starts with <code>prefix</code> and ends with <code>suffix</code>, 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> or does not end with <code>suffix</code>, returns <code>None</code>.</p>
<h5 id="examples-94"><a class="doc-anchor" href="#examples-94">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(strip_circumfix)]
</span><span class="kw">let </span>v = <span class="kw-2">&amp;</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">&amp;</span>[<span class="number">10</span>], <span class="kw-2">&amp;</span>[<span class="number">30</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>[<span class="number">50</span>, <span class="number">40</span>][..]));
<span class="macro">assert_eq!</span>(v.strip_circumfix(<span class="kw-2">&amp;</span>[<span class="number">10</span>], <span class="kw-2">&amp;</span>[<span class="number">40</span>, <span class="number">30</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>[<span class="number">50</span>][..]));
<span class="macro">assert_eq!</span>(v.strip_circumfix(<span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">50</span>], <span class="kw-2">&amp;</span>[<span class="number">40</span>, <span class="number">30</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>[][..]));
<span class="macro">assert_eq!</span>(v.strip_circumfix(<span class="kw-2">&amp;</span>[<span class="number">50</span>], <span class="kw-2">&amp;</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">&amp;</span>[<span class="number">10</span>], <span class="kw-2">&amp;</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">&amp;</span>[], <span class="kw-2">&amp;</span>[<span class="number">40</span>, <span class="number">30</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">50</span>][..]));
<span class="macro">assert_eq!</span>(v.strip_circumfix(<span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">50</span>], <span class="kw-2">&amp;</span>[]), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</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.trim_prefix" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#2790-2792">Source</a><h4 class="code-header">pub fn <a href="#method.trim_prefix" class="fn">trim_prefix</a>&lt;P&gt;(&amp;self, prefix: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;P</a>) -&gt; &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a><div class="where">where
P: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/slice/trait.SlicePattern.html" title="trait core::slice::SlicePattern">SlicePattern</a>&lt;Item = T&gt; + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
T: <a class="trait" href="https://doc.rust-lang.org/1.93.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-95"><a class="doc-anchor" href="#examples-95">§</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">&amp;</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">&amp;</span>[<span class="number">10</span>]), <span class="kw-2">&amp;</span>[<span class="number">40</span>, <span class="number">30</span>][..]);
<span class="macro">assert_eq!</span>(v.trim_prefix(<span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">40</span>]), <span class="kw-2">&amp;</span>[<span class="number">30</span>][..]);
<span class="macro">assert_eq!</span>(v.trim_prefix(<span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>]), <span class="kw-2">&amp;</span>[][..]);
<span class="comment">// Prefix absent - returns original slice
</span><span class="macro">assert_eq!</span>(v.trim_prefix(<span class="kw-2">&amp;</span>[<span class="number">50</span>]), <span class="kw-2">&amp;</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">&amp;</span>[<span class="number">10</span>, <span class="number">50</span>]), <span class="kw-2">&amp;</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">&amp;</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.93.1/src/core/slice/mod.rs.html#2830-2832">Source</a><h4 class="code-header">pub fn <a href="#method.trim_suffix" class="fn">trim_suffix</a>&lt;P&gt;(&amp;self, suffix: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;P</a>) -&gt; &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a><div class="where">where
P: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/slice/trait.SlicePattern.html" title="trait core::slice::SlicePattern">SlicePattern</a>&lt;Item = T&gt; + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
T: <a class="trait" href="https://doc.rust-lang.org/1.93.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-96"><a class="doc-anchor" href="#examples-96">§</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">&amp;</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">&amp;</span>[<span class="number">30</span>]), <span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">40</span>][..]);
<span class="macro">assert_eq!</span>(v.trim_suffix(<span class="kw-2">&amp;</span>[<span class="number">40</span>, <span class="number">30</span>]), <span class="kw-2">&amp;</span>[<span class="number">10</span>][..]);
<span class="macro">assert_eq!</span>(v.trim_suffix(<span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>]), <span class="kw-2">&amp;</span>[][..]);
<span class="comment">// Suffix absent - returns original slice
</span><span class="macro">assert_eq!</span>(v.trim_suffix(<span class="kw-2">&amp;</span>[<span class="number">50</span>]), <span class="kw-2">&amp;</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">&amp;</span>[<span class="number">50</span>, <span class="number">30</span>]), <span class="kw-2">&amp;</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.93.1/src/core/slice/mod.rs.html#2916-2918">Source</a></span><h4 class="code-header">pub fn <a href="#method.binary_search" class="fn">binary_search</a>(&amp;self, x: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.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.93.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.93.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.93.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.93.1/std/primitive.slice.html#method.partition_point" title="method slice::partition_point"><code>partition_point</code></a>.</p>
<h5 id="examples-97"><a class="doc-anchor" href="#examples-97">§</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">&amp;</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">&amp;</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">&amp;</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">&amp;</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>) =&gt; <span class="bool-val">true</span>, <span class="kw">_ </span>=&gt; <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.93.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 &lt; <span class="kw-2">&amp;</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 &lt;= <span class="kw-2">&amp;</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">&amp;</span><span class="number">1</span>);
<span class="macro">assert!</span>((low..high).contains(<span class="kw-2">&amp;</span>r.unwrap()));
<span class="macro">assert!</span>(s[..low].iter().all(|<span class="kw-2">&amp;</span>x| x &lt; <span class="number">1</span>));
<span class="macro">assert!</span>(s[low..high].iter().all(|<span class="kw-2">&amp;</span>x| x == <span class="number">1</span>));
<span class="macro">assert!</span>(s[high..].iter().all(|<span class="kw-2">&amp;</span>x| x &gt; <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 &lt; <span class="kw-2">&amp;</span><span class="number">11</span>), <span class="number">9</span>);
<span class="macro">assert_eq!</span>(s.partition_point(|x| x &lt;= <span class="kw-2">&amp;</span><span class="number">11</span>), <span class="number">9</span>);
<span class="macro">assert_eq!</span>(s.binary_search(<span class="kw-2">&amp;</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.93.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">&amp;</span>x| x &lt;= num);
<span class="comment">// If `num` is unique, `s.partition_point(|&amp;x| x &lt; num)` (with `&lt;`) is equivalent to
// `s.binary_search(&amp;num).unwrap_or_else(|x| x)`, but using `&lt;=` 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.93.1/src/core/slice/mod.rs.html#2967-2969">Source</a></span><h4 class="code-header">pub fn <a href="#method.binary_search_by" class="fn">binary_search_by</a>&lt;'a, F&gt;(&amp;'a self, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;'a T</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.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.93.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.93.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.93.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.93.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.93.1/std/primitive.slice.html#method.partition_point" title="method slice::partition_point"><code>partition_point</code></a>.</p>
<h5 id="examples-98"><a class="doc-anchor" href="#examples-98">§</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">&amp;</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">&amp;</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">&amp;</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">&amp;</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>) =&gt; <span class="bool-val">true</span>, <span class="kw">_ </span>=&gt; <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.93.1/src/core/slice/mod.rs.html#3068-3071">Source</a></span><h4 class="code-header">pub fn <a href="#method.binary_search_by_key" class="fn">binary_search_by_key</a>&lt;'a, B, F&gt;(
&amp;'a self,
b: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;B</a>,
f: F,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;'a T</a>) -&gt; B,
B: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.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.93.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.93.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.93.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.93.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.93.1/std/primitive.slice.html#method.partition_point" title="method slice::partition_point"><code>partition_point</code></a>.</p>
<h5 id="examples-99"><a class="doc-anchor" href="#examples-99">§</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">&amp;</span><span class="number">13</span>, |<span class="kw-2">&amp;</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">&amp;</span><span class="number">4</span>, |<span class="kw-2">&amp;</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">&amp;</span><span class="number">100</span>, |<span class="kw-2">&amp;</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">&amp;</span><span class="number">1</span>, |<span class="kw-2">&amp;</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>) =&gt; <span class="bool-val">true</span>, <span class="kw">_ </span>=&gt; <span class="bool-val">false</span>, });</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.sort_unstable" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.20.0">1.20.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#3130-3132">Source</a></span><h4 class="code-header">pub fn <a href="#method.sort_unstable" class="fn">sort_unstable</a>(&amp;mut self)<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h4></section></summary><div class="docblock"><p>Sorts the slice in ascending order <strong>without</strong> preserving the initial order of equal elements.</p>
<p>This sort is unstable (i.e., may reorder equal elements), in-place (i.e., does not
allocate), and <em>O</em>(<em>n</em> * log(<em>n</em>)) worst-case.</p>
<p>If the implementation of <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord"><code>Ord</code></a> for <code>T</code> does not implement a <a href="https://en.wikipedia.org/wiki/Total_order">total order</a>, the function
may panic; even if the function exits normally, the resulting order of elements in the slice
is unspecified. See also the note on panicking below.</p>
<p>For example <code>|a, b| (a - b).cmp(a)</code> is a comparison function that is neither transitive nor
reflexive nor total, <code>a &lt; b &lt; c &lt; a</code> with <code>a = 1, b = 2, c = 3</code>. For more information and
examples see the <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord"><code>Ord</code></a> documentation.</p>
<p>All original elements will remain in the slice and any possible modifications via interior
mutability are observed in the input. Same is true if the implementation of <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord"><code>Ord</code></a> for <code>T</code> panics.</p>
<p>Sorting types that only implement <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd"><code>PartialOrd</code></a> such as <a href="https://doc.rust-lang.org/1.93.1/std/primitive.f32.html" title="primitive f32"><code>f32</code></a> and <a href="https://doc.rust-lang.org/1.93.1/std/primitive.f64.html" title="primitive f64"><code>f64</code></a> require
additional precautions. For example, <code>f32::NAN != f32::NAN</code>, which doesnt fulfill the
reflexivity requirement of <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord"><code>Ord</code></a>. By using an alternative comparison function with
<code>slice::sort_unstable_by</code> such as <a href="https://doc.rust-lang.org/1.93.1/std/primitive.f32.html#method.total_cmp" title="method f32::total_cmp"><code>f32::total_cmp</code></a> or <a href="https://doc.rust-lang.org/1.93.1/std/primitive.f64.html#method.total_cmp" title="method f64::total_cmp"><code>f64::total_cmp</code></a> that defines a
<a href="https://en.wikipedia.org/wiki/Total_order">total order</a> users can sort slices containing floating-point values. Alternatively, if all
values in the slice are guaranteed to be in a subset for which <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" title="method core::cmp::PartialOrd::partial_cmp"><code>PartialOrd::partial_cmp</code></a>
forms a <a href="https://en.wikipedia.org/wiki/Total_order">total order</a>, its possible to sort the slice with <code>sort_unstable_by(|a, b| a.partial_cmp(b).unwrap())</code>.</p>
<h5 id="current-implementation"><a class="doc-anchor" href="#current-implementation">§</a>Current implementation</h5>
<p>The current implementation is based on <a href="https://github.com/Voultapher/sort-research-rs/tree/main/ipnsort">ipnsort</a> by Lukas Bergdoll and Orson Peters, which
combines the fast average case of quicksort with the fast worst case of heapsort, achieving
linear time on fully sorted and reversed inputs. On inputs with k distinct elements, the
expected time to sort the data is <em>O</em>(<em>n</em> * log(<em>k</em>)).</p>
<p>It is typically faster than stable sorting, except in a few special cases, e.g., when the
slice is partially sorted.</p>
<h5 id="panics-20"><a class="doc-anchor" href="#panics-20">§</a>Panics</h5>
<p>May panic if the implementation of <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord"><code>Ord</code></a> for <code>T</code> does not implement a <a href="https://en.wikipedia.org/wiki/Total_order">total order</a>, or if
the <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord"><code>Ord</code></a> implementation panics.</p>
<h5 id="examples-100"><a class="doc-anchor" href="#examples-100">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>v = [<span class="number">4</span>, -<span class="number">5</span>, <span class="number">1</span>, -<span class="number">3</span>, <span class="number">2</span>];
v.sort_unstable();
<span class="macro">assert_eq!</span>(v, [-<span class="number">5</span>, -<span class="number">3</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.sort_unstable_by" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.20.0">1.20.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#3185-3187">Source</a></span><h4 class="code-header">pub fn <a href="#method.sort_unstable_by" class="fn">sort_unstable_by</a>&lt;F&gt;(&amp;mut self, compare: F)<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;T</a>, <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>,</div></h4></section></summary><div class="docblock"><p>Sorts the slice in ascending order with a comparison function, <strong>without</strong> preserving the
initial order of equal elements.</p>
<p>This sort is unstable (i.e., may reorder equal elements), in-place (i.e., does not
allocate), and <em>O</em>(<em>n</em> * log(<em>n</em>)) worst-case.</p>
<p>If the comparison function <code>compare</code> does not implement a <a href="https://en.wikipedia.org/wiki/Total_order">total order</a>, the function
may panic; even if the function exits normally, the resulting order of elements in the slice
is unspecified. See also the note on panicking below.</p>
<p>For example <code>|a, b| (a - b).cmp(a)</code> is a comparison function that is neither transitive nor
reflexive nor total, <code>a &lt; b &lt; c &lt; a</code> with <code>a = 1, b = 2, c = 3</code>. For more information and
examples see the <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord"><code>Ord</code></a> documentation.</p>
<p>All original elements will remain in the slice and any possible modifications via interior
mutability are observed in the input. Same is true if <code>compare</code> panics.</p>
<h5 id="current-implementation-1"><a class="doc-anchor" href="#current-implementation-1">§</a>Current implementation</h5>
<p>The current implementation is based on <a href="https://github.com/Voultapher/sort-research-rs/tree/main/ipnsort">ipnsort</a> by Lukas Bergdoll and Orson Peters, which
combines the fast average case of quicksort with the fast worst case of heapsort, achieving
linear time on fully sorted and reversed inputs. On inputs with k distinct elements, the
expected time to sort the data is <em>O</em>(<em>n</em> * log(<em>k</em>)).</p>
<p>It is typically faster than stable sorting, except in a few special cases, e.g., when the
slice is partially sorted.</p>
<h5 id="panics-21"><a class="doc-anchor" href="#panics-21">§</a>Panics</h5>
<p>May panic if the <code>compare</code> does not implement a <a href="https://en.wikipedia.org/wiki/Total_order">total order</a>, or if
the <code>compare</code> itself panics.</p>
<h5 id="examples-101"><a class="doc-anchor" href="#examples-101">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>v = [<span class="number">4</span>, -<span class="number">5</span>, <span class="number">1</span>, -<span class="number">3</span>, <span class="number">2</span>];
v.sort_unstable_by(|a, b| a.cmp(b));
<span class="macro">assert_eq!</span>(v, [-<span class="number">5</span>, -<span class="number">3</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>]);
<span class="comment">// reverse sorting
</span>v.sort_unstable_by(|a, b| b.cmp(a));
<span class="macro">assert_eq!</span>(v, [<span class="number">4</span>, <span class="number">2</span>, <span class="number">1</span>, -<span class="number">3</span>, -<span class="number">5</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.sort_unstable_by_key" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.20.0">1.20.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#3237-3240">Source</a></span><h4 class="code-header">pub fn <a href="#method.sort_unstable_by_key" class="fn">sort_unstable_by_key</a>&lt;K, F&gt;(&amp;mut self, f: F)<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; K,
K: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h4></section></summary><div class="docblock"><p>Sorts the slice in ascending order with a key extraction function, <strong>without</strong> preserving
the initial order of equal elements.</p>
<p>This sort is unstable (i.e., may reorder equal elements), in-place (i.e., does not
allocate), and <em>O</em>(<em>n</em> * log(<em>n</em>)) worst-case.</p>
<p>If the implementation of <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord"><code>Ord</code></a> for <code>K</code> does not implement a <a href="https://en.wikipedia.org/wiki/Total_order">total order</a>, the function
may panic; even if the function exits normally, the resulting order of elements in the slice
is unspecified. See also the note on panicking below.</p>
<p>For example <code>|a, b| (a - b).cmp(a)</code> is a comparison function that is neither transitive nor
reflexive nor total, <code>a &lt; b &lt; c &lt; a</code> with <code>a = 1, b = 2, c = 3</code>. For more information and
examples see the <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord"><code>Ord</code></a> documentation.</p>
<p>All original elements will remain in the slice and any possible modifications via interior
mutability are observed in the input. Same is true if the implementation of <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord"><code>Ord</code></a> for <code>K</code> panics.</p>
<h5 id="current-implementation-2"><a class="doc-anchor" href="#current-implementation-2">§</a>Current implementation</h5>
<p>The current implementation is based on <a href="https://github.com/Voultapher/sort-research-rs/tree/main/ipnsort">ipnsort</a> by Lukas Bergdoll and Orson Peters, which
combines the fast average case of quicksort with the fast worst case of heapsort, achieving
linear time on fully sorted and reversed inputs. On inputs with k distinct elements, the
expected time to sort the data is <em>O</em>(<em>n</em> * log(<em>k</em>)).</p>
<p>It is typically faster than stable sorting, except in a few special cases, e.g., when the
slice is partially sorted.</p>
<h5 id="panics-22"><a class="doc-anchor" href="#panics-22">§</a>Panics</h5>
<p>May panic if the implementation of <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord"><code>Ord</code></a> for <code>K</code> does not implement a <a href="https://en.wikipedia.org/wiki/Total_order">total order</a>, or if
the <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord"><code>Ord</code></a> implementation panics.</p>
<h5 id="examples-102"><a class="doc-anchor" href="#examples-102">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>v = [<span class="number">4i32</span>, -<span class="number">5</span>, <span class="number">1</span>, -<span class="number">3</span>, <span class="number">2</span>];
v.sort_unstable_by_key(|k| k.abs());
<span class="macro">assert_eq!</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>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.select_nth_unstable" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.49.0">1.49.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#3300-3302">Source</a></span><h4 class="code-header">pub fn <a href="#method.select_nth_unstable" class="fn">select_nth_unstable</a>(
&amp;mut self,
index: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>,
) -&gt; (&amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>, <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut T</a>, &amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>)<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h4></section></summary><div class="docblock"><p>Reorders the slice such that the element at <code>index</code> is at a sort-order position. All
elements before <code>index</code> will be <code>&lt;=</code> to this value, and all elements after will be <code>&gt;=</code> to
it.</p>
<p>This reordering is unstable (i.e. any element that compares equal to the nth element may end
up at that position), in-place (i.e. does not allocate), and runs in <em>O</em>(<em>n</em>) time. This
function is also known as “kth element” in other libraries.</p>
<p>Returns a triple that partitions the reordered slice:</p>
<ul>
<li>
<p>The unsorted subslice before <code>index</code>, whose elements all satisfy <code>x &lt;= self[index]</code>.</p>
</li>
<li>
<p>The element at <code>index</code>.</p>
</li>
<li>
<p>The unsorted subslice after <code>index</code>, whose elements all satisfy <code>x &gt;= self[index]</code>.</p>
</li>
</ul>
<h5 id="current-implementation-3"><a class="doc-anchor" href="#current-implementation-3">§</a>Current implementation</h5>
<p>The current algorithm is an introselect implementation based on <a href="https://github.com/Voultapher/sort-research-rs/tree/main/ipnsort">ipnsort</a> by Lukas Bergdoll
and Orson Peters, which is also the basis for <a href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html#method.sort_unstable" title="method slice::sort_unstable"><code>sort_unstable</code></a>. The fallback algorithm is
Median of Medians using Tukeys Ninther for pivot selection, which guarantees linear runtime
for all inputs.</p>
<h5 id="panics-23"><a class="doc-anchor" href="#panics-23">§</a>Panics</h5>
<p>Panics when <code>index &gt;= len()</code>, and so always panics on empty slices.</p>
<p>May panic if the implementation of <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord"><code>Ord</code></a> for <code>T</code> does not implement a <a href="https://en.wikipedia.org/wiki/Total_order">total order</a>.</p>
<h5 id="examples-103"><a class="doc-anchor" href="#examples-103">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>v = [-<span class="number">5i32</span>, <span class="number">4</span>, <span class="number">2</span>, -<span class="number">3</span>, <span class="number">1</span>];
<span class="comment">// Find the items `&lt;=` to the median, the median itself, and the items `&gt;=` to it.
</span><span class="kw">let </span>(lesser, median, greater) = v.select_nth_unstable(<span class="number">2</span>);
<span class="macro">assert!</span>(lesser == [-<span class="number">3</span>, -<span class="number">5</span>] || lesser == [-<span class="number">5</span>, -<span class="number">3</span>]);
<span class="macro">assert_eq!</span>(median, <span class="kw-2">&amp;mut </span><span class="number">1</span>);
<span class="macro">assert!</span>(greater == [<span class="number">4</span>, <span class="number">2</span>] || greater == [<span class="number">2</span>, <span class="number">4</span>]);
<span class="comment">// We are only guaranteed the slice will be one of the following, based on the way we sort
// about the specified index.
</span><span class="macro">assert!</span>(v == [-<span class="number">3</span>, -<span class="number">5</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>] ||
v == [-<span class="number">5</span>, -<span class="number">3</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>] ||
v == [-<span class="number">3</span>, -<span class="number">5</span>, <span class="number">1</span>, <span class="number">4</span>, <span class="number">2</span>] ||
v == [-<span class="number">5</span>, -<span class="number">3</span>, <span class="number">1</span>, <span class="number">4</span>, <span class="number">2</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.select_nth_unstable_by" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.49.0">1.49.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#3365-3371">Source</a></span><h4 class="code-header">pub fn <a href="#method.select_nth_unstable_by" class="fn">select_nth_unstable_by</a>&lt;F&gt;(
&amp;mut self,
index: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>,
compare: F,
) -&gt; (&amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>, <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut T</a>, &amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>)<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;T</a>, <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>,</div></h4></section></summary><div class="docblock"><p>Reorders the slice with a comparator function such that the element at <code>index</code> is at a
sort-order position. All elements before <code>index</code> will be <code>&lt;=</code> to this value, and all
elements after will be <code>&gt;=</code> to it, according to the comparator function.</p>
<p>This reordering is unstable (i.e. any element that compares equal to the nth element may end
up at that position), in-place (i.e. does not allocate), and runs in <em>O</em>(<em>n</em>) time. This
function is also known as “kth element” in other libraries.</p>
<p>Returns a triple partitioning the reordered slice:</p>
<ul>
<li>
<p>The unsorted subslice before <code>index</code>, whose elements all satisfy
<code>compare(x, self[index]).is_le()</code>.</p>
</li>
<li>
<p>The element at <code>index</code>.</p>
</li>
<li>
<p>The unsorted subslice after <code>index</code>, whose elements all satisfy
<code>compare(x, self[index]).is_ge()</code>.</p>
</li>
</ul>
<h5 id="current-implementation-4"><a class="doc-anchor" href="#current-implementation-4">§</a>Current implementation</h5>
<p>The current algorithm is an introselect implementation based on <a href="https://github.com/Voultapher/sort-research-rs/tree/main/ipnsort">ipnsort</a> by Lukas Bergdoll
and Orson Peters, which is also the basis for <a href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html#method.sort_unstable" title="method slice::sort_unstable"><code>sort_unstable</code></a>. The fallback algorithm is
Median of Medians using Tukeys Ninther for pivot selection, which guarantees linear runtime
for all inputs.</p>
<h5 id="panics-24"><a class="doc-anchor" href="#panics-24">§</a>Panics</h5>
<p>Panics when <code>index &gt;= len()</code>, and so always panics on empty slices.</p>
<p>May panic if <code>compare</code> does not implement a <a href="https://en.wikipedia.org/wiki/Total_order">total order</a>.</p>
<h5 id="examples-104"><a class="doc-anchor" href="#examples-104">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>v = [-<span class="number">5i32</span>, <span class="number">4</span>, <span class="number">2</span>, -<span class="number">3</span>, <span class="number">1</span>];
<span class="comment">// Find the items `&gt;=` to the median, the median itself, and the items `&lt;=` to it, by using
// a reversed comparator.
</span><span class="kw">let </span>(before, median, after) = v.select_nth_unstable_by(<span class="number">2</span>, |a, b| b.cmp(a));
<span class="macro">assert!</span>(before == [<span class="number">4</span>, <span class="number">2</span>] || before == [<span class="number">2</span>, <span class="number">4</span>]);
<span class="macro">assert_eq!</span>(median, <span class="kw-2">&amp;mut </span><span class="number">1</span>);
<span class="macro">assert!</span>(after == [-<span class="number">3</span>, -<span class="number">5</span>] || after == [-<span class="number">5</span>, -<span class="number">3</span>]);
<span class="comment">// We are only guaranteed the slice will be one of the following, based on the way we sort
// about the specified index.
</span><span class="macro">assert!</span>(v == [<span class="number">2</span>, <span class="number">4</span>, <span class="number">1</span>, -<span class="number">5</span>, -<span class="number">3</span>] ||
v == [<span class="number">2</span>, <span class="number">4</span>, <span class="number">1</span>, -<span class="number">3</span>, -<span class="number">5</span>] ||
v == [<span class="number">4</span>, <span class="number">2</span>, <span class="number">1</span>, -<span class="number">5</span>, -<span class="number">3</span>] ||
v == [<span class="number">4</span>, <span class="number">2</span>, <span class="number">1</span>, -<span class="number">3</span>, -<span class="number">5</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.select_nth_unstable_by_key" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.49.0">1.49.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#3432-3439">Source</a></span><h4 class="code-header">pub fn <a href="#method.select_nth_unstable_by_key" class="fn">select_nth_unstable_by_key</a>&lt;K, F&gt;(
&amp;mut self,
index: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>,
f: F,
) -&gt; (&amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>, <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut T</a>, &amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>)<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; K,
K: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h4></section></summary><div class="docblock"><p>Reorders the slice with a key extraction function such that the element at <code>index</code> is at a
sort-order position. All elements before <code>index</code> will have keys <code>&lt;=</code> to the key at <code>index</code>,
and all elements after will have keys <code>&gt;=</code> to it.</p>
<p>This reordering is unstable (i.e. any element that compares equal to the nth element may end
up at that position), in-place (i.e. does not allocate), and runs in <em>O</em>(<em>n</em>) time. This
function is also known as “kth element” in other libraries.</p>
<p>Returns a triple partitioning the reordered slice:</p>
<ul>
<li>
<p>The unsorted subslice before <code>index</code>, whose elements all satisfy <code>f(x) &lt;= f(self[index])</code>.</p>
</li>
<li>
<p>The element at <code>index</code>.</p>
</li>
<li>
<p>The unsorted subslice after <code>index</code>, whose elements all satisfy <code>f(x) &gt;= f(self[index])</code>.</p>
</li>
</ul>
<h5 id="current-implementation-5"><a class="doc-anchor" href="#current-implementation-5">§</a>Current implementation</h5>
<p>The current algorithm is an introselect implementation based on <a href="https://github.com/Voultapher/sort-research-rs/tree/main/ipnsort">ipnsort</a> by Lukas Bergdoll
and Orson Peters, which is also the basis for <a href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html#method.sort_unstable" title="method slice::sort_unstable"><code>sort_unstable</code></a>. The fallback algorithm is
Median of Medians using Tukeys Ninther for pivot selection, which guarantees linear runtime
for all inputs.</p>
<h5 id="panics-25"><a class="doc-anchor" href="#panics-25">§</a>Panics</h5>
<p>Panics when <code>index &gt;= len()</code>, meaning it always panics on empty slices.</p>
<p>May panic if <code>K: Ord</code> does not implement a total order.</p>
<h5 id="examples-105"><a class="doc-anchor" href="#examples-105">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>v = [-<span class="number">5i32</span>, <span class="number">4</span>, <span class="number">1</span>, -<span class="number">3</span>, <span class="number">2</span>];
<span class="comment">// Find the items `&lt;=` to the absolute median, the absolute median itself, and the items
// `&gt;=` to it.
</span><span class="kw">let </span>(lesser, median, greater) = v.select_nth_unstable_by_key(<span class="number">2</span>, |a| a.abs());
<span class="macro">assert!</span>(lesser == [<span class="number">1</span>, <span class="number">2</span>] || lesser == [<span class="number">2</span>, <span class="number">1</span>]);
<span class="macro">assert_eq!</span>(median, <span class="kw-2">&amp;mut </span>-<span class="number">3</span>);
<span class="macro">assert!</span>(greater == [<span class="number">4</span>, -<span class="number">5</span>] || greater == [-<span class="number">5</span>, <span class="number">4</span>]);
<span class="comment">// We are only guaranteed the slice will be one of the following, based on the way we sort
// about the specified index.
</span><span class="macro">assert!</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>] ||
v == [<span class="number">1</span>, <span class="number">2</span>, -<span class="number">3</span>, -<span class="number">5</span>, <span class="number">4</span>] ||
v == [<span class="number">2</span>, <span class="number">1</span>, -<span class="number">3</span>, <span class="number">4</span>, -<span class="number">5</span>] ||
v == [<span class="number">2</span>, <span class="number">1</span>, -<span class="number">3</span>, -<span class="number">5</span>, <span class="number">4</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.partition_dedup" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#3466-3468">Source</a><h4 class="code-header">pub fn <a href="#method.partition_dedup" class="fn">partition_dedup</a>(&amp;mut self) -&gt; (&amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>, &amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>)<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.93.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>slice_partition_dedup</code>)</span></div></span></summary><div class="docblock"><p>Moves all consecutive repeated elements to the end of the slice according to the
<a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq"><code>PartialEq</code></a> trait implementation.</p>
<p>Returns two slices. The first contains no consecutive repeated elements.
The second contains all the duplicates in no specified order.</p>
<p>If the slice is sorted, the first returned slice contains no duplicates.</p>
<h5 id="examples-106"><a class="doc-anchor" href="#examples-106">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(slice_partition_dedup)]
</span><span class="kw">let </span><span class="kw-2">mut </span>slice = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">1</span>];
<span class="kw">let </span>(dedup, duplicates) = slice.partition_dedup();
<span class="macro">assert_eq!</span>(dedup, [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">1</span>]);
<span class="macro">assert_eq!</span>(duplicates, [<span class="number">2</span>, <span class="number">3</span>, <span class="number">1</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.partition_dedup_by" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#3500-3502">Source</a><h4 class="code-header">pub fn <a href="#method.partition_dedup_by" class="fn">partition_dedup_by</a>&lt;F&gt;(&amp;mut self, same_bucket: F) -&gt; (&amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>, &amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>)<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;mut T</a>, <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.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_partition_dedup</code>)</span></div></span></summary><div class="docblock"><p>Moves all but the first of consecutive elements to the end of the slice satisfying
a given equality relation.</p>
<p>Returns two slices. The first contains no consecutive repeated elements.
The second contains all the duplicates in no specified order.</p>
<p>The <code>same_bucket</code> function is passed references to two elements from the slice and
must determine if the elements compare equal. The elements are passed in opposite order
from their order in the slice, so if <code>same_bucket(a, b)</code> returns <code>true</code>, <code>a</code> is moved
at the end of the slice.</p>
<p>If the slice is sorted, the first returned slice contains no duplicates.</p>
<h5 id="examples-107"><a class="doc-anchor" href="#examples-107">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(slice_partition_dedup)]
</span><span class="kw">let </span><span class="kw-2">mut </span>slice = [<span class="string">"foo"</span>, <span class="string">"Foo"</span>, <span class="string">"BAZ"</span>, <span class="string">"Bar"</span>, <span class="string">"bar"</span>, <span class="string">"baz"</span>, <span class="string">"BAZ"</span>];
<span class="kw">let </span>(dedup, duplicates) = slice.partition_dedup_by(|a, b| a.eq_ignore_ascii_case(b));
<span class="macro">assert_eq!</span>(dedup, [<span class="string">"foo"</span>, <span class="string">"BAZ"</span>, <span class="string">"Bar"</span>, <span class="string">"baz"</span>]);
<span class="macro">assert_eq!</span>(duplicates, [<span class="string">"bar"</span>, <span class="string">"Foo"</span>, <span class="string">"BAZ"</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.partition_dedup_by_key" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#3626-3629">Source</a><h4 class="code-header">pub fn <a href="#method.partition_dedup_by_key" class="fn">partition_dedup_by_key</a>&lt;K, F&gt;(&amp;mut self, key: F) -&gt; (&amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>, &amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>)<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;mut T</a>) -&gt; K,
K: <a class="trait" href="https://doc.rust-lang.org/1.93.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>slice_partition_dedup</code>)</span></div></span></summary><div class="docblock"><p>Moves all but the first of consecutive elements to the end of the slice that resolve
to the same key.</p>
<p>Returns two slices. The first contains no consecutive repeated elements.
The second contains all the duplicates in no specified order.</p>
<p>If the slice is sorted, the first returned slice contains no duplicates.</p>
<h5 id="examples-108"><a class="doc-anchor" href="#examples-108">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(slice_partition_dedup)]
</span><span class="kw">let </span><span class="kw-2">mut </span>slice = [<span class="number">10</span>, <span class="number">20</span>, <span class="number">21</span>, <span class="number">30</span>, <span class="number">30</span>, <span class="number">20</span>, <span class="number">11</span>, <span class="number">13</span>];
<span class="kw">let </span>(dedup, duplicates) = slice.partition_dedup_by_key(|i| <span class="kw-2">*</span>i / <span class="number">10</span>);
<span class="macro">assert_eq!</span>(dedup, [<span class="number">10</span>, <span class="number">20</span>, <span class="number">30</span>, <span class="number">20</span>, <span class="number">11</span>]);
<span class="macro">assert_eq!</span>(duplicates, [<span class="number">21</span>, <span class="number">30</span>, <span class="number">13</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.rotate_left" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.26.0">1.26.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#3668">Source</a></span><h4 class="code-header">pub fn <a href="#method.rotate_left" class="fn">rotate_left</a>(&amp;mut self, mid: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Rotates the slice in-place such that the first <code>mid</code> elements of the
slice move to the end while the last <code>self.len() - mid</code> elements move to
the front.</p>
<p>After calling <code>rotate_left</code>, the element previously at index <code>mid</code> will
become the first element in the slice.</p>
<h5 id="panics-26"><a class="doc-anchor" href="#panics-26">§</a>Panics</h5>
<p>This function will panic if <code>mid</code> is greater than the length of the
slice. Note that <code>mid == self.len()</code> does <em>not</em> panic and is a no-op
rotation.</p>
<h5 id="complexity"><a class="doc-anchor" href="#complexity">§</a>Complexity</h5>
<p>Takes linear (in <code>self.len()</code>) time.</p>
<h5 id="examples-109"><a class="doc-anchor" href="#examples-109">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>a = [<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>, <span class="string">'d'</span>, <span class="string">'e'</span>, <span class="string">'f'</span>];
a.rotate_left(<span class="number">2</span>);
<span class="macro">assert_eq!</span>(a, [<span class="string">'c'</span>, <span class="string">'d'</span>, <span class="string">'e'</span>, <span class="string">'f'</span>, <span class="string">'a'</span>, <span class="string">'b'</span>]);</code></pre></div>
<p>Rotating a subslice:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>a = [<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>, <span class="string">'d'</span>, <span class="string">'e'</span>, <span class="string">'f'</span>];
a[<span class="number">1</span>..<span class="number">5</span>].rotate_left(<span class="number">1</span>);
<span class="macro">assert_eq!</span>(a, [<span class="string">'a'</span>, <span class="string">'c'</span>, <span class="string">'d'</span>, <span class="string">'e'</span>, <span class="string">'b'</span>, <span class="string">'f'</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.rotate_right" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.26.0">1.26.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#3714">Source</a></span><h4 class="code-header">pub fn <a href="#method.rotate_right" class="fn">rotate_right</a>(&amp;mut self, k: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Rotates the slice in-place such that the first <code>self.len() - k</code>
elements of the slice move to the end while the last <code>k</code> elements move
to the front.</p>
<p>After calling <code>rotate_right</code>, the element previously at index
<code>self.len() - k</code> will become the first element in the slice.</p>
<h5 id="panics-27"><a class="doc-anchor" href="#panics-27">§</a>Panics</h5>
<p>This function will panic if <code>k</code> is greater than the length of the
slice. Note that <code>k == self.len()</code> does <em>not</em> panic and is a no-op
rotation.</p>
<h5 id="complexity-1"><a class="doc-anchor" href="#complexity-1">§</a>Complexity</h5>
<p>Takes linear (in <code>self.len()</code>) time.</p>
<h5 id="examples-110"><a class="doc-anchor" href="#examples-110">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>a = [<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>, <span class="string">'d'</span>, <span class="string">'e'</span>, <span class="string">'f'</span>];
a.rotate_right(<span class="number">2</span>);
<span class="macro">assert_eq!</span>(a, [<span class="string">'e'</span>, <span class="string">'f'</span>, <span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>, <span class="string">'d'</span>]);</code></pre></div>
<p>Rotating a subslice:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>a = [<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>, <span class="string">'d'</span>, <span class="string">'e'</span>, <span class="string">'f'</span>];
a[<span class="number">1</span>..<span class="number">5</span>].rotate_right(<span class="number">1</span>);
<span class="macro">assert_eq!</span>(a, [<span class="string">'a'</span>, <span class="string">'e'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>, <span class="string">'d'</span>, <span class="string">'f'</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fill" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.50.0">1.50.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#3737-3739">Source</a></span><h4 class="code-header">pub fn <a href="#method.fill" class="fn">fill</a>(&amp;mut self, value: T)<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h4></section></summary><div class="docblock"><p>Fills <code>self</code> with elements by cloning <code>value</code>.</p>
<h5 id="examples-111"><a class="doc-anchor" href="#examples-111">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="macro">vec!</span>[<span class="number">0</span>; <span class="number">10</span>];
buf.fill(<span class="number">1</span>);
<span class="macro">assert_eq!</span>(buf, <span class="macro">vec!</span>[<span class="number">1</span>; <span class="number">10</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fill_with" 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.93.1/src/core/slice/mod.rs.html#3761-3763">Source</a></span><h4 class="code-header">pub fn <a href="#method.fill_with" class="fn">fill_with</a>&lt;F&gt;(&amp;mut self, f: F)<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>() -&gt; T,</div></h4></section></summary><div class="docblock"><p>Fills <code>self</code> with elements returned by calling a closure repeatedly.</p>
<p>This method uses a closure to create new values. If youd rather
<a href="https://doc.rust-lang.org/1.93.1/core/clone/trait.Clone.html" title="trait core::clone::Clone"><code>Clone</code></a> a given value, use <a href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html#method.fill" title="method slice::fill"><code>fill</code></a>. If you want to use the <a href="https://doc.rust-lang.org/1.93.1/core/default/trait.Default.html" title="trait core::default::Default"><code>Default</code></a>
trait to generate values, you can pass <a href="https://doc.rust-lang.org/1.93.1/core/default/trait.Default.html#tymethod.default" title="associated function core::default::Default::default"><code>Default::default</code></a> as the
argument.</p>
<h5 id="examples-112"><a class="doc-anchor" href="#examples-112">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="macro">vec!</span>[<span class="number">1</span>; <span class="number">10</span>];
buf.fill_with(Default::default);
<span class="macro">assert_eq!</span>(buf, <span class="macro">vec!</span>[<span class="number">0</span>; <span class="number">10</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_from_slice" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.7.0">1.7.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#3824-3826">Source</a></span><h4 class="code-header">pub fn <a href="#method.clone_from_slice" class="fn">clone_from_slice</a>(&amp;mut self, src: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>)<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h4></section></summary><div class="docblock"><p>Copies the elements from <code>src</code> into <code>self</code>.</p>
<p>The length of <code>src</code> must be the same as <code>self</code>.</p>
<h5 id="panics-28"><a class="doc-anchor" href="#panics-28">§</a>Panics</h5>
<p>This function will panic if the two slices have different lengths.</p>
<h5 id="examples-113"><a class="doc-anchor" href="#examples-113">§</a>Examples</h5>
<p>Cloning two elements from a slice into another:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>src = [<span class="number">1</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>dst = [<span class="number">0</span>, <span class="number">0</span>];
<span class="comment">// Because the slices have to be the same length,
// we slice the source slice from four elements
// to two. It will panic if we don't do this.
</span>dst.clone_from_slice(<span class="kw-2">&amp;</span>src[<span class="number">2</span>..]);
<span class="macro">assert_eq!</span>(src, [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]);
<span class="macro">assert_eq!</span>(dst, [<span class="number">3</span>, <span class="number">4</span>]);</code></pre></div>
<p>Rust enforces that there can only be one mutable reference with no
immutable references to a particular piece of data in a particular
scope. Because of this, attempting to use <code>clone_from_slice</code> on a
single slice will result in a compile failure:</p>
<div class="example-wrap compile_fail"><a href="#" class="tooltip" title="This example deliberately fails to compile"></a><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>slice = [<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>];
slice[..<span class="number">2</span>].clone_from_slice(<span class="kw-2">&amp;</span>slice[<span class="number">3</span>..]); <span class="comment">// compile fail!</span></code></pre></div>
<p>To work around this, we can use <a href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html#method.split_at_mut" title="method slice::split_at_mut"><code>split_at_mut</code></a> to create two distinct
sub-slices from a slice:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>slice = [<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="kw">let </span>(left, right) = slice.split_at_mut(<span class="number">2</span>);
left.clone_from_slice(<span class="kw-2">&amp;</span>right[<span class="number">1</span>..]);
}
<span class="macro">assert_eq!</span>(slice, [<span class="number">4</span>, <span class="number">5</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.copy_from_slice" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.9.0">1.9.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#3890-3892">Source</a></span><h4 class="code-header">pub fn <a href="#method.copy_from_slice" class="fn">copy_from_slice</a>(&amp;mut self, src: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>)<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a>,</div></h4></section></summary><div class="docblock"><p>Copies all elements from <code>src</code> into <code>self</code>, using a memcpy.</p>
<p>The length of <code>src</code> must be the same as <code>self</code>.</p>
<p>If <code>T</code> does not implement <code>Copy</code>, use <a href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html#method.clone_from_slice" title="method slice::clone_from_slice"><code>clone_from_slice</code></a>.</p>
<h5 id="panics-29"><a class="doc-anchor" href="#panics-29">§</a>Panics</h5>
<p>This function will panic if the two slices have different lengths.</p>
<h5 id="examples-114"><a class="doc-anchor" href="#examples-114">§</a>Examples</h5>
<p>Copying two elements from a slice into another:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>src = [<span class="number">1</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>dst = [<span class="number">0</span>, <span class="number">0</span>];
<span class="comment">// Because the slices have to be the same length,
// we slice the source slice from four elements
// to two. It will panic if we don't do this.
</span>dst.copy_from_slice(<span class="kw-2">&amp;</span>src[<span class="number">2</span>..]);
<span class="macro">assert_eq!</span>(src, [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]);
<span class="macro">assert_eq!</span>(dst, [<span class="number">3</span>, <span class="number">4</span>]);</code></pre></div>
<p>Rust enforces that there can only be one mutable reference with no
immutable references to a particular piece of data in a particular
scope. Because of this, attempting to use <code>copy_from_slice</code> on a
single slice will result in a compile failure:</p>
<div class="example-wrap compile_fail"><a href="#" class="tooltip" title="This example deliberately fails to compile"></a><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>slice = [<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>];
slice[..<span class="number">2</span>].copy_from_slice(<span class="kw-2">&amp;</span>slice[<span class="number">3</span>..]); <span class="comment">// compile fail!</span></code></pre></div>
<p>To work around this, we can use <a href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html#method.split_at_mut" title="method slice::split_at_mut"><code>split_at_mut</code></a> to create two distinct
sub-slices from a slice:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>slice = [<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="kw">let </span>(left, right) = slice.split_at_mut(<span class="number">2</span>);
left.copy_from_slice(<span class="kw-2">&amp;</span>right[<span class="number">1</span>..]);
}
<span class="macro">assert_eq!</span>(slice, [<span class="number">4</span>, <span class="number">5</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.copy_within" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.37.0">1.37.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#3924-3926">Source</a></span><h4 class="code-header">pub fn <a href="#method.copy_within" class="fn">copy_within</a>&lt;R&gt;(&amp;mut self, src: R, dest: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>)<div class="where">where
R: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/range/trait.RangeBounds.html" title="trait core::ops::range::RangeBounds">RangeBounds</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;,
T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a>,</div></h4></section></summary><div class="docblock"><p>Copies elements from one part of the slice to another part of itself,
using a memmove.</p>
<p><code>src</code> is the range within <code>self</code> to copy from. <code>dest</code> is the starting
index of the range within <code>self</code> to copy to, which will have the same
length as <code>src</code>. The two ranges may overlap. The ends of the two ranges
must be less than or equal to <code>self.len()</code>.</p>
<h5 id="panics-30"><a class="doc-anchor" href="#panics-30">§</a>Panics</h5>
<p>This function will panic if either range exceeds the end of the slice,
or if the end of <code>src</code> is before the start.</p>
<h5 id="examples-115"><a class="doc-anchor" href="#examples-115">§</a>Examples</h5>
<p>Copying four bytes within a slice:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>bytes = <span class="kw-2">*</span><span class="string">b"Hello, World!"</span>;
bytes.copy_within(<span class="number">1</span>..<span class="number">5</span>, <span class="number">8</span>);
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>bytes, <span class="string">b"Hello, Wello!"</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.swap_with_slice" 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.93.1/src/core/slice/mod.rs.html#3992">Source</a></span><h4 class="code-header">pub fn <a href="#method.swap_with_slice" class="fn">swap_with_slice</a>(&amp;mut self, other: &amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>)</h4></section></summary><div class="docblock"><p>Swaps all elements in <code>self</code> with those in <code>other</code>.</p>
<p>The length of <code>other</code> must be the same as <code>self</code>.</p>
<h5 id="panics-31"><a class="doc-anchor" href="#panics-31">§</a>Panics</h5>
<p>This function will panic if the two slices have different lengths.</p>
<h5 id="example"><a class="doc-anchor" href="#example">§</a>Example</h5>
<p>Swapping two elements across slices:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>slice1 = [<span class="number">0</span>, <span class="number">0</span>];
<span class="kw">let </span><span class="kw-2">mut </span>slice2 = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>];
slice1.swap_with_slice(<span class="kw-2">&amp;mut </span>slice2[<span class="number">2</span>..]);
<span class="macro">assert_eq!</span>(slice1, [<span class="number">3</span>, <span class="number">4</span>]);
<span class="macro">assert_eq!</span>(slice2, [<span class="number">1</span>, <span class="number">2</span>, <span class="number">0</span>, <span class="number">0</span>]);</code></pre></div>
<p>Rust enforces that there can only be one mutable reference to a
particular piece of data in a particular scope. Because of this,
attempting to use <code>swap_with_slice</code> on a single slice will result in
a compile failure:</p>
<div class="example-wrap compile_fail"><a href="#" class="tooltip" title="This example deliberately fails to compile"></a><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>slice = [<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>];
slice[..<span class="number">2</span>].swap_with_slice(<span class="kw-2">&amp;mut </span>slice[<span class="number">3</span>..]); <span class="comment">// compile fail!</span></code></pre></div>
<p>To work around this, we can use <a href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html#method.split_at_mut" title="method slice::split_at_mut"><code>split_at_mut</code></a> to create two distinct
mutable sub-slices from a slice:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>slice = [<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="kw">let </span>(left, right) = slice.split_at_mut(<span class="number">2</span>);
left.swap_with_slice(<span class="kw-2">&amp;mut </span>right[<span class="number">1</span>..]);
}
<span class="macro">assert_eq!</span>(slice, [<span class="number">4</span>, <span class="number">5</span>, <span class="number">3</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.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.93.1/src/core/slice/mod.rs.html#4069">Source</a></span><h4 class="code-header">pub unsafe fn <a href="#method.align_to" class="fn">align_to</a>&lt;U&gt;(&amp;self) -&gt; (&amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>, &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[U]</a>, &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.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-8"><a class="doc-anchor" href="#safety-8">§</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::&lt;T, U&gt;</code> also apply here.</p>
<h5 id="examples-116"><a class="doc-anchor" href="#examples-116">§</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::&lt;u16&gt;();
<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.align_to_mut" 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.93.1/src/core/slice/mod.rs.html#4134">Source</a></span><h4 class="code-header">pub unsafe fn <a href="#method.align_to_mut" class="fn">align_to_mut</a>&lt;U&gt;(&amp;mut self) -&gt; (&amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>, &amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[U]</a>, &amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>)</h4></section></summary><div class="docblock"><p>Transmutes the mutable slice to a mutable 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-9"><a class="doc-anchor" href="#safety-9">§</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::&lt;T, U&gt;</code> also apply here.</p>
<h5 id="examples-117"><a class="doc-anchor" href="#examples-117">§</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><span class="kw-2">mut </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_mut::&lt;u16&gt;();
<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.93.1/src/core/slice/mod.rs.html#4225-4229">Source</a><h4 class="code-header">pub fn <a href="#method.as_simd" class="fn">as_simd</a>&lt;const LANES: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;(&amp;self) -&gt; (&amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>, &amp;[<a class="struct" href="https://doc.rust-lang.org/1.93.1/core/core_simd/vector/struct.Simd.html" title="struct core::core_simd::vector::Simd">Simd</a>&lt;T, LANES&gt;], &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>)<div class="where">where
<a class="struct" href="https://doc.rust-lang.org/1.93.1/core/core_simd/vector/struct.Simd.html" title="struct core::core_simd::vector::Simd">Simd</a>&lt;T, LANES&gt;: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.array.html">[T; LANES]</a>&gt;,
T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/core_simd/vector/trait.SimdElement.html" title="trait core::core_simd::vector::SimdElement">SimdElement</a>,
<a class="struct" href="https://doc.rust-lang.org/1.93.1/core/core_simd/lane_count/struct.LaneCount.html" title="struct core::core_simd::lane_count::LaneCount">LaneCount</a>&lt;LANES&gt;: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/core_simd/lane_count/trait.SupportedLaneCount.html" title="trait core::core_simd::lane_count::SupportedLaneCount">SupportedLaneCount</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.93.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-32"><a class="doc-anchor" href="#panics-32">§</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&lt;T, LANES&gt;</code> keeps
that from ever happening, as only power-of-two numbers of lanes are
supported. Its 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-118"><a class="doc-anchor" href="#examples-118">§</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">&amp;</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::&lt;<span class="number">4</span>&gt;();
<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::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;(), <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">&amp;</span>[f32]) -&gt; 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&lt;f32&gt; = (<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">&amp;</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.as_simd_mut" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#4261-4265">Source</a><h4 class="code-header">pub fn <a href="#method.as_simd_mut" class="fn">as_simd_mut</a>&lt;const LANES: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;(
&amp;mut self,
) -&gt; (&amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>, &amp;mut [<a class="struct" href="https://doc.rust-lang.org/1.93.1/core/core_simd/vector/struct.Simd.html" title="struct core::core_simd::vector::Simd">Simd</a>&lt;T, LANES&gt;], &amp;mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>)<div class="where">where
<a class="struct" href="https://doc.rust-lang.org/1.93.1/core/core_simd/vector/struct.Simd.html" title="struct core::core_simd::vector::Simd">Simd</a>&lt;T, LANES&gt;: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.array.html">[T; LANES]</a>&gt;,
T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/core_simd/vector/trait.SimdElement.html" title="trait core::core_simd::vector::SimdElement">SimdElement</a>,
<a class="struct" href="https://doc.rust-lang.org/1.93.1/core/core_simd/lane_count/struct.LaneCount.html" title="struct core::core_simd::lane_count::LaneCount">LaneCount</a>&lt;LANES&gt;: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/core_simd/lane_count/trait.SupportedLaneCount.html" title="trait core::core_simd::lane_count::SupportedLaneCount">SupportedLaneCount</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 mutable slice into a mutable prefix, a middle of aligned SIMD types,
and a mutable suffix.</p>
<p>This is a safe wrapper around <a href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html#method.align_to_mut" title="method slice::align_to_mut"><code>slice::align_to_mut</code></a>, so inherits the same
guarantees as that method.</p>
<p>This is the mutable version of <a href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html#method.as_simd" title="method slice::as_simd"><code>slice::as_simd</code></a>; see that for examples.</p>
<h5 id="panics-33"><a class="doc-anchor" href="#panics-33">§</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&lt;T, LANES&gt;</code> keeps
that from ever happening, as only power-of-two numbers of lanes are
supported. Its 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>
</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.93.1/src/core/slice/mod.rs.html#4300-4302">Source</a></span><h4 class="code-header">pub fn <a href="#method.is_sorted" class="fn">is_sorted</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a><div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.93.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 &lt;= 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-119"><a class="doc-anchor" href="#examples-119">§</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.93.1/src/core/slice/mod.rs.html#4343-4345">Source</a></span><h4 class="code-header">pub fn <a href="#method.is_sorted_by" class="fn">is_sorted_by</a>&lt;'a, F&gt;(&amp;'a self, compare: F) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a><div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;'a T</a>, <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;'a T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.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-120"><a class="doc-anchor" href="#examples-120">§</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 &lt;= 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 &lt; 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.93.1/src/core/slice/mod.rs.html#4367-4370">Source</a></span><h4 class="code-header">pub fn <a href="#method.is_sorted_by_key" class="fn">is_sorted_by_key</a>&lt;'a, F, K&gt;(&amp;'a self, f: F) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a><div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;'a T</a>) -&gt; K,
K: <a class="trait" href="https://doc.rust-lang.org/1.93.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 slices elements directly, this function compares the keys of the
elements, as determined by <code>f</code>. Apart from that, its equivalent to <a href="https://doc.rust-lang.org/1.93.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-121"><a class="doc-anchor" href="#examples-121">§</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.93.1/src/core/slice/mod.rs.html#4426-4428">Source</a></span><h4 class="code-header">pub fn <a href="#method.partition_point" class="fn">partition_point</a>&lt;P&gt;(&amp;self, pred: P) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a><div class="where">where
P: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.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.93.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.93.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.93.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-122"><a class="doc-anchor" href="#examples-122">§</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">&amp;</span>x| x &lt; <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">&amp;</span>x| x &lt; <span class="number">5</span>));
<span class="macro">assert!</span>(v[i..].iter().all(|<span class="kw-2">&amp;</span>x| !(x &lt; <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 &lt; <span class="kw-2">&amp;</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 &lt; <span class="kw-2">&amp;</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">&amp;</span>x| x &lt;= 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.split_off-1" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.87.0">1.87.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#4478-4481">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_off-1" class="fn">split_off</a>&lt;'a, R&gt;(self: &amp;mut &amp;'a <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>, range: R) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;'a <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>&gt;<div class="where">where
R: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/range/trait.OneSidedRange.html" title="trait core::ops::range::OneSidedRange">OneSidedRange</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;,</div></h4></section></summary><div class="docblock"><p>Removes the subslice corresponding to the given range
and returns a reference to it.</p>
<p>Returns <code>None</code> and does not modify the slice if the given
range is out of bounds.</p>
<p>Note that this method only accepts one-sided ranges such as
<code>2..</code> or <code>..6</code>, but not <code>2..6</code>.</p>
<h5 id="examples-123"><a class="doc-anchor" href="#examples-123">§</a>Examples</h5>
<p>Splitting off the first three elements of a slice:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>slice: <span class="kw-2">&amp;</span>[<span class="kw">_</span>] = <span class="kw-2">&amp;</span>[<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>, <span class="string">'d'</span>];
<span class="kw">let </span><span class="kw-2">mut </span>first_three = slice.split_off(..<span class="number">3</span>).unwrap();
<span class="macro">assert_eq!</span>(slice, <span class="kw-2">&amp;</span>[<span class="string">'d'</span>]);
<span class="macro">assert_eq!</span>(first_three, <span class="kw-2">&amp;</span>[<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>]);</code></pre></div>
<p>Splitting off a slice starting with the third element:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>slice: <span class="kw-2">&amp;</span>[<span class="kw">_</span>] = <span class="kw-2">&amp;</span>[<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>, <span class="string">'d'</span>];
<span class="kw">let </span><span class="kw-2">mut </span>tail = slice.split_off(<span class="number">2</span>..).unwrap();
<span class="macro">assert_eq!</span>(slice, <span class="kw-2">&amp;</span>[<span class="string">'a'</span>, <span class="string">'b'</span>]);
<span class="macro">assert_eq!</span>(tail, <span class="kw-2">&amp;</span>[<span class="string">'c'</span>, <span class="string">'d'</span>]);</code></pre></div>
<p>Getting <code>None</code> when <code>range</code> is out of bounds:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>slice: <span class="kw-2">&amp;</span>[<span class="kw">_</span>] = <span class="kw-2">&amp;</span>[<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>, <span class="string">'d'</span>];
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, slice.split_off(<span class="number">5</span>..));
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, slice.split_off(..<span class="number">5</span>));
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, slice.split_off(..=<span class="number">4</span>));
<span class="kw">let </span>expected: <span class="kw-2">&amp;</span>[char] = <span class="kw-2">&amp;</span>[<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>, <span class="string">'d'</span>];
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(expected), slice.split_off(..<span class="number">4</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_off_mut" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.87.0">1.87.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#4544-4547">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_off_mut" class="fn">split_off_mut</a>&lt;'a, R&gt;(
self: &amp;mut &amp;'a mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>,
range: R,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;'a mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>&gt;<div class="where">where
R: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/range/trait.OneSidedRange.html" title="trait core::ops::range::OneSidedRange">OneSidedRange</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;,</div></h4></section></summary><div class="docblock"><p>Removes the subslice corresponding to the given range
and returns a mutable reference to it.</p>
<p>Returns <code>None</code> and does not modify the slice if the given
range is out of bounds.</p>
<p>Note that this method only accepts one-sided ranges such as
<code>2..</code> or <code>..6</code>, but not <code>2..6</code>.</p>
<h5 id="examples-124"><a class="doc-anchor" href="#examples-124">§</a>Examples</h5>
<p>Splitting off the first three elements of a slice:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>slice: <span class="kw-2">&amp;mut </span>[<span class="kw">_</span>] = <span class="kw-2">&amp;mut </span>[<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>, <span class="string">'d'</span>];
<span class="kw">let </span><span class="kw-2">mut </span>first_three = slice.split_off_mut(..<span class="number">3</span>).unwrap();
<span class="macro">assert_eq!</span>(slice, <span class="kw-2">&amp;mut </span>[<span class="string">'d'</span>]);
<span class="macro">assert_eq!</span>(first_three, <span class="kw-2">&amp;mut </span>[<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>]);</code></pre></div>
<p>Splitting off a slice starting with the third element:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>slice: <span class="kw-2">&amp;mut </span>[<span class="kw">_</span>] = <span class="kw-2">&amp;mut </span>[<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>, <span class="string">'d'</span>];
<span class="kw">let </span><span class="kw-2">mut </span>tail = slice.split_off_mut(<span class="number">2</span>..).unwrap();
<span class="macro">assert_eq!</span>(slice, <span class="kw-2">&amp;mut </span>[<span class="string">'a'</span>, <span class="string">'b'</span>]);
<span class="macro">assert_eq!</span>(tail, <span class="kw-2">&amp;mut </span>[<span class="string">'c'</span>, <span class="string">'d'</span>]);</code></pre></div>
<p>Getting <code>None</code> when <code>range</code> is out of bounds:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>slice: <span class="kw-2">&amp;mut </span>[<span class="kw">_</span>] = <span class="kw-2">&amp;mut </span>[<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>, <span class="string">'d'</span>];
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, slice.split_off_mut(<span class="number">5</span>..));
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, slice.split_off_mut(..<span class="number">5</span>));
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, slice.split_off_mut(..=<span class="number">4</span>));
<span class="kw">let </span>expected: <span class="kw-2">&amp;mut </span>[<span class="kw">_</span>] = <span class="kw-2">&amp;mut </span>[<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>, <span class="string">'d'</span>];
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(expected), slice.split_off_mut(..<span class="number">4</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_off_first" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.87.0">1.87.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#4582">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_off_first" class="fn">split_off_first</a>&lt;'a&gt;(self: &amp;mut &amp;'a <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;'a T</a>&gt;</h4></section></summary><div class="docblock"><p>Removes the first element of the slice and returns a reference
to it.</p>
<p>Returns <code>None</code> if the slice is empty.</p>
<h5 id="examples-125"><a class="doc-anchor" href="#examples-125">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>slice: <span class="kw-2">&amp;</span>[<span class="kw">_</span>] = <span class="kw-2">&amp;</span>[<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>];
<span class="kw">let </span>first = slice.split_off_first().unwrap();
<span class="macro">assert_eq!</span>(slice, <span class="kw-2">&amp;</span>[<span class="string">'b'</span>, <span class="string">'c'</span>]);
<span class="macro">assert_eq!</span>(first, <span class="kw-2">&amp;</span><span class="string">'a'</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_off_first_mut" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.87.0">1.87.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#4607">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_off_first_mut" class="fn">split_off_first_mut</a>&lt;'a&gt;(self: &amp;mut &amp;'a mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;'a mut T</a>&gt;</h4></section></summary><div class="docblock"><p>Removes the first element of the slice and returns a mutable
reference to it.</p>
<p>Returns <code>None</code> if the slice is empty.</p>
<h5 id="examples-126"><a class="doc-anchor" href="#examples-126">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>slice: <span class="kw-2">&amp;mut </span>[<span class="kw">_</span>] = <span class="kw-2">&amp;mut </span>[<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>];
<span class="kw">let </span>first = slice.split_off_first_mut().unwrap();
<span class="kw-2">*</span>first = <span class="string">'d'</span>;
<span class="macro">assert_eq!</span>(slice, <span class="kw-2">&amp;</span>[<span class="string">'b'</span>, <span class="string">'c'</span>]);
<span class="macro">assert_eq!</span>(first, <span class="kw-2">&amp;</span><span class="string">'d'</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_off_last" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.87.0">1.87.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#4632">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_off_last" class="fn">split_off_last</a>&lt;'a&gt;(self: &amp;mut &amp;'a <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;'a T</a>&gt;</h4></section></summary><div class="docblock"><p>Removes the last element of the slice and returns a reference
to it.</p>
<p>Returns <code>None</code> if the slice is empty.</p>
<h5 id="examples-127"><a class="doc-anchor" href="#examples-127">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>slice: <span class="kw-2">&amp;</span>[<span class="kw">_</span>] = <span class="kw-2">&amp;</span>[<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>];
<span class="kw">let </span>last = slice.split_off_last().unwrap();
<span class="macro">assert_eq!</span>(slice, <span class="kw-2">&amp;</span>[<span class="string">'a'</span>, <span class="string">'b'</span>]);
<span class="macro">assert_eq!</span>(last, <span class="kw-2">&amp;</span><span class="string">'c'</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_off_last_mut" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.87.0">1.87.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#4657">Source</a></span><h4 class="code-header">pub fn <a href="#method.split_off_last_mut" class="fn">split_off_last_mut</a>&lt;'a&gt;(self: &amp;mut &amp;'a mut <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;'a mut T</a>&gt;</h4></section></summary><div class="docblock"><p>Removes the last element of the slice and returns a mutable
reference to it.</p>
<p>Returns <code>None</code> if the slice is empty.</p>
<h5 id="examples-128"><a class="doc-anchor" href="#examples-128">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>slice: <span class="kw-2">&amp;mut </span>[<span class="kw">_</span>] = <span class="kw-2">&amp;mut </span>[<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>];
<span class="kw">let </span>last = slice.split_off_last_mut().unwrap();
<span class="kw-2">*</span>last = <span class="string">'d'</span>;
<span class="macro">assert_eq!</span>(slice, <span class="kw-2">&amp;</span>[<span class="string">'a'</span>, <span class="string">'b'</span>]);
<span class="macro">assert_eq!</span>(last, <span class="kw-2">&amp;</span><span class="string">'d'</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.get_disjoint_unchecked_mut" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.86.0">1.86.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#4714-4719">Source</a></span><h4 class="code-header">pub unsafe fn <a href="#method.get_disjoint_unchecked_mut" class="fn">get_disjoint_unchecked_mut</a>&lt;I, const N: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;(
&amp;mut self,
indices: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.array.html">[I; N]</a>,
) -&gt; [&amp;mut &lt;I as <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.1/core/slice/index/trait.SliceIndex.html#associatedtype.Output" title="type core::slice::index::SliceIndex::Output">Output</a>; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.array.html">N</a>]<div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/slice/trait.GetDisjointMutIndex.html" title="trait core::slice::GetDisjointMutIndex">GetDisjointMutIndex</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>&gt;,</div></h4></section></summary><div class="docblock"><p>Returns mutable references to many indices at once, without doing any checks.</p>
<p>An index can be either a <code>usize</code>, a <a href="https://doc.rust-lang.org/1.93.1/core/ops/range/struct.Range.html" title="struct core::ops::range::Range"><code>Range</code></a> or a <a href="https://doc.rust-lang.org/1.93.1/core/ops/range/struct.RangeInclusive.html" title="struct core::ops::range::RangeInclusive"><code>RangeInclusive</code></a>. Note
that this method takes an array, so all indices must be of the same type.
If passed an array of <code>usize</code>s this method gives back an array of mutable references
to single elements, while if passed an array of ranges it gives back an array of
mutable references to slices.</p>
<p>For a safe alternative see <a href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html#method.get_disjoint_mut" title="method slice::get_disjoint_mut"><code>get_disjoint_mut</code></a>.</p>
<h5 id="safety-10"><a class="doc-anchor" href="#safety-10">§</a>Safety</h5>
<p>Calling this method with overlapping or out-of-bounds indices is <em><a href="https://doc.rust-lang.org/reference/behavior-considered-undefined.html">undefined behavior</a></em>
even if the resulting references are not used.</p>
<h5 id="examples-129"><a class="doc-anchor" href="#examples-129">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="kw-2">&amp;mut </span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>];
<span class="kw">unsafe </span>{
<span class="kw">let </span>[a, b] = x.get_disjoint_unchecked_mut([<span class="number">0</span>, <span class="number">2</span>]);
<span class="kw-2">*</span>a <span class="kw-2">*</span>= <span class="number">10</span>;
<span class="kw-2">*</span>b <span class="kw-2">*</span>= <span class="number">100</span>;
}
<span class="macro">assert_eq!</span>(x, <span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">2</span>, <span class="number">400</span>]);
<span class="kw">unsafe </span>{
<span class="kw">let </span>[a, b] = x.get_disjoint_unchecked_mut([<span class="number">0</span>..<span class="number">1</span>, <span class="number">1</span>..<span class="number">3</span>]);
a[<span class="number">0</span>] = <span class="number">8</span>;
b[<span class="number">0</span>] = <span class="number">88</span>;
b[<span class="number">1</span>] = <span class="number">888</span>;
}
<span class="macro">assert_eq!</span>(x, <span class="kw-2">&amp;</span>[<span class="number">8</span>, <span class="number">88</span>, <span class="number">888</span>]);
<span class="kw">unsafe </span>{
<span class="kw">let </span>[a, b] = x.get_disjoint_unchecked_mut([<span class="number">1</span>..=<span class="number">2</span>, <span class="number">0</span>..=<span class="number">0</span>]);
a[<span class="number">0</span>] = <span class="number">11</span>;
a[<span class="number">1</span>] = <span class="number">111</span>;
b[<span class="number">0</span>] = <span class="number">1</span>;
}
<span class="macro">assert_eq!</span>(x, <span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">11</span>, <span class="number">111</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.get_disjoint_mut" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.86.0">1.86.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#4781-4786">Source</a></span><h4 class="code-header">pub fn <a href="#method.get_disjoint_mut" class="fn">get_disjoint_mut</a>&lt;I, const N: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;(
&amp;mut self,
indices: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.array.html">[I; N]</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;[&amp;mut &lt;I as <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.1/core/slice/index/trait.SliceIndex.html#associatedtype.Output" title="type core::slice::index::SliceIndex::Output">Output</a>; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.array.html">N</a>], <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/slice/enum.GetDisjointMutError.html" title="enum core::slice::GetDisjointMutError">GetDisjointMutError</a>&gt;<div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/slice/trait.GetDisjointMutIndex.html" title="trait core::slice::GetDisjointMutIndex">GetDisjointMutIndex</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>&gt;,</div></h4></section></summary><div class="docblock"><p>Returns mutable references to many indices at once.</p>
<p>An index can be either a <code>usize</code>, a <a href="https://doc.rust-lang.org/1.93.1/core/ops/range/struct.Range.html" title="struct core::ops::range::Range"><code>Range</code></a> or a <a href="https://doc.rust-lang.org/1.93.1/core/ops/range/struct.RangeInclusive.html" title="struct core::ops::range::RangeInclusive"><code>RangeInclusive</code></a>. Note
that this method takes an array, so all indices must be of the same type.
If passed an array of <code>usize</code>s this method gives back an array of mutable references
to single elements, while if passed an array of ranges it gives back an array of
mutable references to slices.</p>
<p>Returns an error if any index is out-of-bounds, or if there are overlapping indices.
An empty range is not considered to overlap if it is located at the beginning or at
the end of another range, but is considered to overlap if it is located in the middle.</p>
<p>This method does a O(n^2) check to check that there are no overlapping indices, so be careful
when passing many indices.</p>
<h5 id="examples-130"><a class="doc-anchor" href="#examples-130">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = <span class="kw-2">&amp;mut </span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>];
<span class="kw">if let </span><span class="prelude-val">Ok</span>([a, b]) = v.get_disjoint_mut([<span class="number">0</span>, <span class="number">2</span>]) {
<span class="kw-2">*</span>a = <span class="number">413</span>;
<span class="kw-2">*</span>b = <span class="number">612</span>;
}
<span class="macro">assert_eq!</span>(v, <span class="kw-2">&amp;</span>[<span class="number">413</span>, <span class="number">2</span>, <span class="number">612</span>]);
<span class="kw">if let </span><span class="prelude-val">Ok</span>([a, b]) = v.get_disjoint_mut([<span class="number">0</span>..<span class="number">1</span>, <span class="number">1</span>..<span class="number">3</span>]) {
a[<span class="number">0</span>] = <span class="number">8</span>;
b[<span class="number">0</span>] = <span class="number">88</span>;
b[<span class="number">1</span>] = <span class="number">888</span>;
}
<span class="macro">assert_eq!</span>(v, <span class="kw-2">&amp;</span>[<span class="number">8</span>, <span class="number">88</span>, <span class="number">888</span>]);
<span class="kw">if let </span><span class="prelude-val">Ok</span>([a, b]) = v.get_disjoint_mut([<span class="number">1</span>..=<span class="number">2</span>, <span class="number">0</span>..=<span class="number">0</span>]) {
a[<span class="number">0</span>] = <span class="number">11</span>;
a[<span class="number">1</span>] = <span class="number">111</span>;
b[<span class="number">0</span>] = <span class="number">1</span>;
}
<span class="macro">assert_eq!</span>(v, <span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">11</span>, <span class="number">111</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.element_offset" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#4836">Source</a><h4 class="code-header">pub fn <a href="#method.element_offset" class="fn">element_offset</a>(&amp;self, element: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>substr_range</code>)</span></div></span></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.93.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.93.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-34"><a class="doc-anchor" href="#panics-34">§</a>Panics</h5>
<p>Panics if <code>T</code> is zero-sized.</p>
<h5 id="examples-131"><a class="doc-anchor" href="#examples-131">§</a>Examples</h5>
<p>Basic usage:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(substr_range)]
</span><span class="kw">let </span>nums: <span class="kw-2">&amp;</span>[u32] = <span class="kw-2">&amp;</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">&amp;</span>nums[<span class="number">2</span>];
<span class="macro">assert_eq!</span>(num, <span class="kw-2">&amp;</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="attr">#![feature(substr_range)]
</span><span class="kw">let </span>arr: <span class="kw-2">&amp;</span>[[u32; <span class="number">2</span>]] = <span class="kw-2">&amp;</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">&amp;</span>[u32] = arr.as_flattened();
<span class="kw">let </span>ok_elm: <span class="kw-2">&amp;</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">&amp;</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">&amp;</span>[<span class="number">0</span>, <span class="number">1</span>]);
<span class="macro">assert_eq!</span>(weird_elm, <span class="kw-2">&amp;</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"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/slice/mod.rs.html#4890">Source</a><h4 class="code-header">pub fn <a href="#method.subslice_range" class="fn">subslice_range</a>(&amp;self, subslice: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.93.1/core/ops/range/struct.Range.html" title="struct core::ops::range::Range">Range</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;&gt;</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>substr_range</code>)</span></div></span></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.93.1/std/primitive.slice.html#method.windows" title="method slice::windows"><code>.windows()</code></a><a href="https://doc.rust-lang.org/1.93.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.93.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-35"><a class="doc-anchor" href="#panics-35">§</a>Panics</h5>
<p>Panics if <code>T</code> is zero-sized.</p>
<h5 id="examples-132"><a class="doc-anchor" href="#examples-132">§</a>Examples</h5>
<p>Basic usage:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(substr_range)]
</span><span class="kw">let </span>nums = <span class="kw-2">&amp;</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>(<span class="number">0</span>..<span class="number">0</span>));
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="number">1</span>..<span class="number">3</span>));
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="number">4</span>..<span class="number">4</span>));
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="number">5</span>..<span class="number">6</span>));</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.93.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>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/str/lossy/struct.Utf8Chunks.html" title="struct core::str::lossy::Utf8Chunks">Utf8Chunks</a>&lt;'_&gt;</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.93.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-133"><a class="doc-anchor" href="#examples-133">§</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">&amp;</span>[u8]) -&gt; 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.sort" 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.93.1/src/alloc/slice.rs.html#131-133">Source</a></span><h4 class="code-header">pub fn <a href="#method.sort" class="fn">sort</a>(&amp;mut self)<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h4></section></summary><div class="docblock"><p>Sorts the slice in ascending order, preserving initial order of equal elements.</p>
<p>This sort is stable (i.e., does not reorder equal elements) and <em>O</em>(<em>n</em> * log(<em>n</em>))
worst-case.</p>
<p>If the implementation of <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord"><code>Ord</code></a> for <code>T</code> does not implement a <a href="https://en.wikipedia.org/wiki/Total_order">total order</a>, the function
may panic; even if the function exits normally, the resulting order of elements in the slice
is unspecified. See also the note on panicking below.</p>
<p>When applicable, unstable sorting is preferred because it is generally faster than stable
sorting and it doesnt allocate auxiliary memory. See
<a href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html#method.sort_unstable" title="method slice::sort_unstable"><code>sort_unstable</code></a>. The exception are partially sorted slices, which
may be better served with <code>slice::sort</code>.</p>
<p>Sorting types that only implement <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd"><code>PartialOrd</code></a> such as <a href="https://doc.rust-lang.org/1.93.1/std/primitive.f32.html" title="primitive f32"><code>f32</code></a> and <a href="https://doc.rust-lang.org/1.93.1/std/primitive.f64.html" title="primitive f64"><code>f64</code></a> require
additional precautions. For example, <code>f32::NAN != f32::NAN</code>, which doesnt fulfill the
reflexivity requirement of <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord"><code>Ord</code></a>. By using an alternative comparison function with
<code>slice::sort_by</code> such as <a href="https://doc.rust-lang.org/1.93.1/std/primitive.f32.html#method.total_cmp" title="method f32::total_cmp"><code>f32::total_cmp</code></a> or <a href="https://doc.rust-lang.org/1.93.1/std/primitive.f64.html#method.total_cmp" title="method f64::total_cmp"><code>f64::total_cmp</code></a> that defines a <a href="https://en.wikipedia.org/wiki/Total_order">total
order</a> users can sort slices containing floating-point values. Alternatively, if all values
in the slice are guaranteed to be in a subset for which <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" title="method core::cmp::PartialOrd::partial_cmp"><code>PartialOrd::partial_cmp</code></a> forms a
<a href="https://en.wikipedia.org/wiki/Total_order">total order</a>, its possible to sort the slice with <code>sort_by(|a, b| a.partial_cmp(b).unwrap())</code>.</p>
<h5 id="current-implementation-6"><a class="doc-anchor" href="#current-implementation-6">§</a>Current implementation</h5>
<p>The current implementation is based on <a href="https://github.com/Voultapher/driftsort">driftsort</a> by Orson Peters and Lukas Bergdoll, which
combines the fast average case of quicksort with the fast worst case and partial run
detection of mergesort, achieving linear time on fully sorted and reversed inputs. On inputs
with k distinct elements, the expected time to sort the data is <em>O</em>(<em>n</em> * log(<em>k</em>)).</p>
<p>The auxiliary memory allocation behavior depends on the input length. Short slices are
handled without allocation, medium sized slices allocate <code>self.len()</code> and beyond that it
clamps at <code>self.len() / 2</code>.</p>
<h5 id="panics-36"><a class="doc-anchor" href="#panics-36">§</a>Panics</h5>
<p>May panic if the implementation of <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord"><code>Ord</code></a> for <code>T</code> does not implement a <a href="https://en.wikipedia.org/wiki/Total_order">total order</a>, or if
the <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord"><code>Ord</code></a> implementation itself panics.</p>
<p>All safe functions on slices preserve the invariant that even if the function panics, all
original elements will remain in the slice and any possible modifications via interior
mutability are observed in the input. This ensures that recovery code (for instance inside
of a <code>Drop</code> or following a <code>catch_unwind</code>) will still have access to all the original
elements. For instance, if the slice belongs to a <code>Vec</code>, the <code>Vec::drop</code> method will be able
to dispose of all contained elements.</p>
<h5 id="examples-134"><a class="doc-anchor" href="#examples-134">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>v = [<span class="number">4</span>, -<span class="number">5</span>, <span class="number">1</span>, -<span class="number">3</span>, <span class="number">2</span>];
v.sort();
<span class="macro">assert_eq!</span>(v, [-<span class="number">5</span>, -<span class="number">3</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.sort_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.93.1/src/alloc/slice.rs.html#192-194">Source</a></span><h4 class="code-header">pub fn <a href="#method.sort_by" class="fn">sort_by</a>&lt;F&gt;(&amp;mut self, compare: F)<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;T</a>, <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>,</div></h4></section></summary><div class="docblock"><p>Sorts the slice in ascending order with a comparison function, preserving initial order of
equal elements.</p>
<p>This sort is stable (i.e., does not reorder equal elements) and <em>O</em>(<em>n</em> * log(<em>n</em>))
worst-case.</p>
<p>If the comparison function <code>compare</code> does not implement a <a href="https://en.wikipedia.org/wiki/Total_order">total order</a>, the function may
panic; even if the function exits normally, the resulting order of elements in the slice is
unspecified. See also the note on panicking below.</p>
<p>For example <code>|a, b| (a - b).cmp(a)</code> is a comparison function that is neither transitive nor
reflexive nor total, <code>a &lt; b &lt; c &lt; a</code> with <code>a = 1, b = 2, c = 3</code>. For more information and
examples see the <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord"><code>Ord</code></a> documentation.</p>
<h5 id="current-implementation-7"><a class="doc-anchor" href="#current-implementation-7">§</a>Current implementation</h5>
<p>The current implementation is based on <a href="https://github.com/Voultapher/driftsort">driftsort</a> by Orson Peters and Lukas Bergdoll, which
combines the fast average case of quicksort with the fast worst case and partial run
detection of mergesort, achieving linear time on fully sorted and reversed inputs. On inputs
with k distinct elements, the expected time to sort the data is <em>O</em>(<em>n</em> * log(<em>k</em>)).</p>
<p>The auxiliary memory allocation behavior depends on the input length. Short slices are
handled without allocation, medium sized slices allocate <code>self.len()</code> and beyond that it
clamps at <code>self.len() / 2</code>.</p>
<h5 id="panics-37"><a class="doc-anchor" href="#panics-37">§</a>Panics</h5>
<p>May panic if <code>compare</code> does not implement a <a href="https://en.wikipedia.org/wiki/Total_order">total order</a>, or if <code>compare</code> itself panics.</p>
<p>All safe functions on slices preserve the invariant that even if the function panics, all
original elements will remain in the slice and any possible modifications via interior
mutability are observed in the input. This ensures that recovery code (for instance inside
of a <code>Drop</code> or following a <code>catch_unwind</code>) will still have access to all the original
elements. For instance, if the slice belongs to a <code>Vec</code>, the <code>Vec::drop</code> method will be able
to dispose of all contained elements.</p>
<h5 id="examples-135"><a class="doc-anchor" href="#examples-135">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>v = [<span class="number">4</span>, -<span class="number">5</span>, <span class="number">1</span>, -<span class="number">3</span>, <span class="number">2</span>];
v.sort_by(|a, b| a.cmp(b));
<span class="macro">assert_eq!</span>(v, [-<span class="number">5</span>, -<span class="number">3</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>]);
<span class="comment">// reverse sorting
</span>v.sort_by(|a, b| b.cmp(a));
<span class="macro">assert_eq!</span>(v, [<span class="number">4</span>, <span class="number">2</span>, <span class="number">1</span>, -<span class="number">3</span>, -<span class="number">5</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.sort_by_key" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.7.0">1.7.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/alloc/slice.rs.html#247-250">Source</a></span><h4 class="code-header">pub fn <a href="#method.sort_by_key" class="fn">sort_by_key</a>&lt;K, F&gt;(&amp;mut self, f: F)<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; K,
K: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h4></section></summary><div class="docblock"><p>Sorts the slice in ascending order with a key extraction function, preserving initial order
of equal elements.</p>
<p>This sort is stable (i.e., does not reorder equal elements) and <em>O</em>(<em>m</em> * <em>n</em> * log(<em>n</em>))
worst-case, where the key function is <em>O</em>(<em>m</em>).</p>
<p>If the implementation of <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord"><code>Ord</code></a> for <code>K</code> does not implement a <a href="https://en.wikipedia.org/wiki/Total_order">total order</a>, the function
may panic; even if the function exits normally, the resulting order of elements in the slice
is unspecified. See also the note on panicking below.</p>
<h5 id="current-implementation-8"><a class="doc-anchor" href="#current-implementation-8">§</a>Current implementation</h5>
<p>The current implementation is based on <a href="https://github.com/Voultapher/driftsort">driftsort</a> by Orson Peters and Lukas Bergdoll, which
combines the fast average case of quicksort with the fast worst case and partial run
detection of mergesort, achieving linear time on fully sorted and reversed inputs. On inputs
with k distinct elements, the expected time to sort the data is <em>O</em>(<em>n</em> * log(<em>k</em>)).</p>
<p>The auxiliary memory allocation behavior depends on the input length. Short slices are
handled without allocation, medium sized slices allocate <code>self.len()</code> and beyond that it
clamps at <code>self.len() / 2</code>.</p>
<h5 id="panics-38"><a class="doc-anchor" href="#panics-38">§</a>Panics</h5>
<p>May panic if the implementation of <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord"><code>Ord</code></a> for <code>K</code> does not implement a <a href="https://en.wikipedia.org/wiki/Total_order">total order</a>, or if
the <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord"><code>Ord</code></a> implementation or the key-function <code>f</code> panics.</p>
<p>All safe functions on slices preserve the invariant that even if the function panics, all
original elements will remain in the slice and any possible modifications via interior
mutability are observed in the input. This ensures that recovery code (for instance inside
of a <code>Drop</code> or following a <code>catch_unwind</code>) will still have access to all the original
elements. For instance, if the slice belongs to a <code>Vec</code>, the <code>Vec::drop</code> method will be able
to dispose of all contained elements.</p>
<h5 id="examples-136"><a class="doc-anchor" href="#examples-136">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>v = [<span class="number">4i32</span>, -<span class="number">5</span>, <span class="number">1</span>, -<span class="number">3</span>, <span class="number">2</span>];
v.sort_by_key(|k| k.abs());
<span class="macro">assert_eq!</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>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.sort_by_cached_key" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.34.0">1.34.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/alloc/slice.rs.html#312-315">Source</a></span><h4 class="code-header">pub fn <a href="#method.sort_by_cached_key" class="fn">sort_by_cached_key</a>&lt;K, F&gt;(&amp;mut self, f: F)<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; K,
K: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h4></section></summary><div class="docblock"><p>Sorts the slice in ascending order with a key extraction function, preserving initial order
of equal elements.</p>
<p>This sort is stable (i.e., does not reorder equal elements) and <em>O</em>(<em>m</em> * <em>n</em> + <em>n</em> *
log(<em>n</em>)) worst-case, where the key function is <em>O</em>(<em>m</em>).</p>
<p>During sorting, the key function is called at most once per element, by using temporary
storage to remember the results of key evaluation. The order of calls to the key function is
unspecified and may change in future versions of the standard library.</p>
<p>If the implementation of <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord"><code>Ord</code></a> for <code>K</code> does not implement a <a href="https://en.wikipedia.org/wiki/Total_order">total order</a>, the function
may panic; even if the function exits normally, the resulting order of elements in the slice
is unspecified. See also the note on panicking below.</p>
<p>For simple key functions (e.g., functions that are property accesses or basic operations),
<a href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html#method.sort_by_key" title="method slice::sort_by_key"><code>sort_by_key</code></a> is likely to be faster.</p>
<h5 id="current-implementation-9"><a class="doc-anchor" href="#current-implementation-9">§</a>Current implementation</h5>
<p>The current implementation is based on <a href="https://github.com/Voultapher/sort-research-rs/tree/main/ipnsort">instruction-parallel-network sort</a> by Lukas
Bergdoll, which combines the fast average case of randomized quicksort with the fast worst
case of heapsort, while achieving linear time on fully sorted and reversed inputs. And
<em>O</em>(<em>k</em> * log(<em>n</em>)) where <em>k</em> is the number of distinct elements in the input. It leverages
superscalar out-of-order execution capabilities commonly found in CPUs, to efficiently
perform the operation.</p>
<p>In the worst case, the algorithm allocates temporary storage in a <code>Vec&lt;(K, usize)&gt;</code> the
length of the slice.</p>
<h5 id="panics-39"><a class="doc-anchor" href="#panics-39">§</a>Panics</h5>
<p>May panic if the implementation of <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord"><code>Ord</code></a> for <code>K</code> does not implement a <a href="https://en.wikipedia.org/wiki/Total_order">total order</a>, or if
the <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord"><code>Ord</code></a> implementation panics.</p>
<p>All safe functions on slices preserve the invariant that even if the function panics, all
original elements will remain in the slice and any possible modifications via interior
mutability are observed in the input. This ensures that recovery code (for instance inside
of a <code>Drop</code> or following a <code>catch_unwind</code>) will still have access to all the original
elements. For instance, if the slice belongs to a <code>Vec</code>, the <code>Vec::drop</code> method will be able
to dispose of all contained elements.</p>
<h5 id="examples-137"><a class="doc-anchor" href="#examples-137">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>v = [<span class="number">4i32</span>, -<span class="number">5</span>, <span class="number">1</span>, -<span class="number">3</span>, <span class="number">2</span>, <span class="number">10</span>];
<span class="comment">// Strings are sorted by lexicographical order.
</span>v.sort_by_cached_key(|k| k.to_string());
<span class="macro">assert_eq!</span>(v, [-<span class="number">3</span>, -<span class="number">5</span>, <span class="number">1</span>, <span class="number">10</span>, <span class="number">2</span>, <span class="number">4</span>]);</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.93.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>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;T&gt;<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.93.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-138"><a class="doc-anchor" href="#examples-138">§</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.93.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>&lt;A&gt;(&amp;self, alloc: A) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;T, A&gt;<div class="where">where
A: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/alloc/trait.Allocator.html" title="trait core::alloc::Allocator">Allocator</a>,
T: <a class="trait" href="https://doc.rust-lang.org/1.93.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-139"><a class="doc-anchor" href="#examples-139">§</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.93.1/src/alloc/slice.rs.html#507-509">Source</a></span><h4 class="code-header">pub fn <a href="#method.repeat" class="fn">repeat</a>(&amp;self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;T&gt;<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.93.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-40"><a class="doc-anchor" href="#panics-40">§</a>Panics</h5>
<p>This function will panic if the capacity would overflow.</p>
<h5 id="examples-140"><a class="doc-anchor" href="#examples-140">§</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.93.1/src/alloc/slice.rs.html#575-577">Source</a></span><h4 class="code-header">pub fn <a href="#method.concat" class="fn">concat</a>&lt;Item&gt;(&amp;self) -&gt; &lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a> as <a class="trait" href="https://doc.rust-lang.org/1.93.1/alloc/slice/trait.Concat.html" title="trait alloc::slice::Concat">Concat</a>&lt;Item&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.1/alloc/slice/trait.Concat.html#associatedtype.Output" title="type alloc::slice::Concat::Output">Output</a> <a href="#" class="tooltip" data-notable-ty="&lt;[T] as Concat&lt;Item&gt;&gt;::Output"></a><div class="where">where
<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>: <a class="trait" href="https://doc.rust-lang.org/1.93.1/alloc/slice/trait.Concat.html" title="trait alloc::slice::Concat">Concat</a>&lt;Item&gt;,
Item: ?<a class="trait" href="https://doc.rust-lang.org/1.93.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-141"><a class="doc-anchor" href="#examples-141">§</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.93.1/src/alloc/slice.rs.html#594-596">Source</a></span><h4 class="code-header">pub fn <a href="#method.join" class="fn">join</a>&lt;Separator&gt;(
&amp;self,
sep: Separator,
) -&gt; &lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a> as <a class="trait" href="https://doc.rust-lang.org/1.93.1/alloc/slice/trait.Join.html" title="trait alloc::slice::Join">Join</a>&lt;Separator&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.1/alloc/slice/trait.Join.html#associatedtype.Output" title="type alloc::slice::Join::Output">Output</a> <a href="#" class="tooltip" data-notable-ty="&lt;[T] as Join&lt;Separator&gt;&gt;::Output"></a><div class="where">where
<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>: <a class="trait" href="https://doc.rust-lang.org/1.93.1/alloc/slice/trait.Join.html" title="trait alloc::slice::Join">Join</a>&lt;Separator&gt;,</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-142"><a class="doc-anchor" href="#examples-142">§</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">&amp;</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">&amp;</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" 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.93.1/src/alloc/slice.rs.html#614-616">Source</a></span><h4 class="code-header">pub fn <a href="#method.connect" class="fn">connect</a>&lt;Separator&gt;(
&amp;self,
sep: Separator,
) -&gt; &lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a> as <a class="trait" href="https://doc.rust-lang.org/1.93.1/alloc/slice/trait.Join.html" title="trait alloc::slice::Join">Join</a>&lt;Separator&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.1/alloc/slice/trait.Join.html#associatedtype.Output" title="type alloc::slice::Join::Output">Output</a> <a href="#" class="tooltip" data-notable-ty="&lt;[T] as Join&lt;Separator&gt;&gt;::Output"></a><div class="where">where
<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>: <a class="trait" href="https://doc.rust-lang.org/1.93.1/alloc/slice/trait.Join.html" title="trait alloc::slice::Join">Join</a>&lt;Separator&gt;,</div></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 1.3.0: renamed to join</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-143"><a class="doc-anchor" href="#examples-143">§</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">&amp;</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.93.1/src/alloc/slice.rs.html#638">Source</a></span><h4 class="code-header">pub fn <a href="#method.to_ascii_uppercase" class="fn">to_ascii_uppercase</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>&gt; <a href="#" class="tooltip" data-notable-ty="Vec&lt;u8&gt;"></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.93.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.93.1/src/alloc/slice.rs.html#659">Source</a></span><h4 class="code-header">pub fn <a href="#method.to_ascii_lowercase" class="fn">to_ascii_lowercase</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>&gt; <a href="#" class="tooltip" data-notable-ty="Vec&lt;u8&gt;"></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.93.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-AsMut%3C%5Bu8%5D%3E-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1267-1272">Source</a><a href="#impl-AsMut%3C%5Bu8%5D%3E-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a>&lt;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]&gt; for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_mut" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1269-1271">Source</a><a href="#method.as_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsMut.html#tymethod.as_mut" class="fn">as_mut</a>(&amp;mut self) -&gt; &amp;mut [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>] <a href="#" class="tooltip" data-notable-ty="&amp;mut [u8]"></a></h4></section></summary><div class='docblock'>Converts this type into a mutable reference of the (usually inferred) input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AsRef%3C%5Bu8%5D%3E-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1251-1256">Source</a><a href="#impl-AsRef%3C%5Bu8%5D%3E-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]&gt; for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_ref" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1253-1255">Source</a><a href="#method.as_ref" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsRef.html#tymethod.as_ref" class="fn">as_ref</a>(&amp;self) -&gt; &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>] <a href="#" class="tooltip" data-notable-ty="&amp;[u8]"></a></h4></section></summary><div class='docblock'>Converts this type into a shared reference of the (usually inferred) input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Borrow%3C%5Bu8%5D%3E-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1336-1340">Source</a><a href="#impl-Borrow%3C%5Bu8%5D%3E-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]&gt; for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></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="../src/bytes/bytes_mut.rs.html#1337-1339">Source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&amp;self) -&gt; &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>] <a href="#" class="tooltip" data-notable-ty="&amp;[u8]"></a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BorrowMut%3C%5Bu8%5D%3E-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1342-1346">Source</a><a href="#impl-BorrowMut%3C%5Bu8%5D%3E-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]&gt; for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></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="../src/bytes/bytes_mut.rs.html#1343-1345">Source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&amp;mut self) -&gt; &amp;mut [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>] <a href="#" class="tooltip" data-notable-ty="&amp;mut [u8]"></a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Buf-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1143-1172">Source</a><a href="#impl-Buf-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="buf/trait.Buf.html" title="trait bytes::buf::Buf">Buf</a> for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.remaining" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1145-1147">Source</a><a href="#method.remaining" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#tymethod.remaining" class="fn">remaining</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a></h4></section></summary><div class='docblock'>Returns the number of bytes between the current position and the end of
the buffer. <a href="buf/trait.Buf.html#tymethod.remaining">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.chunk" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1150-1152">Source</a><a href="#method.chunk" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#tymethod.chunk" class="fn">chunk</a>(&amp;self) -&gt; &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>] <a href="#" class="tooltip" data-notable-ty="&amp;[u8]"></a></h4></section></summary><div class='docblock'>Returns a slice starting at the current position and of length between 0
and <code>Buf::remaining()</code>. Note that this <em>can</em> return a shorter slice (this
allows non-continuous internal representation). <a href="buf/trait.Buf.html#tymethod.chunk">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.advance" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1155-1167">Source</a><a href="#method.advance" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#tymethod.advance" class="fn">advance</a>(&amp;mut self, cnt: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>)</h4></section></summary><div class='docblock'>Advance the internal cursor of the Buf <a href="buf/trait.Buf.html#tymethod.advance">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.copy_to_bytes" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1169-1171">Source</a><a href="#method.copy_to_bytes" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.copy_to_bytes" class="fn">copy_to_bytes</a>(&amp;mut self, len: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="struct.Bytes.html" title="struct bytes::Bytes">Bytes</a></h4></section></summary><div class='docblock'>Consumes <code>len</code> bytes inside self and returns new instance of <code>Bytes</code>
with this data. <a href="buf/trait.Buf.html#method.copy_to_bytes">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.chunks_vectored" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#207-218">Source</a><a href="#method.chunks_vectored" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.chunks_vectored" class="fn">chunks_vectored</a>&lt;'a&gt;(&amp;'a self, dst: &amp;mut [<a class="struct" href="https://doc.rust-lang.org/1.93.1/std/io/struct.IoSlice.html" title="struct std::io::IoSlice">IoSlice</a>&lt;'a&gt;]) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a></h4></section></summary><div class='docblock'>Fills <code>dst</code> with potentially multiple slices starting at <code>self</code>s
current position. <a href="buf/trait.Buf.html#method.chunks_vectored">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.has_remaining" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#269-271">Source</a><a href="#method.has_remaining" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.has_remaining" class="fn">has_remaining</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Returns true if there are any more bytes to consume <a href="buf/trait.Buf.html#method.has_remaining">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.copy_to_slice" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#294-297">Source</a><a href="#method.copy_to_slice" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.copy_to_slice" class="fn">copy_to_slice</a>(&amp;mut self, dst: &amp;mut [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>])</h4></section></summary><div class='docblock'>Copies bytes from <code>self</code> into <code>dst</code>. <a href="buf/trait.Buf.html#method.copy_to_slice">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_u8" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#315-325">Source</a><a href="#method.get_u8" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_u8" class="fn">get_u8</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a></h4></section></summary><div class='docblock'>Gets an unsigned 8 bit integer from <code>self</code>. <a href="buf/trait.Buf.html#method.get_u8">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_i8" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#343-353">Source</a><a href="#method.get_i8" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_i8" class="fn">get_i8</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i8.html">i8</a></h4></section></summary><div class='docblock'>Gets a signed 8 bit integer from <code>self</code>. <a href="buf/trait.Buf.html#method.get_i8">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_u16" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#371-373">Source</a><a href="#method.get_u16" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_u16" class="fn">get_u16</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u16.html">u16</a></h4></section></summary><div class='docblock'>Gets an unsigned 16 bit integer from <code>self</code> in big-endian byte order. <a href="buf/trait.Buf.html#method.get_u16">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_u16_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#391-393">Source</a><a href="#method.get_u16_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_u16_le" class="fn">get_u16_le</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u16.html">u16</a></h4></section></summary><div class='docblock'>Gets an unsigned 16 bit integer from <code>self</code> in little-endian byte order. <a href="buf/trait.Buf.html#method.get_u16_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_u16_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#414-416">Source</a><a href="#method.get_u16_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_u16_ne" class="fn">get_u16_ne</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u16.html">u16</a></h4></section></summary><div class='docblock'>Gets an unsigned 16 bit integer from <code>self</code> in native-endian byte order. <a href="buf/trait.Buf.html#method.get_u16_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_i16" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#434-436">Source</a><a href="#method.get_i16" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_i16" class="fn">get_i16</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i16.html">i16</a></h4></section></summary><div class='docblock'>Gets a signed 16 bit integer from <code>self</code> in big-endian byte order. <a href="buf/trait.Buf.html#method.get_i16">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_i16_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#454-456">Source</a><a href="#method.get_i16_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_i16_le" class="fn">get_i16_le</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i16.html">i16</a></h4></section></summary><div class='docblock'>Gets a signed 16 bit integer from <code>self</code> in little-endian byte order. <a href="buf/trait.Buf.html#method.get_i16_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_i16_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#477-479">Source</a><a href="#method.get_i16_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_i16_ne" class="fn">get_i16_ne</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i16.html">i16</a></h4></section></summary><div class='docblock'>Gets a signed 16 bit integer from <code>self</code> in native-endian byte order. <a href="buf/trait.Buf.html#method.get_i16_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_u32" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#497-499">Source</a><a href="#method.get_u32" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_u32" class="fn">get_u32</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a></h4></section></summary><div class='docblock'>Gets an unsigned 32 bit integer from <code>self</code> in the big-endian byte order. <a href="buf/trait.Buf.html#method.get_u32">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_u32_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#517-519">Source</a><a href="#method.get_u32_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_u32_le" class="fn">get_u32_le</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a></h4></section></summary><div class='docblock'>Gets an unsigned 32 bit integer from <code>self</code> in the little-endian byte order. <a href="buf/trait.Buf.html#method.get_u32_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_u32_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#540-542">Source</a><a href="#method.get_u32_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_u32_ne" class="fn">get_u32_ne</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a></h4></section></summary><div class='docblock'>Gets an unsigned 32 bit integer from <code>self</code> in native-endian byte order. <a href="buf/trait.Buf.html#method.get_u32_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_i32" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#560-562">Source</a><a href="#method.get_i32" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_i32" class="fn">get_i32</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i32.html">i32</a></h4></section></summary><div class='docblock'>Gets a signed 32 bit integer from <code>self</code> in big-endian byte order. <a href="buf/trait.Buf.html#method.get_i32">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_i32_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#580-582">Source</a><a href="#method.get_i32_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_i32_le" class="fn">get_i32_le</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i32.html">i32</a></h4></section></summary><div class='docblock'>Gets a signed 32 bit integer from <code>self</code> in little-endian byte order. <a href="buf/trait.Buf.html#method.get_i32_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_i32_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#603-605">Source</a><a href="#method.get_i32_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_i32_ne" class="fn">get_i32_ne</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i32.html">i32</a></h4></section></summary><div class='docblock'>Gets a signed 32 bit integer from <code>self</code> in native-endian byte order. <a href="buf/trait.Buf.html#method.get_i32_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_u64" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#623-625">Source</a><a href="#method.get_u64" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_u64" class="fn">get_u64</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a></h4></section></summary><div class='docblock'>Gets an unsigned 64 bit integer from <code>self</code> in big-endian byte order. <a href="buf/trait.Buf.html#method.get_u64">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_u64_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#643-645">Source</a><a href="#method.get_u64_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_u64_le" class="fn">get_u64_le</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a></h4></section></summary><div class='docblock'>Gets an unsigned 64 bit integer from <code>self</code> in little-endian byte order. <a href="buf/trait.Buf.html#method.get_u64_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_u64_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#666-668">Source</a><a href="#method.get_u64_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_u64_ne" class="fn">get_u64_ne</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a></h4></section></summary><div class='docblock'>Gets an unsigned 64 bit integer from <code>self</code> in native-endian byte order. <a href="buf/trait.Buf.html#method.get_u64_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_i64" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#686-688">Source</a><a href="#method.get_i64" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_i64" class="fn">get_i64</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a></h4></section></summary><div class='docblock'>Gets a signed 64 bit integer from <code>self</code> in big-endian byte order. <a href="buf/trait.Buf.html#method.get_i64">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_i64_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#706-708">Source</a><a href="#method.get_i64_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_i64_le" class="fn">get_i64_le</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a></h4></section></summary><div class='docblock'>Gets a signed 64 bit integer from <code>self</code> in little-endian byte order. <a href="buf/trait.Buf.html#method.get_i64_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_i64_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#729-731">Source</a><a href="#method.get_i64_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_i64_ne" class="fn">get_i64_ne</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a></h4></section></summary><div class='docblock'>Gets a signed 64 bit integer from <code>self</code> in native-endian byte order. <a href="buf/trait.Buf.html#method.get_i64_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_u128" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#749-751">Source</a><a href="#method.get_u128" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_u128" class="fn">get_u128</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u128.html">u128</a></h4></section></summary><div class='docblock'>Gets an unsigned 128 bit integer from <code>self</code> in big-endian byte order. <a href="buf/trait.Buf.html#method.get_u128">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_u128_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#769-771">Source</a><a href="#method.get_u128_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_u128_le" class="fn">get_u128_le</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u128.html">u128</a></h4></section></summary><div class='docblock'>Gets an unsigned 128 bit integer from <code>self</code> in little-endian byte order. <a href="buf/trait.Buf.html#method.get_u128_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_u128_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#792-794">Source</a><a href="#method.get_u128_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_u128_ne" class="fn">get_u128_ne</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u128.html">u128</a></h4></section></summary><div class='docblock'>Gets an unsigned 128 bit integer from <code>self</code> in native-endian byte order. <a href="buf/trait.Buf.html#method.get_u128_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_i128" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#812-814">Source</a><a href="#method.get_i128" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_i128" class="fn">get_i128</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i128.html">i128</a></h4></section></summary><div class='docblock'>Gets a signed 128 bit integer from <code>self</code> in big-endian byte order. <a href="buf/trait.Buf.html#method.get_i128">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_i128_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#832-834">Source</a><a href="#method.get_i128_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_i128_le" class="fn">get_i128_le</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i128.html">i128</a></h4></section></summary><div class='docblock'>Gets a signed 128 bit integer from <code>self</code> in little-endian byte order. <a href="buf/trait.Buf.html#method.get_i128_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_i128_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#855-857">Source</a><a href="#method.get_i128_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_i128_ne" class="fn">get_i128_ne</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i128.html">i128</a></h4></section></summary><div class='docblock'>Gets a signed 128 bit integer from <code>self</code> in native-endian byte order. <a href="buf/trait.Buf.html#method.get_i128_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_uint" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#876-878">Source</a><a href="#method.get_uint" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_uint" class="fn">get_uint</a>(&amp;mut self, nbytes: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a></h4></section></summary><div class='docblock'>Gets an unsigned n-byte integer from <code>self</code> in big-endian byte order. <a href="buf/trait.Buf.html#method.get_uint">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_uint_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#897-899">Source</a><a href="#method.get_uint_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_uint_le" class="fn">get_uint_le</a>(&amp;mut self, nbytes: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a></h4></section></summary><div class='docblock'>Gets an unsigned n-byte integer from <code>self</code> in little-endian byte order. <a href="buf/trait.Buf.html#method.get_uint_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_uint_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#921-927">Source</a><a href="#method.get_uint_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_uint_ne" class="fn">get_uint_ne</a>(&amp;mut self, nbytes: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a></h4></section></summary><div class='docblock'>Gets an unsigned n-byte integer from <code>self</code> in native-endian byte order. <a href="buf/trait.Buf.html#method.get_uint_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_int" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#946-948">Source</a><a href="#method.get_int" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_int" class="fn">get_int</a>(&amp;mut self, nbytes: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a></h4></section></summary><div class='docblock'>Gets a signed n-byte integer from <code>self</code> in big-endian byte order. <a href="buf/trait.Buf.html#method.get_int">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_int_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#967-969">Source</a><a href="#method.get_int_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_int_le" class="fn">get_int_le</a>(&amp;mut self, nbytes: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a></h4></section></summary><div class='docblock'>Gets a signed n-byte integer from <code>self</code> in little-endian byte order. <a href="buf/trait.Buf.html#method.get_int_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_int_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#991-997">Source</a><a href="#method.get_int_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_int_ne" class="fn">get_int_ne</a>(&amp;mut self, nbytes: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a></h4></section></summary><div class='docblock'>Gets a signed n-byte integer from <code>self</code> in native-endian byte order. <a href="buf/trait.Buf.html#method.get_int_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_f32" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1016-1018">Source</a><a href="#method.get_f32" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_f32" class="fn">get_f32</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.f32.html">f32</a></h4></section></summary><div class='docblock'>Gets an IEEE754 single-precision (4 bytes) floating point number from
<code>self</code> in big-endian byte order. <a href="buf/trait.Buf.html#method.get_f32">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_f32_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1037-1039">Source</a><a href="#method.get_f32_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_f32_le" class="fn">get_f32_le</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.f32.html">f32</a></h4></section></summary><div class='docblock'>Gets an IEEE754 single-precision (4 bytes) floating point number from
<code>self</code> in little-endian byte order. <a href="buf/trait.Buf.html#method.get_f32_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_f32_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1061-1063">Source</a><a href="#method.get_f32_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_f32_ne" class="fn">get_f32_ne</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.f32.html">f32</a></h4></section></summary><div class='docblock'>Gets an IEEE754 single-precision (4 bytes) floating point number from
<code>self</code> in native-endian byte order. <a href="buf/trait.Buf.html#method.get_f32_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_f64" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1082-1084">Source</a><a href="#method.get_f64" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_f64" class="fn">get_f64</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.f64.html">f64</a></h4></section></summary><div class='docblock'>Gets an IEEE754 double-precision (8 bytes) floating point number from
<code>self</code> in big-endian byte order. <a href="buf/trait.Buf.html#method.get_f64">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_f64_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1103-1105">Source</a><a href="#method.get_f64_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_f64_le" class="fn">get_f64_le</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.f64.html">f64</a></h4></section></summary><div class='docblock'>Gets an IEEE754 double-precision (8 bytes) floating point number from
<code>self</code> in little-endian byte order. <a href="buf/trait.Buf.html#method.get_f64_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_f64_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1127-1129">Source</a><a href="#method.get_f64_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.get_f64_ne" class="fn">get_f64_ne</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.f64.html">f64</a></h4></section></summary><div class='docblock'>Gets an IEEE754 double-precision (8 bytes) floating point number from
<code>self</code> in native-endian byte order. <a href="buf/trait.Buf.html#method.get_f64_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_copy_to_slice" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1161-1179">Source</a><a href="#method.try_copy_to_slice" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_copy_to_slice" class="fn">try_copy_to_slice</a>(&amp;mut self, dst: &amp;mut [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Copies bytes from <code>self</code> into <code>dst</code>. <a href="buf/trait.Buf.html#method.try_copy_to_slice">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_u8" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1204-1214">Source</a><a href="#method.try_get_u8" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_u8" class="fn">try_get_u8</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets an unsigned 8 bit integer from <code>self</code>. <a href="buf/trait.Buf.html#method.try_get_u8">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_i8" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1239-1249">Source</a><a href="#method.try_get_i8" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_i8" class="fn">try_get_i8</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i8.html">i8</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets a signed 8 bit integer from <code>self</code>. <a href="buf/trait.Buf.html#method.try_get_i8">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_u16" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1275-1277">Source</a><a href="#method.try_get_u16" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_u16" class="fn">try_get_u16</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u16.html">u16</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets an unsigned 16 bit integer from <code>self</code> in big-endian byte order. <a href="buf/trait.Buf.html#method.try_get_u16">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_u16_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1303-1305">Source</a><a href="#method.try_get_u16_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_u16_le" class="fn">try_get_u16_le</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u16.html">u16</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets an unsigned 16 bit integer from <code>self</code> in little-endian byte order. <a href="buf/trait.Buf.html#method.try_get_u16_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_u16_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1334-1336">Source</a><a href="#method.try_get_u16_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_u16_ne" class="fn">try_get_u16_ne</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u16.html">u16</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets an unsigned 16 bit integer from <code>self</code> in native-endian byte order. <a href="buf/trait.Buf.html#method.try_get_u16_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_i16" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1362-1364">Source</a><a href="#method.try_get_i16" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_i16" class="fn">try_get_i16</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i16.html">i16</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets a signed 16 bit integer from <code>self</code> in big-endian byte order. <a href="buf/trait.Buf.html#method.try_get_i16">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_i16_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1390-1392">Source</a><a href="#method.try_get_i16_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_i16_le" class="fn">try_get_i16_le</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i16.html">i16</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets an signed 16 bit integer from <code>self</code> in little-endian byte order. <a href="buf/trait.Buf.html#method.try_get_i16_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_i16_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1421-1423">Source</a><a href="#method.try_get_i16_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_i16_ne" class="fn">try_get_i16_ne</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i16.html">i16</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets a signed 16 bit integer from <code>self</code> in native-endian byte order. <a href="buf/trait.Buf.html#method.try_get_i16_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_u32" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1449-1451">Source</a><a href="#method.try_get_u32" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_u32" class="fn">try_get_u32</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets an unsigned 32 bit integer from <code>self</code> in big-endian byte order. <a href="buf/trait.Buf.html#method.try_get_u32">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_u32_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1477-1479">Source</a><a href="#method.try_get_u32_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_u32_le" class="fn">try_get_u32_le</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets an unsigned 32 bit integer from <code>self</code> in little-endian byte order. <a href="buf/trait.Buf.html#method.try_get_u32_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_u32_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1508-1510">Source</a><a href="#method.try_get_u32_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_u32_ne" class="fn">try_get_u32_ne</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets an unsigned 32 bit integer from <code>self</code> in native-endian byte order. <a href="buf/trait.Buf.html#method.try_get_u32_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_i32" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1536-1538">Source</a><a href="#method.try_get_i32" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_i32" class="fn">try_get_i32</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i32.html">i32</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets a signed 32 bit integer from <code>self</code> in big-endian byte order. <a href="buf/trait.Buf.html#method.try_get_i32">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_i32_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1564-1566">Source</a><a href="#method.try_get_i32_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_i32_le" class="fn">try_get_i32_le</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i32.html">i32</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets a signed 32 bit integer from <code>self</code> in little-endian byte order. <a href="buf/trait.Buf.html#method.try_get_i32_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_i32_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1595-1597">Source</a><a href="#method.try_get_i32_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_i32_ne" class="fn">try_get_i32_ne</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i32.html">i32</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets a signed 32 bit integer from <code>self</code> in native-endian byte order. <a href="buf/trait.Buf.html#method.try_get_i32_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_u64" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1623-1625">Source</a><a href="#method.try_get_u64" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_u64" class="fn">try_get_u64</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets an unsigned 64 bit integer from <code>self</code> in big-endian byte order. <a href="buf/trait.Buf.html#method.try_get_u64">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_u64_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1651-1653">Source</a><a href="#method.try_get_u64_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_u64_le" class="fn">try_get_u64_le</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets an unsigned 64 bit integer from <code>self</code> in little-endian byte order. <a href="buf/trait.Buf.html#method.try_get_u64_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_u64_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1682-1684">Source</a><a href="#method.try_get_u64_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_u64_ne" class="fn">try_get_u64_ne</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets an unsigned 64 bit integer from <code>self</code> in native-endian byte order. <a href="buf/trait.Buf.html#method.try_get_u64_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_i64" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1710-1712">Source</a><a href="#method.try_get_i64" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_i64" class="fn">try_get_i64</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets a signed 64 bit integer from <code>self</code> in big-endian byte order. <a href="buf/trait.Buf.html#method.try_get_i64">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_i64_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1738-1740">Source</a><a href="#method.try_get_i64_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_i64_le" class="fn">try_get_i64_le</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets a signed 64 bit integer from <code>self</code> in little-endian byte order. <a href="buf/trait.Buf.html#method.try_get_i64_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_i64_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1769-1771">Source</a><a href="#method.try_get_i64_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_i64_ne" class="fn">try_get_i64_ne</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets a signed 64 bit integer from <code>self</code> in native-endian byte order. <a href="buf/trait.Buf.html#method.try_get_i64_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_u128" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1797-1799">Source</a><a href="#method.try_get_u128" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_u128" class="fn">try_get_u128</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u128.html">u128</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets an unsigned 128 bit integer from <code>self</code> in big-endian byte order. <a href="buf/trait.Buf.html#method.try_get_u128">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_u128_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1825-1827">Source</a><a href="#method.try_get_u128_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_u128_le" class="fn">try_get_u128_le</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u128.html">u128</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets an unsigned 128 bit integer from <code>self</code> in little-endian byte order. <a href="buf/trait.Buf.html#method.try_get_u128_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_u128_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1856-1858">Source</a><a href="#method.try_get_u128_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_u128_ne" class="fn">try_get_u128_ne</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u128.html">u128</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets an unsigned 128 bit integer from <code>self</code> in native-endian byte order. <a href="buf/trait.Buf.html#method.try_get_u128_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_i128" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1884-1886">Source</a><a href="#method.try_get_i128" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_i128" class="fn">try_get_i128</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i128.html">i128</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets a signed 128 bit integer from <code>self</code> in big-endian byte order. <a href="buf/trait.Buf.html#method.try_get_i128">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_i128_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1912-1914">Source</a><a href="#method.try_get_i128_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_i128_le" class="fn">try_get_i128_le</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i128.html">i128</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets a signed 128 bit integer from <code>self</code> in little-endian byte order. <a href="buf/trait.Buf.html#method.try_get_i128_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_i128_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1943-1945">Source</a><a href="#method.try_get_i128_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_i128_ne" class="fn">try_get_i128_ne</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i128.html">i128</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets a signed 128 bit integer from <code>self</code> in native-endian byte order. <a href="buf/trait.Buf.html#method.try_get_i128_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_uint" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#1975-1977">Source</a><a href="#method.try_get_uint" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_uint" class="fn">try_get_uint</a>(&amp;mut self, nbytes: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets an unsigned n-byte integer from <code>self</code> in big-endian byte order. <a href="buf/trait.Buf.html#method.try_get_uint">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_uint_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#2007-2009">Source</a><a href="#method.try_get_uint_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_uint_le" class="fn">try_get_uint_le</a>(&amp;mut self, nbytes: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets an unsigned n-byte integer from <code>self</code> in little-endian byte order. <a href="buf/trait.Buf.html#method.try_get_uint_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_uint_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#2045-2051">Source</a><a href="#method.try_get_uint_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_uint_ne" class="fn">try_get_uint_ne</a>(&amp;mut self, nbytes: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets an unsigned n-byte integer from <code>self</code> in native-endian byte order. <a href="buf/trait.Buf.html#method.try_get_uint_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_int" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#2081-2083">Source</a><a href="#method.try_get_int" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_int" class="fn">try_get_int</a>(&amp;mut self, nbytes: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets a signed n-byte integer from <code>self</code> in big-endian byte order. <a href="buf/trait.Buf.html#method.try_get_int">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_int_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#2113-2115">Source</a><a href="#method.try_get_int_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_int_le" class="fn">try_get_int_le</a>(&amp;mut self, nbytes: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets a signed n-byte integer from <code>self</code> in little-endian byte order. <a href="buf/trait.Buf.html#method.try_get_int_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_int_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#2151-2157">Source</a><a href="#method.try_get_int_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_int_ne" class="fn">try_get_int_ne</a>(&amp;mut self, nbytes: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets a signed n-byte integer from <code>self</code> in native-endian byte order. <a href="buf/trait.Buf.html#method.try_get_int_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_f32" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#2184-2186">Source</a><a href="#method.try_get_f32" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_f32" class="fn">try_get_f32</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.f32.html">f32</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets an IEEE754 single-precision (4 bytes) floating point number from
<code>self</code> in big-endian byte order. <a href="buf/trait.Buf.html#method.try_get_f32">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_f32_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#2213-2215">Source</a><a href="#method.try_get_f32_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_f32_le" class="fn">try_get_f32_le</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.f32.html">f32</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets an IEEE754 single-precision (4 bytes) floating point number from
<code>self</code> in little-endian byte order. <a href="buf/trait.Buf.html#method.try_get_f32_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_f32_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#2245-2247">Source</a><a href="#method.try_get_f32_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_f32_ne" class="fn">try_get_f32_ne</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.f32.html">f32</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets an IEEE754 single-precision (4 bytes) floating point number from
<code>self</code> in native-endian byte order. <a href="buf/trait.Buf.html#method.try_get_f32_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_f64" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#2274-2276">Source</a><a href="#method.try_get_f64" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_f64" class="fn">try_get_f64</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.f64.html">f64</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets an IEEE754 double-precision (8 bytes) floating point number from
<code>self</code> in big-endian byte order. <a href="buf/trait.Buf.html#method.try_get_f64">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_f64_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#2303-2305">Source</a><a href="#method.try_get_f64_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_f64_le" class="fn">try_get_f64_le</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.f64.html">f64</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets an IEEE754 double-precision (8 bytes) floating point number from
<code>self</code> in little-endian byte order. <a href="buf/trait.Buf.html#method.try_get_f64_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_f64_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#2335-2337">Source</a><a href="#method.try_get_f64_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.try_get_f64_ne" class="fn">try_get_f64_ne</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.f64.html">f64</a>, <a class="struct" href="struct.TryGetError.html" title="struct bytes::TryGetError">TryGetError</a>&gt;</h4></section></summary><div class='docblock'>Gets an IEEE754 double-precision (8 bytes) floating point number from
<code>self</code> in native-endian byte order. <a href="buf/trait.Buf.html#method.try_get_f64_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.take" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#2394-2399">Source</a><a href="#method.take" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.take" class="fn">take</a>(self, limit: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="buf/struct.Take.html" title="struct bytes::buf::Take">Take</a>&lt;Self&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Creates an adaptor which will read at most <code>limit</code> bytes from <code>self</code>. <a href="buf/trait.Buf.html#method.take">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.chain" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#2416-2421">Source</a><a href="#method.chain" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.chain" class="fn">chain</a>&lt;U: <a class="trait" href="buf/trait.Buf.html" title="trait bytes::buf::Buf">Buf</a>&gt;(self, next: U) -&gt; <a class="struct" href="buf/struct.Chain.html" title="struct bytes::buf::Chain">Chain</a>&lt;Self, U&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Creates an adaptor which will chain this buffer with another. <a href="buf/trait.Buf.html#method.chain">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.reader" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_impl.rs.html#2448-2453">Source</a><a href="#method.reader" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.Buf.html#method.reader" class="fn">reader</a>(self) -&gt; <a class="struct" href="buf/struct.Reader.html" title="struct bytes::buf::Reader">Reader</a>&lt;Self&gt; <a href="#" class="tooltip" data-notable-ty="Reader&lt;Self&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Creates an adaptor which implements the <code>Read</code> trait for <code>self</code>. <a href="buf/trait.Buf.html#method.reader">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BufMut-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1174-1249">Source</a><a href="#impl-BufMut-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="buf/trait.BufMut.html" title="trait bytes::buf::BufMut">BufMut</a> for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.remaining_mut" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1176-1179">Source</a><a href="#method.remaining_mut" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#tymethod.remaining_mut" class="fn">remaining_mut</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a></h4></section></summary><div class='docblock'>Returns the number of bytes that can be written from the current
position until the end of the buffer is reached. <a href="buf/trait.BufMut.html#tymethod.remaining_mut">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.advance_mut" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1182-1192">Source</a><a href="#method.advance_mut" class="anchor">§</a><h4 class="code-header">unsafe fn <a href="buf/trait.BufMut.html#tymethod.advance_mut" class="fn">advance_mut</a>(&amp;mut self, cnt: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>)</h4></section></summary><div class='docblock'>Advance the internal cursor of the BufMut <a href="buf/trait.BufMut.html#tymethod.advance_mut">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.chunk_mut" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1195-1200">Source</a><a href="#method.chunk_mut" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#tymethod.chunk_mut" class="fn">chunk_mut</a>(&amp;mut self) -&gt; &amp;mut <a class="struct" href="buf/struct.UninitSlice.html" title="struct bytes::buf::UninitSlice">UninitSlice</a></h4></section></summary><div class='docblock'>Returns a mutable slice starting at the current BufMut position and of
length between 0 and <code>BufMut::remaining_mut()</code>. Note that this <em>can</em> be shorter than the
whole remainder of the buffer (this allows non-continuous implementation). <a href="buf/trait.BufMut.html#tymethod.chunk_mut">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1205-1231">Source</a><a href="#method.put" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put" class="fn">put</a>&lt;T: <a class="trait" href="buf/trait.Buf.html" title="trait bytes::buf::Buf">Buf</a>&gt;(&amp;mut self, src: T)<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Transfer bytes into <code>self</code> from <code>src</code> and advance the cursor by the
number of bytes written. <a href="buf/trait.BufMut.html#method.put">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_slice" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1233-1235">Source</a><a href="#method.put_slice" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_slice" class="fn">put_slice</a>(&amp;mut self, src: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>])</h4></section></summary><div class='docblock'>Transfer bytes into <code>self</code> from <code>src</code> and advance the cursor by the
number of bytes written. <a href="buf/trait.BufMut.html#method.put_slice">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_bytes" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1237-1248">Source</a><a href="#method.put_bytes" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_bytes" class="fn">put_bytes</a>(&amp;mut self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>, cnt: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>)</h4></section></summary><div class='docblock'>Put <code>cnt</code> bytes <code>val</code> into <code>self</code>. <a href="buf/trait.BufMut.html#method.put_bytes">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.has_remaining_mut" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#128-130">Source</a><a href="#method.has_remaining_mut" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.has_remaining_mut" class="fn">has_remaining_mut</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Returns true if there is space in <code>self</code> for more bytes. <a href="buf/trait.BufMut.html#method.has_remaining_mut">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_u8" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#330-333">Source</a><a href="#method.put_u8" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_u8" class="fn">put_u8</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>)</h4></section></summary><div class='docblock'>Writes an unsigned 8 bit integer to <code>self</code>. <a href="buf/trait.BufMut.html#method.put_u8">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_i8" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#354-357">Source</a><a href="#method.put_i8" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_i8" class="fn">put_i8</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i8.html">i8</a>)</h4></section></summary><div class='docblock'>Writes a signed 8 bit integer to <code>self</code>. <a href="buf/trait.BufMut.html#method.put_i8">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_u16" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#378-380">Source</a><a href="#method.put_u16" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_u16" class="fn">put_u16</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u16.html">u16</a>)</h4></section></summary><div class='docblock'>Writes an unsigned 16 bit integer to <code>self</code> in big-endian byte order. <a href="buf/trait.BufMut.html#method.put_u16">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_u16_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#401-403">Source</a><a href="#method.put_u16_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_u16_le" class="fn">put_u16_le</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u16.html">u16</a>)</h4></section></summary><div class='docblock'>Writes an unsigned 16 bit integer to <code>self</code> in little-endian byte order. <a href="buf/trait.BufMut.html#method.put_u16_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_u16_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#428-430">Source</a><a href="#method.put_u16_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_u16_ne" class="fn">put_u16_ne</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u16.html">u16</a>)</h4></section></summary><div class='docblock'>Writes an unsigned 16 bit integer to <code>self</code> in native-endian byte order. <a href="buf/trait.BufMut.html#method.put_u16_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_i16" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#451-453">Source</a><a href="#method.put_i16" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_i16" class="fn">put_i16</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i16.html">i16</a>)</h4></section></summary><div class='docblock'>Writes a signed 16 bit integer to <code>self</code> in big-endian byte order. <a href="buf/trait.BufMut.html#method.put_i16">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_i16_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#474-476">Source</a><a href="#method.put_i16_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_i16_le" class="fn">put_i16_le</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i16.html">i16</a>)</h4></section></summary><div class='docblock'>Writes a signed 16 bit integer to <code>self</code> in little-endian byte order. <a href="buf/trait.BufMut.html#method.put_i16_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_i16_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#501-503">Source</a><a href="#method.put_i16_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_i16_ne" class="fn">put_i16_ne</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i16.html">i16</a>)</h4></section></summary><div class='docblock'>Writes a signed 16 bit integer to <code>self</code> in native-endian byte order. <a href="buf/trait.BufMut.html#method.put_i16_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_u32" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#524-526">Source</a><a href="#method.put_u32" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_u32" class="fn">put_u32</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a>)</h4></section></summary><div class='docblock'>Writes an unsigned 32 bit integer to <code>self</code> in big-endian byte order. <a href="buf/trait.BufMut.html#method.put_u32">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_u32_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#547-549">Source</a><a href="#method.put_u32_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_u32_le" class="fn">put_u32_le</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a>)</h4></section></summary><div class='docblock'>Writes an unsigned 32 bit integer to <code>self</code> in little-endian byte order. <a href="buf/trait.BufMut.html#method.put_u32_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_u32_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#574-576">Source</a><a href="#method.put_u32_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_u32_ne" class="fn">put_u32_ne</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a>)</h4></section></summary><div class='docblock'>Writes an unsigned 32 bit integer to <code>self</code> in native-endian byte order. <a href="buf/trait.BufMut.html#method.put_u32_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_i32" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#597-599">Source</a><a href="#method.put_i32" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_i32" class="fn">put_i32</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i32.html">i32</a>)</h4></section></summary><div class='docblock'>Writes a signed 32 bit integer to <code>self</code> in big-endian byte order. <a href="buf/trait.BufMut.html#method.put_i32">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_i32_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#620-622">Source</a><a href="#method.put_i32_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_i32_le" class="fn">put_i32_le</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i32.html">i32</a>)</h4></section></summary><div class='docblock'>Writes a signed 32 bit integer to <code>self</code> in little-endian byte order. <a href="buf/trait.BufMut.html#method.put_i32_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_i32_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#647-649">Source</a><a href="#method.put_i32_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_i32_ne" class="fn">put_i32_ne</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i32.html">i32</a>)</h4></section></summary><div class='docblock'>Writes a signed 32 bit integer to <code>self</code> in native-endian byte order. <a href="buf/trait.BufMut.html#method.put_i32_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_u64" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#670-672">Source</a><a href="#method.put_u64" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_u64" class="fn">put_u64</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>)</h4></section></summary><div class='docblock'>Writes an unsigned 64 bit integer to <code>self</code> in the big-endian byte order. <a href="buf/trait.BufMut.html#method.put_u64">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_u64_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#693-695">Source</a><a href="#method.put_u64_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_u64_le" class="fn">put_u64_le</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>)</h4></section></summary><div class='docblock'>Writes an unsigned 64 bit integer to <code>self</code> in little-endian byte order. <a href="buf/trait.BufMut.html#method.put_u64_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_u64_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#720-722">Source</a><a href="#method.put_u64_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_u64_ne" class="fn">put_u64_ne</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>)</h4></section></summary><div class='docblock'>Writes an unsigned 64 bit integer to <code>self</code> in native-endian byte order. <a href="buf/trait.BufMut.html#method.put_u64_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_i64" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#743-745">Source</a><a href="#method.put_i64" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_i64" class="fn">put_i64</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a>)</h4></section></summary><div class='docblock'>Writes a signed 64 bit integer to <code>self</code> in the big-endian byte order. <a href="buf/trait.BufMut.html#method.put_i64">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_i64_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#766-768">Source</a><a href="#method.put_i64_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_i64_le" class="fn">put_i64_le</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a>)</h4></section></summary><div class='docblock'>Writes a signed 64 bit integer to <code>self</code> in little-endian byte order. <a href="buf/trait.BufMut.html#method.put_i64_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_i64_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#793-795">Source</a><a href="#method.put_i64_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_i64_ne" class="fn">put_i64_ne</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a>)</h4></section></summary><div class='docblock'>Writes a signed 64 bit integer to <code>self</code> in native-endian byte order. <a href="buf/trait.BufMut.html#method.put_i64_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_u128" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#816-818">Source</a><a href="#method.put_u128" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_u128" class="fn">put_u128</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u128.html">u128</a>)</h4></section></summary><div class='docblock'>Writes an unsigned 128 bit integer to <code>self</code> in the big-endian byte order. <a href="buf/trait.BufMut.html#method.put_u128">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_u128_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#839-841">Source</a><a href="#method.put_u128_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_u128_le" class="fn">put_u128_le</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u128.html">u128</a>)</h4></section></summary><div class='docblock'>Writes an unsigned 128 bit integer to <code>self</code> in little-endian byte order. <a href="buf/trait.BufMut.html#method.put_u128_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_u128_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#866-868">Source</a><a href="#method.put_u128_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_u128_ne" class="fn">put_u128_ne</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u128.html">u128</a>)</h4></section></summary><div class='docblock'>Writes an unsigned 128 bit integer to <code>self</code> in native-endian byte order. <a href="buf/trait.BufMut.html#method.put_u128_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_i128" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#889-891">Source</a><a href="#method.put_i128" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_i128" class="fn">put_i128</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i128.html">i128</a>)</h4></section></summary><div class='docblock'>Writes a signed 128 bit integer to <code>self</code> in the big-endian byte order. <a href="buf/trait.BufMut.html#method.put_i128">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_i128_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#912-914">Source</a><a href="#method.put_i128_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_i128_le" class="fn">put_i128_le</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i128.html">i128</a>)</h4></section></summary><div class='docblock'>Writes a signed 128 bit integer to <code>self</code> in little-endian byte order. <a href="buf/trait.BufMut.html#method.put_i128_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_i128_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#939-941">Source</a><a href="#method.put_i128_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_i128_ne" class="fn">put_i128_ne</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i128.html">i128</a>)</h4></section></summary><div class='docblock'>Writes a signed 128 bit integer to <code>self</code> in native-endian byte order. <a href="buf/trait.BufMut.html#method.put_i128_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_uint" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#962-969">Source</a><a href="#method.put_uint" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_uint" class="fn">put_uint</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>, nbytes: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>)</h4></section></summary><div class='docblock'>Writes an unsigned n-byte integer to <code>self</code> in big-endian byte order. <a href="buf/trait.BufMut.html#method.put_uint">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_uint_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#990-998">Source</a><a href="#method.put_uint_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_uint_le" class="fn">put_uint_le</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>, nbytes: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>)</h4></section></summary><div class='docblock'>Writes an unsigned n-byte integer to <code>self</code> in the little-endian byte order. <a href="buf/trait.BufMut.html#method.put_uint_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_uint_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#1023-1029">Source</a><a href="#method.put_uint_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_uint_ne" class="fn">put_uint_ne</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>, nbytes: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>)</h4></section></summary><div class='docblock'>Writes an unsigned n-byte integer to <code>self</code> in the native-endian byte order. <a href="buf/trait.BufMut.html#method.put_uint_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_int" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#1050-1057">Source</a><a href="#method.put_int" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_int" class="fn">put_int</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a>, nbytes: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>)</h4></section></summary><div class='docblock'>Writes low <code>nbytes</code> of a signed integer to <code>self</code> in big-endian byte order. <a href="buf/trait.BufMut.html#method.put_int">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_int_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#1078-1086">Source</a><a href="#method.put_int_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_int_le" class="fn">put_int_le</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a>, nbytes: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>)</h4></section></summary><div class='docblock'>Writes low <code>nbytes</code> of a signed integer to <code>self</code> in little-endian byte order. <a href="buf/trait.BufMut.html#method.put_int_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_int_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#1111-1117">Source</a><a href="#method.put_int_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_int_ne" class="fn">put_int_ne</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a>, nbytes: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>)</h4></section></summary><div class='docblock'>Writes low <code>nbytes</code> of a signed integer to <code>self</code> in native-endian byte order. <a href="buf/trait.BufMut.html#method.put_int_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_f32" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#1139-1141">Source</a><a href="#method.put_f32" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_f32" class="fn">put_f32</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.f32.html">f32</a>)</h4></section></summary><div class='docblock'>Writes an IEEE754 single-precision (4 bytes) floating point number to
<code>self</code> in big-endian byte order. <a href="buf/trait.BufMut.html#method.put_f32">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_f32_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#1163-1165">Source</a><a href="#method.put_f32_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_f32_le" class="fn">put_f32_le</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.f32.html">f32</a>)</h4></section></summary><div class='docblock'>Writes an IEEE754 single-precision (4 bytes) floating point number to
<code>self</code> in little-endian byte order. <a href="buf/trait.BufMut.html#method.put_f32_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_f32_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#1191-1193">Source</a><a href="#method.put_f32_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_f32_ne" class="fn">put_f32_ne</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.f32.html">f32</a>)</h4></section></summary><div class='docblock'>Writes an IEEE754 single-precision (4 bytes) floating point number to
<code>self</code> in native-endian byte order. <a href="buf/trait.BufMut.html#method.put_f32_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_f64" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#1215-1217">Source</a><a href="#method.put_f64" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_f64" class="fn">put_f64</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.f64.html">f64</a>)</h4></section></summary><div class='docblock'>Writes an IEEE754 double-precision (8 bytes) floating point number to
<code>self</code> in big-endian byte order. <a href="buf/trait.BufMut.html#method.put_f64">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_f64_le" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#1239-1241">Source</a><a href="#method.put_f64_le" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_f64_le" class="fn">put_f64_le</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.f64.html">f64</a>)</h4></section></summary><div class='docblock'>Writes an IEEE754 double-precision (8 bytes) floating point number to
<code>self</code> in little-endian byte order. <a href="buf/trait.BufMut.html#method.put_f64_le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.put_f64_ne" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#1267-1269">Source</a><a href="#method.put_f64_ne" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.put_f64_ne" class="fn">put_f64_ne</a>(&amp;mut self, n: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.f64.html">f64</a>)</h4></section></summary><div class='docblock'>Writes an IEEE754 double-precision (8 bytes) floating point number to
<code>self</code> in native-endian byte order. <a href="buf/trait.BufMut.html#method.put_f64_ne">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.limit" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#1285-1290">Source</a><a href="#method.limit" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.limit" class="fn">limit</a>(self, limit: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="buf/struct.Limit.html" title="struct bytes::buf::Limit">Limit</a>&lt;Self&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Creates an adaptor which can write at most <code>limit</code> bytes to <code>self</code>. <a href="buf/trait.BufMut.html#method.limit">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.writer" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#1317-1322">Source</a><a href="#method.writer" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.writer" class="fn">writer</a>(self) -&gt; <a class="struct" href="buf/struct.Writer.html" title="struct bytes::buf::Writer">Writer</a>&lt;Self&gt; <a href="#" class="tooltip" data-notable-ty="Writer&lt;Self&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Creates an adaptor which implements the <code>Write</code> trait for <code>self</code>. <a href="buf/trait.BufMut.html#method.writer">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.chain_mut" class="method trait-impl"><a class="src rightside" href="../src/bytes/buf/buf_mut.rs.html#1345-1350">Source</a><a href="#method.chain_mut" class="anchor">§</a><h4 class="code-header">fn <a href="buf/trait.BufMut.html#method.chain_mut" class="fn">chain_mut</a>&lt;U: <a class="trait" href="buf/trait.BufMut.html" title="trait bytes::buf::BufMut">BufMut</a>&gt;(self, next: U) -&gt; <a class="struct" href="buf/struct.Chain.html" title="struct bytes::buf::Chain">Chain</a>&lt;Self, U&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Creates an adapter which will chain this buffer with another. <a href="buf/trait.BufMut.html#method.chain_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Clone-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1365-1369">Source</a><a href="#impl-Clone-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></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/bytes/bytes_mut.rs.html#1366-1368">Source</a><a href="#method.clone" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/clone/trait.Clone.html#tymethod.clone" class="fn">clone</a>(&amp;self) -&gt; <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h4></section></summary><div class='docblock'>Returns a duplicate of the value. <a href="https://doc.rust-lang.org/1.93.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">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.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.93.1/core/clone/trait.Clone.html#method.clone_from" class="fn">clone_from</a>(&amp;mut self, source: &amp;Self)</h4></section></summary><div class='docblock'>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/1.93.1/core/clone/trait.Clone.html#method.clone_from">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/fmt/debug.rs.html#40">Source</a><a href="#impl-Debug-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></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/bytes/fmt/debug.rs.html#40">Source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/1.93.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.93.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-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1319-1324">Source</a><a href="#impl-Default-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></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/bytes/bytes_mut.rs.html#1321-1323">Source</a><a href="#method.default" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -&gt; <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/1.93.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-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1258-1265">Source</a><a href="#impl-Deref-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a> for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></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/bytes/bytes_mut.rs.html#1259">Source</a><a href="#associatedtype.Target" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.93.1/core/ops/deref/trait.Deref.html#associatedtype.Target" class="associatedtype">Target</a> = [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]</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/bytes/bytes_mut.rs.html#1262-1264">Source</a><a href="#method.deref" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/ops/deref/trait.Deref.html#tymethod.deref" class="fn">deref</a>(&amp;self) -&gt; &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>] <a href="#" class="tooltip" data-notable-ty="&amp;[u8]"></a></h4></section></summary><div class='docblock'>Dereferences the value.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-DerefMut-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1274-1279">Source</a><a href="#impl-DerefMut-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/deref/trait.DerefMut.html" title="trait core::ops::deref::DerefMut">DerefMut</a> for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.deref_mut" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1276-1278">Source</a><a href="#method.deref_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/ops/deref/trait.DerefMut.html#tymethod.deref_mut" class="fn">deref_mut</a>(&amp;mut self) -&gt; &amp;mut [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>] <a href="#" class="tooltip" data-notable-ty="&amp;mut [u8]"></a></h4></section></summary><div class='docblock'>Mutably dereferences the value.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Drop-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1126-1141">Source</a><a href="#impl-Drop-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/drop/trait.Drop.html" title="trait core::ops::drop::Drop">Drop</a> for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.drop" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1127-1140">Source</a><a href="#method.drop" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/ops/drop/trait.Drop.html#tymethod.drop" class="fn">drop</a>(&amp;mut self)</h4></section></summary><div class='docblock'>Executes the destructor for this type. <a href="https://doc.rust-lang.org/1.93.1/core/ops/drop/trait.Drop.html#tymethod.drop">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Extend%3C%26u8%3E-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1407-1414">Source</a><a href="#impl-Extend%3C%26u8%3E-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;&amp;'a <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>&gt; for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.extend-1" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1408-1413">Source</a><a href="#method.extend-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.Extend.html#tymethod.extend" class="fn">extend</a>&lt;T&gt;(&amp;mut self, iter: T)<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = &amp;'a <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>&gt;,</div></h4></section></summary><div class='docblock'>Extends a collection with the contents of an iterator. <a href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.Extend.html#tymethod.extend">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.extend_one-1" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/iter/traits/collect.rs.html#417">Source</a><a href="#method.extend_one-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.Extend.html#method.extend_one" class="fn">extend_one</a>(&amp;mut self, item: 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>extend_one</code>)</span></div></span><div class='docblock'>Extends a collection with exactly one element.</div></details><details class="toggle method-toggle" open><summary><section id="method.extend_reserve-1" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/iter/traits/collect.rs.html#425">Source</a><a href="#method.extend_reserve-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.Extend.html#method.extend_reserve" class="fn">extend_reserve</a>(&amp;mut self, additional: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</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>extend_one</code>)</span></div></span><div class='docblock'>Reserves capacity in a collection for the given number of additional elements. <a href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.Extend.html#method.extend_reserve">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Extend%3CBytes%3E-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1416-1425">Source</a><a href="#impl-Extend%3CBytes%3E-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;<a class="struct" href="struct.Bytes.html" title="struct bytes::Bytes">Bytes</a>&gt; for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.extend-2" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1417-1424">Source</a><a href="#method.extend-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.Extend.html#tymethod.extend" class="fn">extend</a>&lt;T&gt;(&amp;mut self, iter: T)<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = <a class="struct" href="struct.Bytes.html" title="struct bytes::Bytes">Bytes</a>&gt;,</div></h4></section></summary><div class='docblock'>Extends a collection with the contents of an iterator. <a href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.Extend.html#tymethod.extend">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.extend_one-2" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/iter/traits/collect.rs.html#417">Source</a><a href="#method.extend_one-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.Extend.html#method.extend_one" class="fn">extend_one</a>(&amp;mut self, item: 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>extend_one</code>)</span></div></span><div class='docblock'>Extends a collection with exactly one element.</div></details><details class="toggle method-toggle" open><summary><section id="method.extend_reserve-2" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/iter/traits/collect.rs.html#425">Source</a><a href="#method.extend_reserve-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.Extend.html#method.extend_reserve" class="fn">extend_reserve</a>(&amp;mut self, additional: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</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>extend_one</code>)</span></div></span><div class='docblock'>Reserves capacity in a collection for the given number of additional elements. <a href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.Extend.html#method.extend_reserve">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Extend%3Cu8%3E-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1389-1405">Source</a><a href="#impl-Extend%3Cu8%3E-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>&gt; for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.extend" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1390-1404">Source</a><a href="#method.extend" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.Extend.html#tymethod.extend" class="fn">extend</a>&lt;T&gt;(&amp;mut self, iter: T)<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>&gt;,</div></h4></section></summary><div class='docblock'>Extends a collection with the contents of an iterator. <a href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.Extend.html#tymethod.extend">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.extend_one" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/iter/traits/collect.rs.html#417">Source</a><a href="#method.extend_one" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.Extend.html#method.extend_one" class="fn">extend_one</a>(&amp;mut self, item: 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>extend_one</code>)</span></div></span><div class='docblock'>Extends a collection with exactly one element.</div></details><details class="toggle method-toggle" open><summary><section id="method.extend_reserve" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/iter/traits/collect.rs.html#425">Source</a><a href="#method.extend_reserve" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.Extend.html#method.extend_reserve" class="fn">extend_reserve</a>(&amp;mut self, additional: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</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>extend_one</code>)</span></div></span><div class='docblock'>Reserves capacity in a collection for the given number of additional elements. <a href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.Extend.html#method.extend_reserve">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3C%26%5Bu8%5D%3E-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1281-1285">Source</a><a href="#impl-From%3C%26%5Bu8%5D%3E-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;&amp;'a [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]&gt; for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-1" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1282-1284">Source</a><a href="#method.from-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(src: &amp;'a [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]) -&gt; <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3C%26str%3E-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1287-1291">Source</a><a href="#impl-From%3C%26str%3E-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;&amp;'a <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>&gt; for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-2" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1288-1290">Source</a><a href="#method.from-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(src: &amp;'a <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>) -&gt; <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CBytes%3E-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes.rs.html#1026-1046">Source</a><a href="#impl-From%3CBytes%3E-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="struct.Bytes.html" title="struct bytes::Bytes">Bytes</a>&gt; for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></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="../src/bytes/bytes.rs.html#1042-1045">Source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(bytes: <a class="struct" href="struct.Bytes.html" title="struct bytes::Bytes">Bytes</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Convert self into <code>BytesMut</code>.</p>
<p>If <code>bytes</code> is unique for the entire original buffer, this will return a
<code>BytesMut</code> with the contents of <code>bytes</code> without copying.
If <code>bytes</code> is not unique for the entire original buffer, this will make
a copy of <code>bytes</code> subset of the original buffer in a new <code>BytesMut</code>.</p>
<h5 id="examples-144"><a class="doc-anchor" href="#examples-144">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::{Bytes, BytesMut};
<span class="kw">let </span>bytes = Bytes::from(<span class="string">b"hello"</span>.to_vec());
<span class="macro">assert_eq!</span>(BytesMut::from(bytes), BytesMut::from(<span class="kw-2">&amp;</span><span class="string">b"hello"</span>[..]));</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CBytesMut%3E-for-Bytes" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1293-1297">Source</a><a href="#impl-From%3CBytesMut%3E-for-Bytes" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>&gt; for <a class="struct" href="struct.Bytes.html" title="struct bytes::Bytes">Bytes</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-3" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1294-1296">Source</a><a href="#method.from-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(src: <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -&gt; <a class="struct" href="struct.Bytes.html" title="struct bytes::Bytes">Bytes</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CBytesMut%3E-for-Vec%3Cu8%3E" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1731-1764">Source</a><a href="#impl-From%3CBytesMut%3E-for-Vec%3Cu8%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>&gt; for <a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-4" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1732-1763">Source</a><a href="#method.from-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(bytes: <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -&gt; Self</h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-FromIterator%3C%26u8%3E-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1433-1437">Source</a><a href="#impl-FromIterator%3C%26u8%3E-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.FromIterator.html" title="trait core::iter::traits::collect::FromIterator">FromIterator</a>&lt;&amp;'a <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>&gt; for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from_iter-1" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1434-1436">Source</a><a href="#method.from_iter-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.FromIterator.html#tymethod.from_iter" class="fn">from_iter</a>&lt;T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = &amp;'a <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>&gt;&gt;(into_iter: T) -&gt; Self</h4></section></summary><div class='docblock'>Creates a value from an iterator. <a href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.FromIterator.html#tymethod.from_iter">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-FromIterator%3Cu8%3E-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1427-1431">Source</a><a href="#impl-FromIterator%3Cu8%3E-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.FromIterator.html" title="trait core::iter::traits::collect::FromIterator">FromIterator</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>&gt; for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from_iter" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1428-1430">Source</a><a href="#method.from_iter" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.FromIterator.html#tymethod.from_iter" class="fn">from_iter</a>&lt;T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>&gt;&gt;(into_iter: T) -&gt; Self</h4></section></summary><div class='docblock'>Creates a value from an iterator. <a href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.FromIterator.html#tymethod.from_iter">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Hash-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1326-1334">Source</a><a href="#impl-Hash-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></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/bytes/bytes_mut.rs.html#1327-1333">Source</a><a href="#method.hash" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/hash/trait.Hash.html#tymethod.hash" class="fn">hash</a>&lt;H&gt;(&amp;self, state: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut H</a>)<div class="where">where
H: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>,</div></h4></section></summary><div class='docblock'>Feeds this value into the given <a href="https://doc.rust-lang.org/1.93.1/core/hash/trait.Hasher.html" title="trait core::hash::Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/1.93.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.93.1/src/core/hash/mod.rs.html#235-237">Source</a></span><a href="#method.hash_slice" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/hash/trait.Hash.html#method.hash_slice" class="fn">hash_slice</a>&lt;H&gt;(data: &amp;[Self], state: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut H</a>)<div class="where">where
H: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>,
Self: <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/core/hash/trait.Hasher.html" title="trait core::hash::Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/1.93.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-%26BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1380-1387">Source</a><a href="#impl-IntoIterator-for-%26BytesMut" class="anchor">§</a><h3 class="code-header">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a> for &amp;'a <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Item-1" class="associatedtype trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1381">Source</a><a href="#associatedtype.Item-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" class="associatedtype">Item</a> = &amp;'a <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a></h4></section></summary><div class='docblock'>The type of the elements being iterated over.</div></details><details class="toggle" open><summary><section id="associatedtype.IntoIter-1" class="associatedtype trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1382">Source</a><a href="#associatedtype.IntoIter-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" class="associatedtype">IntoIter</a> = <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/slice/iter/struct.Iter.html" title="struct core::slice::iter::Iter">Iter</a>&lt;'a, <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>&gt;</h4></section></summary><div class='docblock'>Which kind of iterator are we turning this into?</div></details><details class="toggle method-toggle" open><summary><section id="method.into_iter-1" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1384-1386">Source</a><a href="#method.into_iter-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter" class="fn">into_iter</a>(self) -&gt; Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.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.93.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-IntoIterator-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1371-1378">Source</a><a href="#impl-IntoIterator-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a> for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Item" class="associatedtype trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1372">Source</a><a href="#associatedtype.Item" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" class="associatedtype">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a></h4></section></summary><div class='docblock'>The type of the elements being iterated over.</div></details><details class="toggle" open><summary><section id="associatedtype.IntoIter" class="associatedtype trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1373">Source</a><a href="#associatedtype.IntoIter" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" class="associatedtype">IntoIter</a> = <a class="struct" href="buf/struct.IntoIter.html" title="struct bytes::buf::IntoIter">IntoIter</a>&lt;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>&gt;</h4></section></summary><div class='docblock'>Which kind of iterator are we turning this into?</div></details><details class="toggle method-toggle" open><summary><section id="method.into_iter" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1375-1377">Source</a><a href="#method.into_iter" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter" class="fn">into_iter</a>(self) -&gt; Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.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.93.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-LowerHex-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/fmt/hex.rs.html#25">Source</a><a href="#impl-LowerHex-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.LowerHex.html" title="trait core::fmt::LowerHex">LowerHex</a> for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt-1" class="method trait-impl"><a class="src rightside" href="../src/bytes/fmt/hex.rs.html#25">Source</a><a href="#method.fmt-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.LowerHex.html#tymethod.fmt" class="fn">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/1.93.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.93.1/core/fmt/trait.LowerHex.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Ord-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1311-1315">Source</a><a href="#impl-Ord-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a> for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.cmp" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1312-1314">Source</a><a href="#method.cmp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html#tymethod.cmp" class="fn">cmp</a>(&amp;self, other: &amp;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></h4></section></summary><div class='docblock'>This method returns an <a href="https://doc.rust-lang.org/1.93.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering"><code>Ordering</code></a> between <code>self</code> and <code>other</code>. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html#tymethod.cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.max" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/cmp.rs.html#1021-1023">Source</a></span><a href="#method.max" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html#method.max" class="fn">max</a>(self, other: Self) -&gt; Self<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Compares and returns the maximum of two values. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html#method.max">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.min" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/cmp.rs.html#1060-1062">Source</a></span><a href="#method.min" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html#method.min" class="fn">min</a>(self, other: Self) -&gt; Self<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Compares and returns the minimum of two values. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html#method.min">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clamp" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.50.0">1.50.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/cmp.rs.html#1086-1088">Source</a></span><a href="#method.clamp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html#method.clamp" class="fn">clamp</a>(self, min: Self, max: Self) -&gt; Self<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Restrict a value to a certain interval. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html#method.clamp">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3C%26T%3E-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1677-1684">Source</a><a href="#impl-PartialEq%3C%26T%3E-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl&lt;'a, T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;'a T</a>&gt; for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a><div class="where">where
<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-9" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1681-1683">Source</a><a href="#method.eq-9" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&amp;self, other: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;'a T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne-9" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#264">Source</a></span><a href="#method.ne-9" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>!=</code>. The default implementation is almost always sufficient,
and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3C%5Bu8%5D%3E-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1581-1585">Source</a><a href="#impl-PartialEq%3C%5Bu8%5D%3E-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]&gt; for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-1" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1582-1584">Source</a><a href="#method.eq-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&amp;self, other: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne-1" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#264">Source</a></span><a href="#method.ne-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>!=</code>. The default implementation is almost always sufficient,
and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3CBytes%3E-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1725-1729">Source</a><a href="#impl-PartialEq%3CBytes%3E-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;<a class="struct" href="struct.Bytes.html" title="struct bytes::Bytes">Bytes</a>&gt; for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-13" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1726-1728">Source</a><a href="#method.eq-13" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&amp;self, other: &amp;<a class="struct" href="struct.Bytes.html" title="struct bytes::Bytes">Bytes</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne-13" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#264">Source</a></span><a href="#method.ne-13" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>!=</code>. The default implementation is almost always sufficient,
and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3CBytesMut%3E-for-%26%5Bu8%5D" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1695-1699">Source</a><a href="#impl-PartialEq%3CBytesMut%3E-for-%26%5Bu8%5D" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>&gt; for &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-10" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1696-1698">Source</a><a href="#method.eq-10" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&amp;self, other: &amp;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne-10" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#264">Source</a></span><a href="#method.ne-10" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>!=</code>. The default implementation is almost always sufficient,
and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3CBytesMut%3E-for-%26str" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1707-1711">Source</a><a href="#impl-PartialEq%3CBytesMut%3E-for-%26str" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>&gt; for &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-11" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1708-1710">Source</a><a href="#method.eq-11" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&amp;self, other: &amp;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne-11" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#264">Source</a></span><a href="#method.ne-11" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>!=</code>. The default implementation is almost always sufficient,
and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3CBytesMut%3E-for-%5Bu8%5D" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1593-1597">Source</a><a href="#impl-PartialEq%3CBytesMut%3E-for-%5Bu8%5D" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>&gt; for [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-2" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1594-1596">Source</a><a href="#method.eq-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&amp;self, other: &amp;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne-2" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#264">Source</a></span><a href="#method.ne-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>!=</code>. The default implementation is almost always sufficient,
and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3CBytesMut%3E-for-Bytes" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1719-1723">Source</a><a href="#impl-PartialEq%3CBytesMut%3E-for-Bytes" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>&gt; for <a class="struct" href="struct.Bytes.html" title="struct bytes::Bytes">Bytes</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-12" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1720-1722">Source</a><a href="#method.eq-12" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&amp;self, other: &amp;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne-12" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#264">Source</a></span><a href="#method.ne-12" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>!=</code>. The default implementation is almost always sufficient,
and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3CBytesMut%3E-for-String" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1665-1669">Source</a><a href="#impl-PartialEq%3CBytesMut%3E-for-String" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>&gt; for <a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-8" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1666-1668">Source</a><a href="#method.eq-8" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&amp;self, other: &amp;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne-8" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#264">Source</a></span><a href="#method.ne-8" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>!=</code>. The default implementation is almost always sufficient,
and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3CBytesMut%3E-for-Vec%3Cu8%3E" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1641-1645">Source</a><a href="#impl-PartialEq%3CBytesMut%3E-for-Vec%3Cu8%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>&gt; for <a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-6" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1642-1644">Source</a><a href="#method.eq-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&amp;self, other: &amp;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne-6" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#264">Source</a></span><a href="#method.ne-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>!=</code>. The default implementation is almost always sufficient,
and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3CBytesMut%3E-for-str" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1617-1621">Source</a><a href="#impl-PartialEq%3CBytesMut%3E-for-str" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>&gt; for <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-4" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1618-1620">Source</a><a href="#method.eq-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&amp;self, other: &amp;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne-4" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#264">Source</a></span><a href="#method.ne-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>!=</code>. The default implementation is almost always sufficient,
and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3CString%3E-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1653-1657">Source</a><a href="#impl-PartialEq%3CString%3E-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt; for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-7" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1654-1656">Source</a><a href="#method.eq-7" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&amp;self, other: &amp;<a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne-7" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#264">Source</a></span><a href="#method.ne-7" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>!=</code>. The default implementation is almost always sufficient,
and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3CVec%3Cu8%3E%3E-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1629-1633">Source</a><a href="#impl-PartialEq%3CVec%3Cu8%3E%3E-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>&gt;&gt; for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-5" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1630-1632">Source</a><a href="#method.eq-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&amp;self, other: &amp;<a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne-5" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#264">Source</a></span><a href="#method.ne-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>!=</code>. The default implementation is almost always sufficient,
and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3Cstr%3E-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1605-1609">Source</a><a href="#impl-PartialEq%3Cstr%3E-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>&gt; for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-3" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1606-1608">Source</a><a href="#method.eq-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&amp;self, other: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne-3" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#264">Source</a></span><a href="#method.ne-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>!=</code>. The default implementation is almost always sufficient,
and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1299-1303">Source</a><a href="#impl-PartialEq-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a> for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></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/bytes/bytes_mut.rs.html#1300-1302">Source</a><a href="#method.eq" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&amp;self, other: &amp;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>.</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">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/cmp.rs.html#264">Source</a></span><a href="#method.ne" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>!=</code>. The default implementation is almost always sufficient,
and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3C%26T%3E-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1686-1693">Source</a><a href="#impl-PartialOrd%3C%26T%3E-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl&lt;'a, T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;'a T</a>&gt; for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a><div class="where">where
<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-9" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1690-1692">Source</a><a href="#method.partial_cmp-9" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&amp;self, other: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;'a T</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>&gt;</h4></section></summary><div class='docblock'>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.lt-9" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1398">Source</a></span><a href="#method.lt-9" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.le-9" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1416">Source</a></span><a href="#method.le-9" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the
<code>&lt;=</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.gt-9" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1434">Source</a></span><a href="#method.gt-9" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;</code>
operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ge-9" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1452">Source</a></span><a href="#method.ge-9" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by
the <code>&gt;=</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3C%5Bu8%5D%3E-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1587-1591">Source</a><a href="#impl-PartialOrd%3C%5Bu8%5D%3E-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>&lt;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]&gt; for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-1" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1588-1590">Source</a><a href="#method.partial_cmp-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&amp;self, other: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>&gt;</h4></section></summary><div class='docblock'>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.lt-1" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1398">Source</a></span><a href="#method.lt-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.le-1" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1416">Source</a></span><a href="#method.le-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the
<code>&lt;=</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.gt-1" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1434">Source</a></span><a href="#method.gt-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;</code>
operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ge-1" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1452">Source</a></span><a href="#method.ge-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by
the <code>&gt;=</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CBytesMut%3E-for-%26%5Bu8%5D" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1701-1705">Source</a><a href="#impl-PartialOrd%3CBytesMut%3E-for-%26%5Bu8%5D" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>&lt;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>&gt; for &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-10" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1702-1704">Source</a><a href="#method.partial_cmp-10" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&amp;self, other: &amp;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>&gt;</h4></section></summary><div class='docblock'>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.lt-10" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1398">Source</a></span><a href="#method.lt-10" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.le-10" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1416">Source</a></span><a href="#method.le-10" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the
<code>&lt;=</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.gt-10" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1434">Source</a></span><a href="#method.gt-10" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;</code>
operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ge-10" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1452">Source</a></span><a href="#method.ge-10" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by
the <code>&gt;=</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CBytesMut%3E-for-%26str" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1713-1717">Source</a><a href="#impl-PartialOrd%3CBytesMut%3E-for-%26str" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>&lt;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>&gt; for &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-11" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1714-1716">Source</a><a href="#method.partial_cmp-11" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&amp;self, other: &amp;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>&gt;</h4></section></summary><div class='docblock'>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.lt-11" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1398">Source</a></span><a href="#method.lt-11" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.le-11" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1416">Source</a></span><a href="#method.le-11" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the
<code>&lt;=</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.gt-11" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1434">Source</a></span><a href="#method.gt-11" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;</code>
operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ge-11" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1452">Source</a></span><a href="#method.ge-11" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by
the <code>&gt;=</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CBytesMut%3E-for-%5Bu8%5D" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1599-1603">Source</a><a href="#impl-PartialOrd%3CBytesMut%3E-for-%5Bu8%5D" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>&lt;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>&gt; for [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-2" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1600-1602">Source</a><a href="#method.partial_cmp-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&amp;self, other: &amp;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>&gt;</h4></section></summary><div class='docblock'>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.lt-2" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1398">Source</a></span><a href="#method.lt-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.le-2" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1416">Source</a></span><a href="#method.le-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the
<code>&lt;=</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.gt-2" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1434">Source</a></span><a href="#method.gt-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;</code>
operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ge-2" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1452">Source</a></span><a href="#method.ge-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by
the <code>&gt;=</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CBytesMut%3E-for-String" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1671-1675">Source</a><a href="#impl-PartialOrd%3CBytesMut%3E-for-String" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>&lt;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>&gt; for <a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-8" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1672-1674">Source</a><a href="#method.partial_cmp-8" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&amp;self, other: &amp;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>&gt;</h4></section></summary><div class='docblock'>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.lt-8" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1398">Source</a></span><a href="#method.lt-8" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.le-8" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1416">Source</a></span><a href="#method.le-8" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the
<code>&lt;=</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.gt-8" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1434">Source</a></span><a href="#method.gt-8" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;</code>
operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ge-8" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1452">Source</a></span><a href="#method.ge-8" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by
the <code>&gt;=</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CBytesMut%3E-for-Vec%3Cu8%3E" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1647-1651">Source</a><a href="#impl-PartialOrd%3CBytesMut%3E-for-Vec%3Cu8%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>&lt;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>&gt; for <a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-6" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1648-1650">Source</a><a href="#method.partial_cmp-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&amp;self, other: &amp;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>&gt;</h4></section></summary><div class='docblock'>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.lt-6" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1398">Source</a></span><a href="#method.lt-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.le-6" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1416">Source</a></span><a href="#method.le-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the
<code>&lt;=</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.gt-6" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1434">Source</a></span><a href="#method.gt-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;</code>
operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ge-6" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1452">Source</a></span><a href="#method.ge-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by
the <code>&gt;=</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CBytesMut%3E-for-str" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1623-1627">Source</a><a href="#impl-PartialOrd%3CBytesMut%3E-for-str" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>&lt;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>&gt; for <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-4" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1624-1626">Source</a><a href="#method.partial_cmp-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&amp;self, other: &amp;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>&gt;</h4></section></summary><div class='docblock'>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.lt-4" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1398">Source</a></span><a href="#method.lt-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.le-4" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1416">Source</a></span><a href="#method.le-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the
<code>&lt;=</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.gt-4" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1434">Source</a></span><a href="#method.gt-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;</code>
operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ge-4" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1452">Source</a></span><a href="#method.ge-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by
the <code>&gt;=</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CString%3E-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1659-1663">Source</a><a href="#impl-PartialOrd%3CString%3E-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt; for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-7" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1660-1662">Source</a><a href="#method.partial_cmp-7" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&amp;self, other: &amp;<a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>&gt;</h4></section></summary><div class='docblock'>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.lt-7" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1398">Source</a></span><a href="#method.lt-7" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.le-7" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1416">Source</a></span><a href="#method.le-7" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the
<code>&lt;=</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.gt-7" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1434">Source</a></span><a href="#method.gt-7" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;</code>
operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ge-7" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1452">Source</a></span><a href="#method.ge-7" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by
the <code>&gt;=</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CVec%3Cu8%3E%3E-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1635-1639">Source</a><a href="#impl-PartialOrd%3CVec%3Cu8%3E%3E-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>&gt;&gt; for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-5" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1636-1638">Source</a><a href="#method.partial_cmp-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&amp;self, other: &amp;<a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>&gt;</h4></section></summary><div class='docblock'>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.lt-5" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1398">Source</a></span><a href="#method.lt-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.le-5" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1416">Source</a></span><a href="#method.le-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the
<code>&lt;=</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.gt-5" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1434">Source</a></span><a href="#method.gt-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;</code>
operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ge-5" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1452">Source</a></span><a href="#method.ge-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by
the <code>&gt;=</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3Cstr%3E-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1611-1615">Source</a><a href="#impl-PartialOrd%3Cstr%3E-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>&gt; for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-3" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1612-1614">Source</a><a href="#method.partial_cmp-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&amp;self, other: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>&gt;</h4></section></summary><div class='docblock'>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.lt-3" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1398">Source</a></span><a href="#method.lt-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.le-3" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1416">Source</a></span><a href="#method.le-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the
<code>&lt;=</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.gt-3" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1434">Source</a></span><a href="#method.gt-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;</code>
operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ge-3" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1452">Source</a></span><a href="#method.ge-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by
the <code>&gt;=</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1305-1309">Source</a><a href="#impl-PartialOrd-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a> for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1306-1308">Source</a><a href="#method.partial_cmp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&amp;self, other: &amp;<a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>&gt;</h4></section></summary><div class='docblock'>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.lt" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1398">Source</a></span><a href="#method.lt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.le" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1416">Source</a></span><a href="#method.le" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the
<code>&lt;=</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.gt" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1434">Source</a></span><a href="#method.gt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;</code>
operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ge" class="method trait-impl"><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.93.1/src/core/cmp.rs.html#1452">Source</a></span><a href="#method.ge" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by
the <code>&gt;=</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-UpperHex-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/fmt/hex.rs.html#27">Source</a><a href="#impl-UpperHex-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.UpperHex.html" title="trait core::fmt::UpperHex">UpperHex</a> for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt-2" class="method trait-impl"><a class="src rightside" href="../src/bytes/fmt/hex.rs.html#27">Source</a><a href="#method.fmt-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.UpperHex.html#tymethod.fmt" class="fn">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/1.93.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.93.1/core/fmt/trait.UpperHex.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Write-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1348-1363">Source</a><a href="#impl-Write-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Write.html" title="trait core::fmt::Write">Write</a> for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.write_str" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1350-1357">Source</a><a href="#method.write_str" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Write.html#tymethod.write_str" class="fn">write_str</a>(&amp;mut self, s: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/1.93.1/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Writes a string slice into this writer, returning whether the write
succeeded. <a href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Write.html#tymethod.write_str">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.write_fmt" class="method trait-impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1360-1362">Source</a><a href="#method.write_fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Write.html#method.write_fmt" class="fn">write_fmt</a>(&amp;mut self, args: <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/fmt/struct.Arguments.html" title="struct core::fmt::Arguments">Arguments</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/1.93.1/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Glue for usage of the <a href="https://doc.rust-lang.org/1.93.1/core/macro.write.html" title="macro core::write"><code>write!</code></a> macro with implementors of this trait. <a href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Write.html#method.write_fmt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.write_char" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.1.0">1.1.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/fmt/mod.rs.html#183">Source</a></span><a href="#method.write_char" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Write.html#method.write_char" class="fn">write_char</a>(&amp;mut self, c: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.char.html">char</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Writes a <a href="https://doc.rust-lang.org/1.93.1/std/primitive.char.html" title="primitive char"><code>char</code></a> into this writer, returning whether the write succeeded. <a href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Write.html#method.write_char">Read more</a></div></details></div></details><section id="impl-Eq-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1317">Source</a><a href="#impl-Eq-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section><section id="impl-Send-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1572">Source</a><a href="#impl-Send-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section><section id="impl-Sync-for-BytesMut" class="impl"><a class="src rightside" href="../src/bytes/bytes_mut.rs.html#1573">Source</a><a href="#impl-Sync-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section></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-BytesMut" class="impl"><a href="#impl-Freeze-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a> for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section><section id="impl-RefUnwindSafe-for-BytesMut" class="impl"><a href="#impl-RefUnwindSafe-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section><section id="impl-Unpin-for-BytesMut" class="impl"><a href="#impl-Unpin-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section><section id="impl-UnwindSafe-for-BytesMut" class="impl"><a href="#impl-UnwindSafe-for-BytesMut" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></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.93.1/src/core/any.rs.html#138">Source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.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.93.1/src/core/any.rs.html#139">Source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.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.93.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.93.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&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.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-1" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/borrow.rs.html#214">Source</a><a href="#method.borrow-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.93.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.93.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&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.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-1" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/borrow.rs.html#222">Source</a><a href="#method.borrow_mut-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.93.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.93.1/src/core/clone.rs.html#547">Source</a><a href="#impl-CloneToUninit-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.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.93.1/src/core/clone.rs.html#549">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.93.1/core/clone/trait.CloneToUninit.html#tymethod.clone_to_uninit" class="fn">clone_to_uninit</a>(&amp;self, dest: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.pointer.html">*mut </a><a class="primitive" href="https://doc.rust-lang.org/1.93.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.93.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-From%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/convert/mod.rs.html#785">Source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-5" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/convert/mod.rs.html#788">Source</a><a href="#method.from-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -&gt; 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-Into%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/convert/mod.rs.html#767-769">Source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,</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.93.1/src/core/convert/mod.rs.html#777">Source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -&gt; 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.93.1/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for U</code> chooses to do.</p>
</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.93.1/src/core/ops/deref.rs.html#378-380">Source</a><a href="#impl-Receiver-for-P" class="anchor">§</a><h3 class="code-header">impl&lt;P, T&gt; <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a>&lt;Target = T&gt; + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.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.93.1/src/core/ops/deref.rs.html#382">Source</a><a href="#associatedtype.Target-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.93.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.93.1/src/alloc/borrow.rs.html#85-87">Source</a><a href="#impl-ToOwned-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.93.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.93.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.93.1/src/alloc/borrow.rs.html#89">Source</a><a href="#associatedtype.Owned" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.93.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.93.1/src/alloc/borrow.rs.html#90">Source</a><a href="#method.to_owned" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fn">to_owned</a>(&amp;self) -&gt; T</h4></section></summary><div class='docblock'>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/1.93.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.93.1/src/alloc/borrow.rs.html#94">Source</a><a href="#method.clone_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fn">clone_into</a>(&amp;self, target: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;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.93.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.93.1/src/core/convert/mod.rs.html#827-829">Source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,</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.93.1/src/core/convert/mod.rs.html#831">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.93.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.93.1/src/core/convert/mod.rs.html#834">Source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;T as <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</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.93.1/src/core/convert/mod.rs.html#811-813">Source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,</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.93.1/src/core/convert/mod.rs.html#815">Source</a><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.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.93.1/src/core/convert/mod.rs.html#818">Source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div><script type="text/json" id="notable-traits-data">{"&[u8]":"<h3>Notable traits for <code>&amp;[<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.93.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.93.1/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &amp;[<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.93.1/std/primitive.u8.html\">u8</a>]</div>","&mut [u8]":"<h3>Notable traits for <code>&amp;mut [<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.93.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.93.1/std/io/trait.Write.html\" title=\"trait std::io::Write\">Write</a> for &amp;mut [<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.93.1/std/primitive.u8.html\">u8</a>]</div>","<[T] as Concat<Item>>::Output":"<h3>Notable traits for <code>&amp;[<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.93.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.93.1/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &amp;[<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.93.1/std/primitive.u8.html\">u8</a>]</div><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html\" title=\"trait std::io::Write\">Write</a> for &amp;mut [<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.93.1/std/primitive.u8.html\">u8</a>]</div>","<[T] as Join<Separator>>::Output":"<h3>Notable traits for <code>&amp;[<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.93.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.93.1/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &amp;[<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.93.1/std/primitive.u8.html\">u8</a>]</div><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html\" title=\"trait std::io::Write\">Write</a> for &amp;mut [<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.93.1/std/primitive.u8.html\">u8</a>]</div>","Reader<Self>":"<h3>Notable traits for <code><a class=\"struct\" href=\"buf/struct.Reader.html\" title=\"struct bytes::buf::Reader\">Reader</a>&lt;B&gt;</code></h3><pre><code><div class=\"where\">impl&lt;B: <a class=\"trait\" href=\"buf/trait.Buf.html\" title=\"trait bytes::buf::Buf\">Buf</a> + <a class=\"trait\" href=\"https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html\" title=\"trait core::marker::Sized\">Sized</a>&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for <a class=\"struct\" href=\"buf/struct.Reader.html\" title=\"struct bytes::buf::Reader\">Reader</a>&lt;B&gt;</div>","Vec<u8>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.93.1/alloc/vec/struct.Vec.html\" title=\"struct alloc::vec::Vec\">Vec</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.93.1/std/primitive.u8.html\">u8</a>, A&gt;</code></h3><pre><code><div class=\"where\">impl&lt;A&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html\" title=\"trait std::io::Write\">Write</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.93.1/alloc/vec/struct.Vec.html\" title=\"struct alloc::vec::Vec\">Vec</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.93.1/std/primitive.u8.html\">u8</a>, A&gt;<div class=\"where\">where\n A: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.93.1/core/alloc/trait.Allocator.html\" title=\"trait core::alloc::Allocator\">Allocator</a>,</div></div>","Writer<Self>":"<h3>Notable traits for <code><a class=\"struct\" href=\"buf/struct.Writer.html\" title=\"struct bytes::buf::Writer\">Writer</a>&lt;B&gt;</code></h3><pre><code><div class=\"where\">impl&lt;B: <a class=\"trait\" href=\"buf/trait.BufMut.html\" title=\"trait bytes::buf::BufMut\">BufMut</a> + <a class=\"trait\" href=\"https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html\" title=\"trait core::marker::Sized\">Sized</a>&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html\" title=\"trait std::io::Write\">Write</a> for <a class=\"struct\" href=\"buf/struct.Writer.html\" title=\"struct bytes::buf::Writer\">Writer</a>&lt;B&gt;</div>"}</script></section></div></main></body></html>