mirror of
https://github.com/loro-dev/loro.git
synced 2025-01-23 13:39:12 +00:00
6311782943
but no cap for now
4608 lines
223 KiB
Text
4608 lines
223 KiB
Text
From: <Saved by Blink>
|
|
Snapshot-Content-Location: https://doc.rust-lang.org/std/pin/index.html
|
|
Subject: std::pin - Rust
|
|
Date: Thu, 6 Jul 2023 12:25:25 -0000
|
|
MIME-Version: 1.0
|
|
Content-Type: multipart/related;
|
|
type="text/html";
|
|
boundary="----MultipartBoundary--ZqvR75rAxxEQH8LkhDBOtalQHLvXQrJ9wZdrptFy8o----"
|
|
|
|
|
|
------MultipartBoundary--ZqvR75rAxxEQH8LkhDBOtalQHLvXQrJ9wZdrptFy8o----
|
|
Content-Type: text/html
|
|
Content-ID: <frame-3617827B7B71C01E52E9CFE593DD4A25@mhtml.blink>
|
|
Content-Transfer-Encoding: quoted-printable
|
|
Content-Location: https://doc.rust-lang.org/std/pin/index.html
|
|
|
|
<!DOCTYPE html><html lang=3D"en"><head><meta http-equiv=3D"Content-Type" co=
|
|
ntent=3D"text/html; charset=3DUTF-8"><link rel=3D"stylesheet" type=3D"text/=
|
|
css" href=3D"cid:css-46202b4e-490d-4575-add2-82f9f93fc7ed@mhtml.blink" /><l=
|
|
ink rel=3D"stylesheet" type=3D"text/css" href=3D"cid:css-6d90d595-da0f-4eb1=
|
|
-bcab-537e583a03bb@mhtml.blink" /><meta name=3D"viewport" content=3D"width=
|
|
=3Ddevice-width, initial-scale=3D1.0"><meta name=3D"generator" content=3D"r=
|
|
ustdoc"><meta name=3D"description" content=3D"Types that pin data to its lo=
|
|
cation in memory."><title>std::pin - Rust</title><link rel=3D"preload" as=
|
|
=3D"font" type=3D"font/woff2" crossorigin=3D"" href=3D"https://doc.rust-lan=
|
|
g.org/static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link r=
|
|
el=3D"preload" as=3D"font" type=3D"font/woff2" crossorigin=3D"" href=3D"htt=
|
|
ps://doc.rust-lang.org/static.files/FiraSans-Regular-018c141bf0843ffd.woff2=
|
|
"><link rel=3D"preload" as=3D"font" type=3D"font/woff2" crossorigin=3D"" hr=
|
|
ef=3D"https://doc.rust-lang.org/static.files/FiraSans-Medium-8f9a781e4970d3=
|
|
88.woff2"><link rel=3D"preload" as=3D"font" type=3D"font/woff2" crossorigin=
|
|
=3D"" href=3D"https://doc.rust-lang.org/static.files/SourceCodePro-Regular-=
|
|
562dcc5011b6de7d.ttf.woff2"><link rel=3D"preload" as=3D"font" type=3D"font/=
|
|
woff2" crossorigin=3D"" href=3D"https://doc.rust-lang.org/static.files/Sour=
|
|
ceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2"><link rel=3D"preload" as=3D"font"=
|
|
type=3D"font/woff2" crossorigin=3D"" href=3D"https://doc.rust-lang.org/sta=
|
|
tic.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel=3D"s=
|
|
tylesheet" href=3D"https://doc.rust-lang.org/static.files/normalize-76eba96=
|
|
aa4d2e634.css"><link rel=3D"stylesheet" href=3D"https://doc.rust-lang.org/s=
|
|
tatic.files/rustdoc-ba5701c5741a7b69.css" id=3D"mainThemeStyle"></head><bod=
|
|
y class=3D"rustdoc mod" data-new-gr-c-s-check-loaded=3D"14.1114.0" data-gr-=
|
|
ext-installed=3D""><div id=3D"rustdoc-vars" data-root-path=3D"../../" data-=
|
|
static-root-path=3D"../../static.files/" data-current-crate=3D"std" data-th=
|
|
emes=3D"" data-resource-suffix=3D"1.70.0" data-rustdoc-version=3D"1.70.0 (9=
|
|
0c541806 2023-05-31)" data-search-js=3D"search-e077946657036a58.js" data-se=
|
|
ttings-js=3D"settings-298e1ea74db45b39.js" data-settings-css=3D"settings-7b=
|
|
fb4c59cc6bc502.css" data-theme-light-css=3D"light-0f8c037637f9eb3e.css" dat=
|
|
a-theme-dark-css=3D"dark-1097f8e92a01e3cf.css" data-theme-ayu-css=3D"ayu-61=
|
|
4652228113ac93.css"></div><link rel=3D"stylesheet" id=3D"themeStyle" href=
|
|
=3D"https://doc.rust-lang.org/static.files/dark-1097f8e92a01e3cf.css"><link=
|
|
rel=3D"alternate icon" type=3D"image/png" href=3D"https://doc.rust-lang.or=
|
|
g/static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel=3D"alternate i=
|
|
con" type=3D"image/png" href=3D"https://doc.rust-lang.org/static.files/favi=
|
|
con-32x32-422f7d1d52889060.png"><link rel=3D"icon" type=3D"image/svg+xml" h=
|
|
ref=3D"https://doc.rust-lang.org/static.files/favicon-2c020d218678b618.svg"=
|
|
><!--[if lte IE 11]><div class=3D"warning">This old browser is unsupported =
|
|
and will most likely display funky things.</div><![endif]--><nav class=3D"m=
|
|
obile-topbar"><button class=3D"sidebar-menu-toggle">=E2=98=B0</button><a cl=
|
|
ass=3D"logo-container" href=3D"https://doc.rust-lang.org/std/index.html"><i=
|
|
mg class=3D"rust-logo" src=3D"https://doc.rust-lang.org/static.files/rust-l=
|
|
ogo-151179464ae7ed46.svg" alt=3D"logo"></a><h2><a href=3D"https://doc.rust-=
|
|
lang.org/std/pin/index.html#">Module pin</a></h2></nav><nav class=3D"sideba=
|
|
r"><a class=3D"logo-container" href=3D"https://doc.rust-lang.org/std/index.=
|
|
html"><img class=3D"rust-logo" src=3D"https://doc.rust-lang.org/static.file=
|
|
s/rust-logo-151179464ae7ed46.svg" alt=3D"logo"></a><h2 class=3D"location"><=
|
|
a href=3D"https://doc.rust-lang.org/std/pin/index.html#">Module pin</a></h2=
|
|
><div class=3D"sidebar-elems"><section><ul class=3D"block"><li><a href=3D"h=
|
|
ttps://doc.rust-lang.org/std/pin/index.html#macros">Macros</a></li><li><a h=
|
|
ref=3D"https://doc.rust-lang.org/std/pin/index.html#structs">Structs</a></l=
|
|
i></ul></section></div></nav><main><div class=3D"width-limiter"><nav class=
|
|
=3D"sub"><form class=3D"search-form"><span></span><input class=3D"search-in=
|
|
put" name=3D"search" aria-label=3D"Run search in the documentation" autocom=
|
|
plete=3D"off" spellcheck=3D"false" placeholder=3D"Click or press =E2=80=98S=
|
|
=E2=80=99 to search, =E2=80=98?=E2=80=99 for more options=E2=80=A6" type=3D=
|
|
"search"><div id=3D"help-button" title=3D"help" tabindex=3D"-1"><a href=3D"=
|
|
https://doc.rust-lang.org/help.html">?</a></div><div id=3D"settings-menu" t=
|
|
abindex=3D"-1"><a href=3D"https://doc.rust-lang.org/settings.html" title=3D=
|
|
"settings"><img width=3D"22" height=3D"22" alt=3D"Change settings" src=3D"h=
|
|
ttps://doc.rust-lang.org/static.files/wheel-7b819b6101059cd0.svg"></a></div=
|
|
></form></nav><section id=3D"main-content" class=3D"content"><div class=3D"=
|
|
main-heading"><h1>Module <a href=3D"https://doc.rust-lang.org/std/index.htm=
|
|
l">std</a>::<wbr><a class=3D"mod" href=3D"https://doc.rust-lang.org/std/pin=
|
|
/index.html#">pin</a><button id=3D"copy-path" title=3D"Copy item path to cl=
|
|
ipboard"><img src=3D"https://doc.rust-lang.org/static.files/clipboard-75710=
|
|
35ce49a181d.svg" width=3D"19" height=3D"18" alt=3D"Copy item path"></button=
|
|
></h1><span class=3D"out-of-band"><span class=3D"since" title=3D"Stable sin=
|
|
ce Rust version 1.33.0"><a class=3D"rse-link" href=3D"https://github.com/ru=
|
|
st-lang/rust/blob/master/RELEASES.md?version=3D1.33.0">1.33.0</a></span> =
|
|
=C2=B7 <a class=3D"srclink" href=3D"https://doc.rust-lang.org/src/core/lib.=
|
|
rs.html#366">source</a> =C2=B7 <button id=3D"toggle-all-docs" title=3D"coll=
|
|
apse all docs">[<span>=E2=88=92</span>]</button></span></div><details class=
|
|
=3D"toggle top-doc" open=3D""><summary class=3D"hideme"><span>Expand descri=
|
|
ption</span></summary><div class=3D"docblock"><p>Types that pin data to its=
|
|
location in memory.</p>
|
|
<p>It is sometimes useful to have objects that are guaranteed not to move,
|
|
in the sense that their placement in memory does not change, and can thus b=
|
|
e relied upon.
|
|
A prime example of such a scenario would be building self-referential struc=
|
|
ts,
|
|
as moving an object with pointers to itself will invalidate them, which cou=
|
|
ld cause undefined
|
|
behavior.</p>
|
|
<p>At a high level, a <code><a href=3D"https://doc.rust-lang.org/std/pin/st=
|
|
ruct.Pin.html" title=3D"struct std::pin::Pin">Pin</a><P></code> ensur=
|
|
es that the pointee of any pointer type
|
|
<code>P</code> has a stable location in memory, meaning it cannot be moved =
|
|
elsewhere
|
|
and its memory cannot be deallocated until it gets dropped. We say that the
|
|
pointee is =E2=80=9Cpinned=E2=80=9D. Things get more subtle when discussing=
|
|
types that
|
|
combine pinned with non-pinned data; <a href=3D"https://doc.rust-lang.org/s=
|
|
td/pin/index.html#projections-and-structural-pinning">see below</a>
|
|
for more details.</p>
|
|
<p>By default, all types in Rust are movable. Rust allows passing all types=
|
|
by-value,
|
|
and common smart-pointer types such as <code><a href=3D"https://doc.rust-la=
|
|
ng.org/std/boxed/struct.Box.html" title=3D"Box">Box</a><T></code> and=
|
|
<code><a href=3D"https://doc.rust-lang.org/std/primitive.reference.html" t=
|
|
itle=3D"mutable reference">&mut</a> T</code> allow
|
|
replacing and moving the values they contain: you can move out of a <code><=
|
|
a href=3D"https://doc.rust-lang.org/std/boxed/struct.Box.html" title=3D"Box=
|
|
">Box</a><T></code>,
|
|
or you can use <a href=3D"https://doc.rust-lang.org/std/mem/fn.swap.html" t=
|
|
itle=3D"mem::swap"><code>mem::swap</code></a>. <code><a href=3D"https://doc=
|
|
.rust-lang.org/std/pin/struct.Pin.html" title=3D"struct std::pin::Pin">Pin<=
|
|
/a><P></code> wraps a pointer type <code>P</code>, so
|
|
<code><a href=3D"https://doc.rust-lang.org/std/pin/struct.Pin.html" title=
|
|
=3D"struct std::pin::Pin">Pin</a><<a href=3D"https://doc.rust-lang.org/s=
|
|
td/boxed/struct.Box.html" title=3D"Box">Box</a><T>></code> functio=
|
|
ns much like a regular <code><a href=3D"https://doc.rust-lang.org/std/boxed=
|
|
/struct.Box.html" title=3D"Box">Box</a><T></code>:
|
|
when a <code><a href=3D"https://doc.rust-lang.org/std/pin/struct.Pin.html" =
|
|
title=3D"struct std::pin::Pin">Pin</a><<a href=3D"https://doc.rust-lang.=
|
|
org/std/boxed/struct.Box.html" title=3D"Box">Box</a><T>></code> ge=
|
|
ts dropped, so do its contents, and the memory gets
|
|
deallocated. Similarly, <code><a href=3D"https://doc.rust-lang.org/std/pin/=
|
|
struct.Pin.html" title=3D"struct std::pin::Pin">Pin</a><<a href=3D"https=
|
|
://doc.rust-lang.org/std/primitive.reference.html" title=3D"mutable referen=
|
|
ce">&mut</a> T></code> is a lot like <code><a href=3D"https://doc.ru=
|
|
st-lang.org/std/primitive.reference.html" title=3D"mutable reference">&=
|
|
mut</a> T</code>.
|
|
However, <code><a href=3D"https://doc.rust-lang.org/std/pin/struct.Pin.html=
|
|
" title=3D"struct std::pin::Pin">Pin</a><P></code> does not let clien=
|
|
ts actually obtain a <code><a href=3D"https://doc.rust-lang.org/std/boxed/s=
|
|
truct.Box.html" title=3D"Box">Box</a><T></code>
|
|
or <code><a href=3D"https://doc.rust-lang.org/std/primitive.reference.html"=
|
|
title=3D"mutable reference">&mut</a> T</code> to pinned data, which im=
|
|
plies that you cannot use operations such
|
|
as <a href=3D"https://doc.rust-lang.org/std/mem/fn.swap.html" title=3D"mem:=
|
|
:swap"><code>mem::swap</code></a>:</p>
|
|
|
|
<div class=3D"example-wrap"><pre class=3D"rust rust-example-rendered"><code=
|
|
><span class=3D"kw">use </span>std::pin::Pin;
|
|
<span class=3D"kw">fn </span>swap_pins<T>(x: Pin<<span class=3D"kw=
|
|
-2">&mut </span>T>, y: Pin<<span class=3D"kw-2">&mut </span>T=
|
|
>) {
|
|
<span class=3D"comment">// `mem::swap` needs `&mut T`, but we canno=
|
|
t get it.
|
|
// We are stuck, we cannot swap the contents of these references.
|
|
// We could use `Pin::get_unchecked_mut`, but that is unsafe for a reas=
|
|
on:
|
|
// we are not allowed to use it for moving things out of the `Pin`.
|
|
</span>}</code></pre><a class=3D"test-arrow" target=3D"_blank" href=3D"http=
|
|
s://play.rust-lang.org/?code=3D%23!%5Ballow(unused)%5D%0Afn+main()+%7B%0Aus=
|
|
e+std::pin::Pin;%0Afn+swap_pins%3CT%3E(x:+Pin%3C%26mut+T%3E,+y:+Pin%3C%26mu=
|
|
t+T%3E)+%7B%0A++++//+%60mem::swap%60+needs+%60%26mut+T%60,+but+we+cannot+ge=
|
|
t+it.%0A++++//+We+are+stuck,+we+cannot+swap+the+contents+of+these+reference=
|
|
s.%0A++++//+We+could+use+%60Pin::get_unchecked_mut%60,+but+that+is+unsafe+f=
|
|
or+a+reason:%0A++++//+we+are+not+allowed+to+use+it+for+moving+things+out+of=
|
|
+the+%60Pin%60.%0A%7D%0A%7D&edition=3D2021">Run</a></div>
|
|
<p>It is worth reiterating that <code><a href=3D"https://doc.rust-lang.org/=
|
|
std/pin/struct.Pin.html" title=3D"struct std::pin::Pin">Pin</a><P></c=
|
|
ode> does <em>not</em> change the fact that a Rust
|
|
compiler considers all types movable. <a href=3D"https://doc.rust-lang.org/=
|
|
std/mem/fn.swap.html" title=3D"mem::swap"><code>mem::swap</code></a> remain=
|
|
s callable for any <code>T</code>. Instead,
|
|
<code><a href=3D"https://doc.rust-lang.org/std/pin/struct.Pin.html" title=
|
|
=3D"struct std::pin::Pin">Pin</a><P></code> prevents certain <em>valu=
|
|
es</em> (pointed to by pointers wrapped in
|
|
<code><a href=3D"https://doc.rust-lang.org/std/pin/struct.Pin.html" title=
|
|
=3D"struct std::pin::Pin">Pin</a><P></code>) from being moved by maki=
|
|
ng it impossible to call methods that require
|
|
<code><a href=3D"https://doc.rust-lang.org/std/primitive.reference.html" ti=
|
|
tle=3D"mutable reference">&mut</a> T</code> on them (like <a href=3D"ht=
|
|
tps://doc.rust-lang.org/std/mem/fn.swap.html" title=3D"mem::swap"><code>mem=
|
|
::swap</code></a>).</p>
|
|
<p><code><a href=3D"https://doc.rust-lang.org/std/pin/struct.Pin.html" titl=
|
|
e=3D"struct std::pin::Pin">Pin</a><P></code> can be used to wrap any =
|
|
pointer type <code>P</code>, and as such it interacts with
|
|
<a href=3D"https://doc.rust-lang.org/std/ops/trait.Deref.html" title=3D"ops=
|
|
::Deref"><code>Deref</code></a> and <a href=3D"https://doc.rust-lang.org/st=
|
|
d/ops/trait.DerefMut.html" title=3D"ops::DerefMut"><code>DerefMut</code></a=
|
|
>. A <code><a href=3D"https://doc.rust-lang.org/std/pin/struct.Pin.html" ti=
|
|
tle=3D"struct std::pin::Pin">Pin</a><P></code> where <code>P: <a href=
|
|
=3D"https://doc.rust-lang.org/std/ops/trait.Deref.html" title=3D"ops::Deref=
|
|
">Deref</a></code> should be
|
|
considered as a =E2=80=9C<code>P</code>-style pointer=E2=80=9D to a pinned =
|
|
<code>P::<a href=3D"https://doc.rust-lang.org/std/ops/trait.Deref.html#asso=
|
|
ciatedtype.Target" title=3D"ops::Deref::Target">Target</a></code> =E2=80=93=
|
|
so, a
|
|
<code><a href=3D"https://doc.rust-lang.org/std/pin/struct.Pin.html" title=
|
|
=3D"struct std::pin::Pin">Pin</a><<a href=3D"https://doc.rust-lang.org/s=
|
|
td/boxed/struct.Box.html" title=3D"Box">Box</a><T>></code> is an o=
|
|
wned pointer to a pinned <code>T</code>, and a
|
|
<code><a href=3D"https://doc.rust-lang.org/std/pin/struct.Pin.html" title=
|
|
=3D"struct std::pin::Pin">Pin</a><<a href=3D"https://doc.rust-lang.org/s=
|
|
td/rc/struct.Rc.html" title=3D"rc::Rc">Rc</a><T>></code> is a refe=
|
|
rence-counted pointer to a pinned <code>T</code>.
|
|
For correctness, <code><a href=3D"https://doc.rust-lang.org/std/pin/struct.=
|
|
Pin.html" title=3D"struct std::pin::Pin">Pin</a><P></code> relies on =
|
|
the implementations of <a href=3D"https://doc.rust-lang.org/std/ops/trait.D=
|
|
eref.html" title=3D"ops::Deref"><code>Deref</code></a> and
|
|
<a href=3D"https://doc.rust-lang.org/std/ops/trait.DerefMut.html" title=3D"=
|
|
ops::DerefMut"><code>DerefMut</code></a> not to move out of their <code>sel=
|
|
f</code> parameter, and only ever to
|
|
return a pointer to pinned data when they are called on a pinned pointer.</=
|
|
p>
|
|
<h2 id=3D"unpin"><a href=3D"https://doc.rust-lang.org/std/pin/index.html#un=
|
|
pin"><code>Unpin</code></a></h2>
|
|
<p>Many types are always freely movable, even when pinned, because they do =
|
|
not
|
|
rely on having a stable address. This includes all the basic types (like
|
|
<a href=3D"https://doc.rust-lang.org/std/primitive.bool.html" title=3D"prim=
|
|
itive bool"><code>bool</code></a>, <a href=3D"https://doc.rust-lang.org/std=
|
|
/primitive.i32.html" title=3D"primitive i32"><code>i32</code></a>, and refe=
|
|
rences) as well as types consisting solely of these
|
|
types. Types that do not care about pinning implement the <a href=3D"https:=
|
|
//doc.rust-lang.org/std/marker/trait.Unpin.html" title=3D"trait std::marker=
|
|
::Unpin"><code>Unpin</code></a>
|
|
auto-trait, which cancels the effect of <code><a href=3D"https://doc.rust-l=
|
|
ang.org/std/pin/struct.Pin.html" title=3D"struct std::pin::Pin">Pin</a><=
|
|
P></code>. For <code>T: <a href=3D"https://doc.rust-lang.org/std/marker/=
|
|
trait.Unpin.html" title=3D"trait std::marker::Unpin">Unpin</a></code>,
|
|
<code><a href=3D"https://doc.rust-lang.org/std/pin/struct.Pin.html" title=
|
|
=3D"struct std::pin::Pin">Pin</a><<a href=3D"https://doc.rust-lang.org/s=
|
|
td/boxed/struct.Box.html" title=3D"Box">Box</a><T>></code> and <co=
|
|
de><a href=3D"https://doc.rust-lang.org/std/boxed/struct.Box.html" title=3D=
|
|
"Box">Box</a><T></code> function identically, as do
|
|
<code><a href=3D"https://doc.rust-lang.org/std/pin/struct.Pin.html" title=
|
|
=3D"struct std::pin::Pin">Pin</a><<a href=3D"https://doc.rust-lang.org/s=
|
|
td/primitive.reference.html" title=3D"mutable reference">&mut</a> T>=
|
|
</code> and <code><a href=3D"https://doc.rust-lang.org/std/primitive.refere=
|
|
nce.html" title=3D"mutable reference">&mut</a> T</code>.</p>
|
|
<p>Note that pinning and <a href=3D"https://doc.rust-lang.org/std/marker/tr=
|
|
ait.Unpin.html" title=3D"trait std::marker::Unpin"><code>Unpin</code></a> o=
|
|
nly affect the pointed-to type <code>P::<a href=3D"https://doc.rust-lang.or=
|
|
g/std/ops/trait.Deref.html#associatedtype.Target" title=3D"ops::Deref::Targ=
|
|
et">Target</a></code>,
|
|
not the pointer type <code>P</code> itself that got wrapped in <code><a hre=
|
|
f=3D"https://doc.rust-lang.org/std/pin/struct.Pin.html" title=3D"struct std=
|
|
::pin::Pin">Pin</a><P></code>. For example,
|
|
whether or not <code><a href=3D"https://doc.rust-lang.org/std/boxed/struct.=
|
|
Box.html" title=3D"Box">Box</a><T></code> is <a href=3D"https://doc.r=
|
|
ust-lang.org/std/marker/trait.Unpin.html" title=3D"trait std::marker::Unpin=
|
|
"><code>Unpin</code></a> has no effect on the behavior of
|
|
<code><a href=3D"https://doc.rust-lang.org/std/pin/struct.Pin.html" title=
|
|
=3D"struct std::pin::Pin">Pin</a><<a href=3D"https://doc.rust-lang.org/s=
|
|
td/boxed/struct.Box.html" title=3D"Box">Box</a><T>></code> (here, =
|
|
<code>T</code> is the pointed-to type).</p>
|
|
<h2 id=3D"example-self-referential-struct"><a href=3D"https://doc.rust-lang=
|
|
.org/std/pin/index.html#example-self-referential-struct">Example: self-refe=
|
|
rential struct</a></h2>
|
|
<p>Before we go into more details to explain the guarantees and choices
|
|
associated with <code><a href=3D"https://doc.rust-lang.org/std/pin/struct.P=
|
|
in.html" title=3D"struct std::pin::Pin">Pin</a><P></code>, we discuss=
|
|
some examples for how it might be used.
|
|
Feel free to <a href=3D"https://doc.rust-lang.org/std/pin/index.html#drop-g=
|
|
uarantee">skip to where the theoretical discussion continues</a>.</p>
|
|
|
|
<div class=3D"example-wrap"><pre class=3D"rust rust-example-rendered"><code=
|
|
><span class=3D"kw">use </span>std::pin::Pin;
|
|
<span class=3D"kw">use </span>std::marker::PhantomPinned;
|
|
<span class=3D"kw">use </span>std::ptr::NonNull;
|
|
|
|
<span class=3D"comment">// This is a self-referential struct because the sl=
|
|
ice field points to the data field.
|
|
// We cannot inform the compiler about that with a normal reference,
|
|
// as this pattern cannot be described with the usual borrowing rules.
|
|
// Instead we use a raw pointer, though one which is known not to be null,
|
|
// as we know it's pointing at the string.
|
|
</span><span class=3D"kw">struct </span>Unmovable {
|
|
data: String,
|
|
slice: NonNull<String>,
|
|
_pin: PhantomPinned,
|
|
}
|
|
|
|
<span class=3D"kw">impl </span>Unmovable {
|
|
<span class=3D"comment">// To ensure the data doesn't move when the fun=
|
|
ction returns,
|
|
// we place it in the heap where it will stay for the lifetime of the o=
|
|
bject,
|
|
// and the only way to access it would be through a pointer to it.
|
|
</span><span class=3D"kw">fn </span>new(data: String) -> Pin<Box&=
|
|
lt;<span class=3D"self">Self</span>>> {
|
|
<span class=3D"kw">let </span>res =3D Unmovable {
|
|
data,
|
|
<span class=3D"comment">// we only create the pointer once the =
|
|
data is in place
|
|
// otherwise it will have already moved before we even started
|
|
</span>slice: NonNull::dangling(),
|
|
_pin: PhantomPinned,
|
|
};
|
|
<span class=3D"kw">let </span><span class=3D"kw-2">mut </span>boxed=
|
|
=3D Box::pin(res);
|
|
|
|
<span class=3D"kw">let </span>slice =3D NonNull::from(<span class=
|
|
=3D"kw-2">&</span>boxed.data);
|
|
<span class=3D"comment">// we know this is safe because modifying a=
|
|
field doesn't move the whole struct
|
|
</span><span class=3D"kw">unsafe </span>{
|
|
<span class=3D"kw">let </span>mut_ref: Pin<<span class=3D"kw=
|
|
-2">&mut </span><span class=3D"self">Self</span>> =3D Pin::as_mut(<s=
|
|
pan class=3D"kw-2">&mut </span>boxed);
|
|
Pin::get_unchecked_mut(mut_ref).slice =3D slice;
|
|
}
|
|
boxed
|
|
}
|
|
}
|
|
|
|
<span class=3D"kw">let </span>unmoved =3D Unmovable::new(<span class=3D"str=
|
|
ing">"hello"</span>.to_string());
|
|
<span class=3D"comment">// The pointer should point to the correct location=
|
|
,
|
|
// so long as the struct hasn't moved.
|
|
// Meanwhile, we are free to move the pointer around.
|
|
</span><span class=3D"kw">let </span><span class=3D"kw-2">mut </span>still_=
|
|
unmoved =3D unmoved;
|
|
<span class=3D"macro">assert_eq!</span>(still_unmoved.slice, NonNull::from(=
|
|
<span class=3D"kw-2">&</span>still_unmoved.data));
|
|
|
|
<span class=3D"comment">// Since our type doesn't implement Unpin, this wil=
|
|
l fail to compile:
|
|
// let mut new_unmoved =3D Unmovable::new("world".to_string());
|
|
// std::mem::swap(&mut *still_unmoved, &mut *new_unmoved);</span></=
|
|
code></pre><a class=3D"test-arrow" target=3D"_blank" href=3D"https://play.r=
|
|
ust-lang.org/?code=3D%23!%5Ballow(unused)%5D%0Afn+main()+%7B%0Ause+std::pin=
|
|
::Pin;%0Ause+std::marker::PhantomPinned;%0Ause+std::ptr::NonNull;%0A%0A//+T=
|
|
his+is+a+self-referential+struct+because+the+slice+field+points+to+the+data=
|
|
+field.%0A//+We+cannot+inform+the+compiler+about+that+with+a+normal+referen=
|
|
ce,%0A//+as+this+pattern+cannot+be+described+with+the+usual+borrowing+rules=
|
|
.%0A//+Instead+we+use+a+raw+pointer,+though+one+which+is+known+not+to+be+nu=
|
|
ll,%0A//+as+we+know+it%27s+pointing+at+the+string.%0Astruct+Unmovable+%7B%0=
|
|
A++++data:+String,%0A++++slice:+NonNull%3CString%3E,%0A++++_pin:+PhantomPin=
|
|
ned,%0A%7D%0A%0Aimpl+Unmovable+%7B%0A++++//+To+ensure+the+data+doesn%27t+mo=
|
|
ve+when+the+function+returns,%0A++++//+we+place+it+in+the+heap+where+it+wil=
|
|
l+stay+for+the+lifetime+of+the+object,%0A++++//+and+the+only+way+to+access+=
|
|
it+would+be+through+a+pointer+to+it.%0A++++fn+new(data:+String)+-%3E+Pin%3C=
|
|
Box%3CSelf%3E%3E+%7B%0A++++++++let+res+=3D+Unmovable+%7B%0A++++++++++++data=
|
|
,%0A++++++++++++//+we+only+create+the+pointer+once+the+data+is+in+place%0A+=
|
|
+++++++++++//+otherwise+it+will+have+already+moved+before+we+even+started%0=
|
|
A++++++++++++slice:+NonNull::dangling(),%0A++++++++++++_pin:+PhantomPinned,=
|
|
%0A++++++++%7D;%0A++++++++let+mut+boxed+=3D+Box::pin(res);%0A%0A++++++++let=
|
|
+slice+=3D+NonNull::from(%26boxed.data);%0A++++++++//+we+know+this+is+safe+=
|
|
because+modifying+a+field+doesn%27t+move+the+whole+struct%0A++++++++unsafe+=
|
|
%7B%0A++++++++++++let+mut_ref:+Pin%3C%26mut+Self%3E+=3D+Pin::as_mut(%26mut+=
|
|
boxed);%0A++++++++++++Pin::get_unchecked_mut(mut_ref).slice+=3D+slice;%0A++=
|
|
++++++%7D%0A++++++++boxed%0A++++%7D%0A%7D%0A%0Alet+unmoved+=3D+Unmovable::n=
|
|
ew(%22hello%22.to_string());%0A//+The+pointer+should+point+to+the+correct+l=
|
|
ocation,%0A//+so+long+as+the+struct+hasn%27t+moved.%0A//+Meanwhile,+we+are+=
|
|
free+to+move+the+pointer+around.%0A%23%5Ballow(unused_mut)%5D%0Alet+mut+sti=
|
|
ll_unmoved+=3D+unmoved;%0Aassert_eq!(still_unmoved.slice,+NonNull::from(%26=
|
|
still_unmoved.data));%0A%0A//+Since+our+type+doesn%27t+implement+Unpin,+thi=
|
|
s+will+fail+to+compile:%0A//+let+mut+new_unmoved+=3D+Unmovable::new(%22worl=
|
|
d%22.to_string());%0A//+std::mem::swap(%26mut+*still_unmoved,+%26mut+*new_u=
|
|
nmoved);%0A%7D&edition=3D2021">Run</a></div>
|
|
<h2 id=3D"example-intrusive-doubly-linked-list"><a href=3D"https://doc.rust=
|
|
-lang.org/std/pin/index.html#example-intrusive-doubly-linked-list">Example:=
|
|
intrusive doubly-linked list</a></h2>
|
|
<p>In an intrusive doubly-linked list, the collection does not actually all=
|
|
ocate
|
|
the memory for the elements itself. Allocation is controlled by the clients=
|
|
,
|
|
and elements can live on a stack frame that lives shorter than the collecti=
|
|
on does.</p>
|
|
<p>To make this work, every element has pointers to its predecessor and suc=
|
|
cessor in
|
|
the list. Elements can only be added when they are pinned, because moving t=
|
|
he elements
|
|
around would invalidate the pointers. Moreover, the <a href=3D"https://doc.=
|
|
rust-lang.org/std/ops/trait.Drop.html" title=3D"trait std::ops::Drop"><code=
|
|
>Drop</code></a> implementation of a linked
|
|
list element will patch the pointers of its predecessor and successor to re=
|
|
move itself
|
|
from the list.</p>
|
|
<p>Crucially, we have to be able to rely on <a href=3D"https://doc.rust-lan=
|
|
g.org/std/ops/trait.Drop.html#tymethod.drop" title=3D"method std::ops::Drop=
|
|
::drop"><code>drop</code></a> being called. If an element
|
|
could be deallocated or otherwise invalidated without calling <a href=3D"ht=
|
|
tps://doc.rust-lang.org/std/ops/trait.Drop.html#tymethod.drop" title=3D"met=
|
|
hod std::ops::Drop::drop"><code>drop</code></a>, the pointers into it
|
|
from its neighboring elements would become invalid, which would break the d=
|
|
ata structure.</p>
|
|
<p>Therefore, pinning also comes with a <a href=3D"https://doc.rust-lang.or=
|
|
g/std/ops/trait.Drop.html#tymethod.drop" title=3D"method std::ops::Drop::dr=
|
|
op"><code>drop</code></a>-related guarantee.</p>
|
|
<h2 id=3D"drop-guarantee"><a href=3D"https://doc.rust-lang.org/std/pin/inde=
|
|
x.html#drop-guarantee"><code>Drop</code> guarantee</a></h2>
|
|
<p>The purpose of pinning is to be able to rely on the placement of some da=
|
|
ta in memory.
|
|
To make this work, not just moving the data is restricted; deallocating, re=
|
|
purposing, or
|
|
otherwise invalidating the memory used to store the data is restricted, too=
|
|
.
|
|
Concretely, for pinned data you have to maintain the invariant
|
|
that <em>its memory will not get invalidated or repurposed from the moment =
|
|
it gets pinned until
|
|
when <a href=3D"https://doc.rust-lang.org/std/ops/trait.Drop.html#tymethod.=
|
|
drop" title=3D"method std::ops::Drop::drop"><code>drop</code></a> is called=
|
|
</em>. Only once <a href=3D"https://doc.rust-lang.org/std/ops/trait.Drop.h=
|
|
tml#tymethod.drop" title=3D"method std::ops::Drop::drop"><code>drop</code><=
|
|
/a> returns or panics, the memory may be reused.</p>
|
|
<p>Memory can be =E2=80=9Cinvalidated=E2=80=9D by deallocation, but also by
|
|
replacing a <code><a href=3D"https://doc.rust-lang.org/std/option/enum.Opti=
|
|
on.html#variant.Some" title=3D"variant std::option::Option::Some">Some</a>(=
|
|
v)</code> by <a href=3D"https://doc.rust-lang.org/std/option/enum.Option.ht=
|
|
ml#variant.None" title=3D"variant std::option::Option::None"><code>None</co=
|
|
de></a>, or calling <a href=3D"https://doc.rust-lang.org/std/vec/struct.Vec=
|
|
.html#method.set_len" title=3D"Vec::set_len"><code>Vec::set_len</code></a> =
|
|
to =E2=80=9Ckill=E2=80=9D some
|
|
elements off of a vector. It can be repurposed by using <a href=3D"https://=
|
|
doc.rust-lang.org/std/ptr/fn.write.html" title=3D"ptr::write"><code>ptr::wr=
|
|
ite</code></a> to overwrite it without
|
|
calling the destructor first. None of this is allowed for pinned data witho=
|
|
ut calling <a href=3D"https://doc.rust-lang.org/std/ops/trait.Drop.html#tym=
|
|
ethod.drop" title=3D"method std::ops::Drop::drop"><code>drop</code></a>.</p=
|
|
>
|
|
<p>This is exactly the kind of guarantee that the intrusive linked list fro=
|
|
m the previous
|
|
section needs to function correctly.</p>
|
|
<p>Notice that this guarantee does <em>not</em> mean that memory does not l=
|
|
eak! It is still
|
|
completely okay to not ever call <a href=3D"https://doc.rust-lang.org/std/o=
|
|
ps/trait.Drop.html#tymethod.drop" title=3D"method std::ops::Drop::drop"><co=
|
|
de>drop</code></a> on a pinned element (e.g., you can still
|
|
call <a href=3D"https://doc.rust-lang.org/std/mem/fn.forget.html" title=3D"=
|
|
mem::forget"><code>mem::forget</code></a> on a <code><a href=3D"https://doc=
|
|
.rust-lang.org/std/pin/struct.Pin.html" title=3D"struct std::pin::Pin">Pin<=
|
|
/a><<a href=3D"https://doc.rust-lang.org/std/boxed/struct.Box.html" titl=
|
|
e=3D"Box">Box</a><T>></code>). In the example of the doubly-linked
|
|
list, that element would just stay in the list. However you must not free o=
|
|
r reuse the storage
|
|
<em>without calling <a href=3D"https://doc.rust-lang.org/std/ops/trait.Drop=
|
|
.html#tymethod.drop" title=3D"method std::ops::Drop::drop"><code>drop</code=
|
|
></a></em>.</p>
|
|
<h2 id=3D"drop-implementation"><a href=3D"https://doc.rust-lang.org/std/pin=
|
|
/index.html#drop-implementation"><code>Drop</code> implementation</a></h2>
|
|
<p>If your type uses pinning (such as the two examples above), you have to =
|
|
be careful
|
|
when implementing <a href=3D"https://doc.rust-lang.org/std/ops/trait.Drop.h=
|
|
tml" title=3D"trait std::ops::Drop"><code>Drop</code></a>. The <a href=3D"h=
|
|
ttps://doc.rust-lang.org/std/ops/trait.Drop.html#tymethod.drop" title=3D"me=
|
|
thod std::ops::Drop::drop"><code>drop</code></a> function takes <code><a hr=
|
|
ef=3D"https://doc.rust-lang.org/std/primitive.reference.html" title=3D"muta=
|
|
ble reference">&mut</a> self</code>, but this
|
|
is called <em>even if your type was previously pinned</em>! It is as if the
|
|
compiler automatically called <a href=3D"https://doc.rust-lang.org/std/pin/=
|
|
struct.Pin.html#method.get_unchecked_mut" title=3D"method std::pin::Pin::ge=
|
|
t_unchecked_mut"><code>Pin::get_unchecked_mut</code></a>.</p>
|
|
<p>This can never cause a problem in safe code because implementing a type =
|
|
that
|
|
relies on pinning requires unsafe code, but be aware that deciding to make
|
|
use of pinning in your type (for example by implementing some operation on
|
|
<code><a href=3D"https://doc.rust-lang.org/std/pin/struct.Pin.html" title=
|
|
=3D"struct std::pin::Pin">Pin</a><<a href=3D"https://doc.rust-lang.org/s=
|
|
td/primitive.reference.html" title=3D"shared reference">&</a>Self></=
|
|
code> or <code><a href=3D"https://doc.rust-lang.org/std/pin/struct.Pin.html=
|
|
" title=3D"struct std::pin::Pin">Pin</a><<a href=3D"https://doc.rust-lan=
|
|
g.org/std/primitive.reference.html" title=3D"mutable reference">&mut</a=
|
|
> Self></code>) has consequences for your
|
|
<a href=3D"https://doc.rust-lang.org/std/ops/trait.Drop.html" title=3D"trai=
|
|
t std::ops::Drop"><code>Drop</code></a> implementation as well: if an eleme=
|
|
nt of your type could have been pinned,
|
|
you must treat <a href=3D"https://doc.rust-lang.org/std/ops/trait.Drop.html=
|
|
" title=3D"trait std::ops::Drop"><code>Drop</code></a> as implicitly taking=
|
|
<code><a href=3D"https://doc.rust-lang.org/std/pin/struct.Pin.html" title=
|
|
=3D"struct std::pin::Pin">Pin</a><<a href=3D"https://doc.rust-lang.org/s=
|
|
td/primitive.reference.html" title=3D"mutable reference">&mut</a> Self&=
|
|
gt;</code>.</p>
|
|
<p>For example, you could implement <a href=3D"https://doc.rust-lang.org/st=
|
|
d/ops/trait.Drop.html" title=3D"trait std::ops::Drop"><code>Drop</code></a>=
|
|
as follows:</p>
|
|
|
|
<div class=3D"example-wrap"><pre class=3D"rust rust-example-rendered"><code=
|
|
><span class=3D"kw">impl </span>Drop <span class=3D"kw">for </span>Type {
|
|
<span class=3D"kw">fn </span>drop(<span class=3D"kw-2">&mut </span>=
|
|
<span class=3D"self">self</span>) {
|
|
<span class=3D"comment">// `new_unchecked` is okay because we know =
|
|
this value is never used
|
|
// again after being dropped.
|
|
</span>inner_drop(<span class=3D"kw">unsafe </span>{ Pin::new_unche=
|
|
cked(<span class=3D"self">self</span>)});
|
|
<span class=3D"kw">fn </span>inner_drop(this: Pin<<span class=3D=
|
|
"kw-2">&mut </span>Type>) {
|
|
<span class=3D"comment">// Actual drop code goes here.
|
|
</span>}
|
|
}
|
|
}</code></pre><a class=3D"test-arrow" target=3D"_blank" href=3D"https://pla=
|
|
y.rust-lang.org/?code=3D%23!%5Ballow(unused)%5D%0Afn+main()+%7B%0Ause+std::=
|
|
pin::Pin;%0Astruct+Type+%7B+%7D%0Aimpl+Drop+for+Type+%7B%0A++++fn+drop(%26m=
|
|
ut+self)+%7B%0A++++++++//+%60new_unchecked%60+is+okay+because+we+know+this+=
|
|
value+is+never+used%0A++++++++//+again+after+being+dropped.%0A++++++++inner=
|
|
_drop(unsafe+%7B+Pin::new_unchecked(self)%7D);%0A++++++++fn+inner_drop(this=
|
|
:+Pin%3C%26mut+Type%3E)+%7B%0A++++++++++++//+Actual+drop+code+goes+here.%0A=
|
|
++++++++%7D%0A++++%7D%0A%7D%0A%7D&edition=3D2021">Run</a></div>
|
|
<p>The function <code>inner_drop</code> has the type that <a href=3D"https:=
|
|
//doc.rust-lang.org/std/ops/trait.Drop.html#tymethod.drop" title=3D"method =
|
|
std::ops::Drop::drop"><code>drop</code></a> <em>should</em> have, so this m=
|
|
akes sure that
|
|
you do not accidentally use <code>self</code>/<code>this</code> in a way th=
|
|
at is in conflict with pinning.</p>
|
|
<p>Moreover, if your type is <code>#[repr(packed)]</code>, the compiler wil=
|
|
l automatically
|
|
move fields around to be able to drop them. It might even do
|
|
that for fields that happen to be sufficiently aligned. As a consequence, y=
|
|
ou cannot use
|
|
pinning with a <code>#[repr(packed)]</code> type.</p>
|
|
<h2 id=3D"projections-and-structural-pinning"><a href=3D"https://doc.rust-l=
|
|
ang.org/std/pin/index.html#projections-and-structural-pinning">Projections =
|
|
and Structural Pinning</a></h2>
|
|
<p>When working with pinned structs, the question arises how one can access=
|
|
the
|
|
fields of that struct in a method that takes just <code><a href=3D"https://=
|
|
doc.rust-lang.org/std/pin/struct.Pin.html" title=3D"struct std::pin::Pin">P=
|
|
in</a><<a href=3D"https://doc.rust-lang.org/std/primitive.reference.html=
|
|
" title=3D"mutable reference">&mut</a> Struct></code>.
|
|
The usual approach is to write helper methods (so called <em>projections</e=
|
|
m>)
|
|
that turn <code><a href=3D"https://doc.rust-lang.org/std/pin/struct.Pin.htm=
|
|
l" title=3D"struct std::pin::Pin">Pin</a><<a href=3D"https://doc.rust-la=
|
|
ng.org/std/primitive.reference.html" title=3D"mutable reference">&mut</=
|
|
a> Struct></code> into a reference to the field, but what type should
|
|
that reference have? Is it <code><a href=3D"https://doc.rust-lang.org/std/p=
|
|
in/struct.Pin.html" title=3D"struct std::pin::Pin">Pin</a><<a href=3D"ht=
|
|
tps://doc.rust-lang.org/std/primitive.reference.html" title=3D"mutable refe=
|
|
rence">&mut</a> Field></code> or <code><a href=3D"https://doc.rust-l=
|
|
ang.org/std/primitive.reference.html" title=3D"mutable reference">&mut<=
|
|
/a> Field</code>?
|
|
The same question arises with the fields of an <code>enum</code>, and also =
|
|
when considering
|
|
container/wrapper types such as <code><a href=3D"https://doc.rust-lang.org/=
|
|
std/vec/struct.Vec.html" title=3D"Vec">Vec</a><T></code>, <code><a hr=
|
|
ef=3D"https://doc.rust-lang.org/std/boxed/struct.Box.html" title=3D"Box">Bo=
|
|
x</a><T></code>,
|
|
or <code><a href=3D"https://doc.rust-lang.org/std/cell/struct.RefCell.html"=
|
|
title=3D"cell::RefCell">RefCell</a><T></code>. (This question applie=
|
|
s to both mutable and shared references,
|
|
we just use the more common case of mutable references here for illustratio=
|
|
n.)</p>
|
|
<p>It turns out that it is actually up to the author of the data structure =
|
|
to decide whether
|
|
the pinned projection for a particular field turns <code><a href=3D"https:/=
|
|
/doc.rust-lang.org/std/pin/struct.Pin.html" title=3D"struct std::pin::Pin">=
|
|
Pin</a><<a href=3D"https://doc.rust-lang.org/std/primitive.reference.htm=
|
|
l" title=3D"mutable reference">&mut</a> Struct></code>
|
|
into <code><a href=3D"https://doc.rust-lang.org/std/pin/struct.Pin.html" ti=
|
|
tle=3D"struct std::pin::Pin">Pin</a><<a href=3D"https://doc.rust-lang.or=
|
|
g/std/primitive.reference.html" title=3D"mutable reference">&mut</a> Fi=
|
|
eld></code> or <code><a href=3D"https://doc.rust-lang.org/std/primitive.=
|
|
reference.html" title=3D"mutable reference">&mut</a> Field</code>. Ther=
|
|
e are some
|
|
constraints though, and the most important constraint is <em>consistency</e=
|
|
m>:
|
|
every field can be <em>either</em> projected to a pinned reference, <em>or<=
|
|
/em> have
|
|
pinning removed as part of the projection. If both are done for the same fi=
|
|
eld,
|
|
that will likely be unsound!</p>
|
|
<p>As the author of a data structure you get to decide for each field wheth=
|
|
er pinning
|
|
=E2=80=9Cpropagates=E2=80=9D to this field or not. Pinning that propagates =
|
|
is also called =E2=80=9Cstructural=E2=80=9D,
|
|
because it follows the structure of the type.
|
|
In the following subsections, we describe the considerations that have to b=
|
|
e made
|
|
for either choice.</p>
|
|
<h3 id=3D"pinning-is-not-structural-for-field"><a href=3D"https://doc.rust-=
|
|
lang.org/std/pin/index.html#pinning-is-not-structural-for-field">Pinning <e=
|
|
m>is not</em> structural for <code>field</code></a></h3>
|
|
<p>It may seem counter-intuitive that the field of a pinned struct might no=
|
|
t be pinned,
|
|
but that is actually the easiest choice: if a <code><a href=3D"https://doc.=
|
|
rust-lang.org/std/pin/struct.Pin.html" title=3D"struct std::pin::Pin">Pin</=
|
|
a><<a href=3D"https://doc.rust-lang.org/std/primitive.reference.html" ti=
|
|
tle=3D"mutable reference">&mut</a> Field></code> is never created,
|
|
nothing can go wrong! So, if you decide that some field does not have struc=
|
|
tural pinning,
|
|
all you have to ensure is that you never create a pinned reference to that =
|
|
field.</p>
|
|
<p>Fields without structural pinning may have a projection method that turn=
|
|
s
|
|
<code><a href=3D"https://doc.rust-lang.org/std/pin/struct.Pin.html" title=
|
|
=3D"struct std::pin::Pin">Pin</a><<a href=3D"https://doc.rust-lang.org/s=
|
|
td/primitive.reference.html" title=3D"mutable reference">&mut</a> Struc=
|
|
t></code> into <code><a href=3D"https://doc.rust-lang.org/std/primitive.=
|
|
reference.html" title=3D"mutable reference">&mut</a> Field</code>:</p>
|
|
|
|
<div class=3D"example-wrap"><pre class=3D"rust rust-example-rendered"><code=
|
|
><span class=3D"kw">impl </span>Struct {
|
|
<span class=3D"kw">fn </span>pin_get_field(<span class=3D"self">self</s=
|
|
pan>: Pin<<span class=3D"kw-2">&mut </span><span class=3D"self">Self=
|
|
</span>>) -> <span class=3D"kw-2">&mut </span>Field {
|
|
<span class=3D"comment">// This is okay because `field` is never co=
|
|
nsidered pinned.
|
|
</span><span class=3D"kw">unsafe </span>{ <span class=3D"kw-2">&=
|
|
;mut </span><span class=3D"self">self</span>.get_unchecked_mut().field }
|
|
}
|
|
}</code></pre><a class=3D"test-arrow" target=3D"_blank" href=3D"https://pla=
|
|
y.rust-lang.org/?code=3D%23!%5Ballow(unused)%5D%0Afn+main()+%7B%0Ause+std::=
|
|
pin::Pin;%0Atype+Field+=3D+i32;%0Astruct+Struct+%7B+field:+Field+%7D%0Aimpl=
|
|
+Struct+%7B%0A++++fn+pin_get_field(self:+Pin%3C%26mut+Self%3E)+-%3E+%26mut+=
|
|
Field+%7B%0A++++++++//+This+is+okay+because+%60field%60+is+never+considered=
|
|
+pinned.%0A++++++++unsafe+%7B+%26mut+self.get_unchecked_mut().field+%7D%0A+=
|
|
+++%7D%0A%7D%0A%7D&edition=3D2021">Run</a></div>
|
|
<p>You may also <code>impl <a href=3D"https://doc.rust-lang.org/std/marker/=
|
|
trait.Unpin.html" title=3D"trait std::marker::Unpin">Unpin</a> for Struct</=
|
|
code> <em>even if</em> the type of <code>field</code>
|
|
is not <a href=3D"https://doc.rust-lang.org/std/marker/trait.Unpin.html" ti=
|
|
tle=3D"trait std::marker::Unpin"><code>Unpin</code></a>. What that type thi=
|
|
nks about pinning is not relevant
|
|
when no <code><a href=3D"https://doc.rust-lang.org/std/pin/struct.Pin.html"=
|
|
title=3D"struct std::pin::Pin">Pin</a><<a href=3D"https://doc.rust-lang=
|
|
.org/std/primitive.reference.html" title=3D"mutable reference">&mut</a>=
|
|
Field></code> is ever created.</p>
|
|
<h3 id=3D"pinning-is-structural-for-field"><a href=3D"https://doc.rust-lang=
|
|
.org/std/pin/index.html#pinning-is-structural-for-field">Pinning <em>is</em=
|
|
> structural for <code>field</code></a></h3>
|
|
<p>The other option is to decide that pinning is =E2=80=9Cstructural=E2=80=
|
|
=9D for <code>field</code>,
|
|
meaning that if the struct is pinned then so is the field.</p>
|
|
<p>This allows writing a projection that creates a <code><a href=3D"https:/=
|
|
/doc.rust-lang.org/std/pin/struct.Pin.html" title=3D"struct std::pin::Pin">=
|
|
Pin</a><<a href=3D"https://doc.rust-lang.org/std/primitive.reference.htm=
|
|
l" title=3D"mutable reference">&mut</a> Field></code>, thus
|
|
witnessing that the field is pinned:</p>
|
|
|
|
<div class=3D"example-wrap"><pre class=3D"rust rust-example-rendered"><code=
|
|
><span class=3D"kw">impl </span>Struct {
|
|
<span class=3D"kw">fn </span>pin_get_field(<span class=3D"self">self</s=
|
|
pan>: Pin<<span class=3D"kw-2">&mut </span><span class=3D"self">Self=
|
|
</span>>) -> Pin<<span class=3D"kw-2">&mut </span>Field> {
|
|
<span class=3D"comment">// This is okay because `field` is pinned w=
|
|
hen `self` is.
|
|
</span><span class=3D"kw">unsafe </span>{ <span class=3D"self">self=
|
|
</span>.map_unchecked_mut(|s| <span class=3D"kw-2">&mut </span>s.field)=
|
|
}
|
|
}
|
|
}</code></pre><a class=3D"test-arrow" target=3D"_blank" href=3D"https://pla=
|
|
y.rust-lang.org/?code=3D%23!%5Ballow(unused)%5D%0Afn+main()+%7B%0Ause+std::=
|
|
pin::Pin;%0Atype+Field+=3D+i32;%0Astruct+Struct+%7B+field:+Field+%7D%0Aimpl=
|
|
+Struct+%7B%0A++++fn+pin_get_field(self:+Pin%3C%26mut+Self%3E)+-%3E+Pin%3C%=
|
|
26mut+Field%3E+%7B%0A++++++++//+This+is+okay+because+%60field%60+is+pinned+=
|
|
when+%60self%60+is.%0A++++++++unsafe+%7B+self.map_unchecked_mut(%7Cs%7C+%26=
|
|
mut+s.field)+%7D%0A++++%7D%0A%7D%0A%7D&edition=3D2021">Run</a></div>
|
|
<p>However, structural pinning comes with a few extra requirements:</p>
|
|
<ol>
|
|
<li>
|
|
<p>The struct must only be <a href=3D"https://doc.rust-lang.org/std/marker/=
|
|
trait.Unpin.html" title=3D"trait std::marker::Unpin"><code>Unpin</code></a>=
|
|
if all the structural fields are
|
|
<a href=3D"https://doc.rust-lang.org/std/marker/trait.Unpin.html" title=3D"=
|
|
trait std::marker::Unpin"><code>Unpin</code></a>. This is the default, but =
|
|
<a href=3D"https://doc.rust-lang.org/std/marker/trait.Unpin.html" title=3D"=
|
|
trait std::marker::Unpin"><code>Unpin</code></a> is a safe trait, so as the=
|
|
author of
|
|
the struct it is your responsibility <em>not</em> to add something like
|
|
<code>impl<T> <a href=3D"https://doc.rust-lang.org/std/marker/trait.U=
|
|
npin.html" title=3D"trait std::marker::Unpin">Unpin</a> for Struct<T>=
|
|
</code>. (Notice that adding a projection operation
|
|
requires unsafe code, so the fact that <a href=3D"https://doc.rust-lang.org=
|
|
/std/marker/trait.Unpin.html" title=3D"trait std::marker::Unpin"><code>Unpi=
|
|
n</code></a> is a safe trait does not break
|
|
the principle that you only have to worry about any of this if you use <a h=
|
|
ref=3D"https://doc.rust-lang.org/std/keyword.unsafe.html" title=3D"keyword =
|
|
unsafe"><code>unsafe</code></a>.)</p>
|
|
</li>
|
|
<li>
|
|
<p>The destructor of the struct must not move structural fields out of its =
|
|
argument. This
|
|
is the exact point that was raised in the <a href=3D"https://doc.rust-lang.=
|
|
org/std/pin/index.html#drop-implementation">previous section</a>: <a href=
|
|
=3D"https://doc.rust-lang.org/std/ops/trait.Drop.html#tymethod.drop" title=
|
|
=3D"method std::ops::Drop::drop"><code>drop</code></a> takes
|
|
<code><a href=3D"https://doc.rust-lang.org/std/primitive.reference.html" ti=
|
|
tle=3D"mutable reference">&mut</a> self</code>, but the struct (and hen=
|
|
ce its fields) might have been pinned
|
|
before. You have to guarantee that you do not move a field inside your <a h=
|
|
ref=3D"https://doc.rust-lang.org/std/ops/trait.Drop.html" title=3D"trait st=
|
|
d::ops::Drop"><code>Drop</code></a>
|
|
implementation. In particular, as explained previously, this means that you=
|
|
r struct
|
|
must <em>not</em> be <code>#[repr(packed)]</code>.
|
|
See that section for how to write <a href=3D"https://doc.rust-lang.org/std/=
|
|
ops/trait.Drop.html#tymethod.drop" title=3D"method std::ops::Drop::drop"><c=
|
|
ode>drop</code></a> in a way that the compiler can help you
|
|
not accidentally break pinning.</p>
|
|
</li>
|
|
<li>
|
|
<p>You must make sure that you uphold the <a href=3D"https://doc.rust-lang.=
|
|
org/std/pin/index.html#drop-guarantee"><code>Drop</code> guarantee</a>:
|
|
once your struct is pinned, the memory that contains the
|
|
content is not overwritten or deallocated without calling the content=E2=80=
|
|
=99s destructors.
|
|
This can be tricky, as witnessed by <code><a href=3D"https://doc.rust-lang.=
|
|
org/std/collections/struct.VecDeque.html" title=3D"collections::VecDeque">V=
|
|
ecDeque</a><T></code>: the destructor of
|
|
<code><a href=3D"https://doc.rust-lang.org/std/collections/struct.VecDeque.=
|
|
html" title=3D"collections::VecDeque">VecDeque</a><T></code> can fail=
|
|
to call <a href=3D"https://doc.rust-lang.org/std/ops/trait.Drop.html#tymet=
|
|
hod.drop" title=3D"method std::ops::Drop::drop"><code>drop</code></a> on al=
|
|
l elements if one of the
|
|
destructors panics. This violates the <a href=3D"https://doc.rust-lang.org/=
|
|
std/ops/trait.Drop.html" title=3D"trait std::ops::Drop"><code>Drop</code></=
|
|
a> guarantee, because it can lead to
|
|
elements being deallocated without their destructor being called.
|
|
(<code><a href=3D"https://doc.rust-lang.org/std/collections/struct.VecDeque=
|
|
.html" title=3D"collections::VecDeque">VecDeque</a><T></code> has no =
|
|
pinning projections, so this
|
|
does not cause unsoundness.)</p>
|
|
</li>
|
|
<li>
|
|
<p>You must not offer any other operations that could lead to data being mo=
|
|
ved out of
|
|
the structural fields when your type is pinned. For example, if the struct =
|
|
contains an
|
|
<code><a href=3D"https://doc.rust-lang.org/std/option/enum.Option.html" tit=
|
|
le=3D"enum std::option::Option">Option</a><T></code> and there is a <=
|
|
a href=3D"https://doc.rust-lang.org/std/option/enum.Option.html#method.take=
|
|
" title=3D"method std::option::Option::take"><code>take</code></a>-like ope=
|
|
ration with type
|
|
<code>fn(<a href=3D"https://doc.rust-lang.org/std/pin/struct.Pin.html" titl=
|
|
e=3D"struct std::pin::Pin">Pin</a><<a href=3D"https://doc.rust-lang.org/=
|
|
std/primitive.reference.html" title=3D"mutable reference">&mut</a> Stru=
|
|
ct<T>>) -> <a href=3D"https://doc.rust-lang.org/std/option/enum=
|
|
.Option.html" title=3D"enum std::option::Option">Option</a><T></code>=
|
|
,
|
|
that operation can be used to move a <code>T</code> out of a pinned <code>S=
|
|
truct<T></code> =E2=80=93 which means
|
|
pinning cannot be structural for the field holding this data.</p>
|
|
<p>For a more complex example of moving data out of a pinned type,
|
|
imagine if <code><a href=3D"https://doc.rust-lang.org/std/cell/struct.RefCe=
|
|
ll.html" title=3D"cell::RefCell">RefCell</a><T></code> had a method
|
|
<code>fn get_pin_mut(self: <a href=3D"https://doc.rust-lang.org/std/pin/str=
|
|
uct.Pin.html" title=3D"struct std::pin::Pin">Pin</a><<a href=3D"https://=
|
|
doc.rust-lang.org/std/primitive.reference.html" title=3D"mutable reference"=
|
|
>&mut</a> Self>) -> <a href=3D"https://doc.rust-lang.org/std/pin/=
|
|
struct.Pin.html" title=3D"struct std::pin::Pin">Pin</a><<a href=3D"https=
|
|
://doc.rust-lang.org/std/primitive.reference.html" title=3D"mutable referen=
|
|
ce">&mut</a> T></code>.
|
|
Then we could do the following:</p>
|
|
|
|
<div class=3D"example-wrap compile_fail"><a href=3D"https://doc.rust-lang.o=
|
|
rg/std/pin/index.html#" class=3D"tooltip" title=3D"This example deliberatel=
|
|
y fails to compile">=E2=93=98</a><pre class=3D"rust rust-example-rendered">=
|
|
<code><span class=3D"kw">fn </span>exploit_ref_cell<T>(rc: Pin<<sp=
|
|
an class=3D"kw-2">&mut </span>RefCell<T>>) {
|
|
{ <span class=3D"kw">let </span>p =3D rc.as_mut().get_pin_mut(); } <spa=
|
|
n class=3D"comment">// Here we get pinned access to the `T`.
|
|
</span><span class=3D"kw">let </span>rc_shr: <span class=3D"kw-2">&=
|
|
</span>RefCell<T> =3D rc.into_ref().get_ref();
|
|
<span class=3D"kw">let </span>b =3D rc_shr.borrow_mut();
|
|
<span class=3D"kw">let </span>content =3D <span class=3D"kw-2">&mut=
|
|
*</span>b; <span class=3D"comment">// And here we have `&mut T` to the=
|
|
same data.
|
|
</span>}</code></pre><a class=3D"test-arrow" target=3D"_blank" href=3D"http=
|
|
s://play.rust-lang.org/?code=3D%23!%5Ballow(unused)%5D%0Afn+main()+%7B%0Afn=
|
|
+exploit_ref_cell%3CT%3E(rc:+Pin%3C%26mut+RefCell%3CT%3E%3E)+%7B%0A++++%7B+=
|
|
let+p+=3D+rc.as_mut().get_pin_mut();+%7D+//+Here+we+get+pinned+access+to+th=
|
|
e+%60T%60.%0A++++let+rc_shr:+%26RefCell%3CT%3E+=3D+rc.into_ref().get_ref();=
|
|
%0A++++let+b+=3D+rc_shr.borrow_mut();%0A++++let+content+=3D+%26mut+*b;+//+A=
|
|
nd+here+we+have+%60%26mut+T%60+to+the+same+data.%0A%7D%0A%7D&edition=3D=
|
|
2021">Run</a></div>
|
|
<p>This is catastrophic, it means we can first pin the content of the
|
|
<code><a href=3D"https://doc.rust-lang.org/std/cell/struct.RefCell.html" ti=
|
|
tle=3D"cell::RefCell">RefCell</a><T></code> (using <code><a href=3D"h=
|
|
ttps://doc.rust-lang.org/std/cell/struct.RefCell.html" title=3D"cell::RefCe=
|
|
ll">RefCell</a>::get_pin_mut</code>) and then move that
|
|
content using the mutable reference we got later.</p>
|
|
</li>
|
|
</ol>
|
|
<h3 id=3D"examples"><a href=3D"https://doc.rust-lang.org/std/pin/index.html=
|
|
#examples">Examples</a></h3>
|
|
<p>For a type like <code><a href=3D"https://doc.rust-lang.org/std/vec/struc=
|
|
t.Vec.html" title=3D"Vec">Vec</a><T></code>, both possibilities (stru=
|
|
ctural pinning or not) make
|
|
sense. A <code><a href=3D"https://doc.rust-lang.org/std/vec/struct.Vec.html=
|
|
" title=3D"Vec">Vec</a><T></code> with structural pinning could have =
|
|
<code>get_pin</code>/<code>get_pin_mut</code>
|
|
methods to get pinned references to elements. However, it could <em>not</em=
|
|
> allow calling
|
|
<a href=3D"https://doc.rust-lang.org/std/vec/struct.Vec.html#method.pop" ti=
|
|
tle=3D"Vec::pop"><code>pop</code></a> on a pinned <code><a href=3D"https://=
|
|
doc.rust-lang.org/std/vec/struct.Vec.html" title=3D"Vec">Vec</a><T></=
|
|
code> because that would move the (structurally
|
|
pinned) contents! Nor could it allow <a href=3D"https://doc.rust-lang.org/s=
|
|
td/vec/struct.Vec.html#method.push" title=3D"Vec::push"><code>push</code></=
|
|
a>, which might reallocate and thus also
|
|
move the contents.</p>
|
|
<p>A <code><a href=3D"https://doc.rust-lang.org/std/vec/struct.Vec.html" ti=
|
|
tle=3D"Vec">Vec</a><T></code> without structural pinning could
|
|
<code>impl<T> <a href=3D"https://doc.rust-lang.org/std/marker/trait.U=
|
|
npin.html" title=3D"trait std::marker::Unpin">Unpin</a> for <a href=3D"http=
|
|
s://doc.rust-lang.org/std/vec/struct.Vec.html" title=3D"Vec">Vec</a><T&g=
|
|
t;</code>, because the contents are never pinned
|
|
and the <code><a href=3D"https://doc.rust-lang.org/std/vec/struct.Vec.html"=
|
|
title=3D"Vec">Vec</a><T></code> itself is fine with being moved as w=
|
|
ell.
|
|
At that point pinning just has no effect on the vector at all.</p>
|
|
<p>In the standard library, pointer types generally do not have structural =
|
|
pinning,
|
|
and thus they do not offer pinning projections. This is why <code><a href=
|
|
=3D"https://doc.rust-lang.org/std/boxed/struct.Box.html" title=3D"Box">Box<=
|
|
/a><T>: <a href=3D"https://doc.rust-lang.org/std/marker/trait.Unpin.h=
|
|
tml" title=3D"trait std::marker::Unpin">Unpin</a></code>
|
|
holds for all <code>T</code>. It makes sense to do this for pointer types, =
|
|
because moving the
|
|
<code><a href=3D"https://doc.rust-lang.org/std/boxed/struct.Box.html" title=
|
|
=3D"Box">Box</a><T></code> does not actually move the <code>T</code>:=
|
|
the <code><a href=3D"https://doc.rust-lang.org/std/boxed/struct.Box.html" =
|
|
title=3D"Box">Box</a><T></code> can be freely
|
|
movable (aka <a href=3D"https://doc.rust-lang.org/std/marker/trait.Unpin.ht=
|
|
ml" title=3D"trait std::marker::Unpin"><code>Unpin</code></a>) even if the =
|
|
<code>T</code> is not. In fact, even <code><a href=3D"https://doc.rust-lang=
|
|
.org/std/pin/struct.Pin.html" title=3D"struct std::pin::Pin">Pin</a><<a =
|
|
href=3D"https://doc.rust-lang.org/std/boxed/struct.Box.html" title=3D"Box">=
|
|
Box</a><T>></code> and
|
|
<code><a href=3D"https://doc.rust-lang.org/std/pin/struct.Pin.html" title=
|
|
=3D"struct std::pin::Pin">Pin</a><<a href=3D"https://doc.rust-lang.org/s=
|
|
td/primitive.reference.html" title=3D"mutable reference">&mut</a> T>=
|
|
</code> are always <a href=3D"https://doc.rust-lang.org/std/marker/trait.Un=
|
|
pin.html" title=3D"trait std::marker::Unpin"><code>Unpin</code></a> themsel=
|
|
ves, for the same reason:
|
|
their contents (the <code>T</code>) are pinned, but the pointers themselves=
|
|
can be moved without moving
|
|
the pinned data. For both <code><a href=3D"https://doc.rust-lang.org/std/bo=
|
|
xed/struct.Box.html" title=3D"Box">Box</a><T></code> and <code><a hre=
|
|
f=3D"https://doc.rust-lang.org/std/pin/struct.Pin.html" title=3D"struct std=
|
|
::pin::Pin">Pin</a><<a href=3D"https://doc.rust-lang.org/std/boxed/struc=
|
|
t.Box.html" title=3D"Box">Box</a><T>></code>,
|
|
whether the content is pinned is entirely independent of whether the
|
|
pointer is pinned, meaning pinning is <em>not</em> structural.</p>
|
|
<p>When implementing a <a href=3D"https://doc.rust-lang.org/std/future/trai=
|
|
t.Future.html" title=3D"future::Future"><code>Future</code></a> combinator,=
|
|
you will usually need structural pinning
|
|
for the nested futures, as you need to get pinned references to them to cal=
|
|
l <a href=3D"https://doc.rust-lang.org/std/future/trait.Future.html#tymetho=
|
|
d.poll" title=3D"future::Future::poll"><code>poll</code></a>.
|
|
But if your combinator contains any other data that does not need to be pin=
|
|
ned,
|
|
you can make those fields not structural and hence freely access them with =
|
|
a
|
|
mutable reference even when you just have <code><a href=3D"https://doc.rust=
|
|
-lang.org/std/pin/struct.Pin.html" title=3D"struct std::pin::Pin">Pin</a>&l=
|
|
t;<a href=3D"https://doc.rust-lang.org/std/primitive.reference.html" title=
|
|
=3D"mutable reference">&mut</a> Self></code> (such as in your own
|
|
<a href=3D"https://doc.rust-lang.org/std/future/trait.Future.html#tymethod.=
|
|
poll" title=3D"future::Future::poll"><code>poll</code></a> implementation).=
|
|
</p>
|
|
</div></details><h2 id=3D"macros" class=3D"small-section-header"><a href=3D=
|
|
"https://doc.rust-lang.org/std/pin/index.html#macros">Macros</a></h2><ul cl=
|
|
ass=3D"item-table"><li><div class=3D"item-name"><a class=3D"macro" href=3D"=
|
|
https://doc.rust-lang.org/std/pin/macro.pin.html" title=3D"macro std::pin::=
|
|
pin">pin</a></div><div class=3D"desc docblock-short">Constructs a <code><a =
|
|
href=3D"https://doc.rust-lang.org/std/pin/struct.Pin.html" title=3D"struct =
|
|
std::pin::Pin">Pin</a><<a href=3D"https://doc.rust-lang.org/std/primitiv=
|
|
e.reference.html" title=3D"primitive reference">&mut</a> T></code>, =
|
|
by pinning a <code>value: T</code> locally.</div></li></ul><h2 id=3D"struct=
|
|
s" class=3D"small-section-header"><a href=3D"https://doc.rust-lang.org/std/=
|
|
pin/index.html#structs">Structs</a></h2><ul class=3D"item-table"><li><div c=
|
|
lass=3D"item-name"><a class=3D"struct" href=3D"https://doc.rust-lang.org/st=
|
|
d/pin/struct.Pin.html" title=3D"struct std::pin::Pin">Pin</a></div><div cla=
|
|
ss=3D"desc docblock-short">A pinned pointer.</div></li></ul></section></div=
|
|
></main></body><scispace-div id=3D"scispace-extension-root"><template shado=
|
|
wmode=3D"open"> <div class=3D"container"><div id=3D"scispace-extension-app=
|
|
-root"><div class=3D"box-border h-full w-full"></div></div></div></template=
|
|
></scispace-div><grammarly-desktop-integration data-grammarly-shadow-root=
|
|
=3D"true"><template shadowmode=3D"open"><div aria-label=3D"grammarly-integr=
|
|
ation" role=3D"group" tabindex=3D"-1" class=3D"grammarly-desktop-integratio=
|
|
n" data-content=3D"{"mode":"full","isActive":=
|
|
true,"isUserDisabled":false}"></div></template></grammarly-deskto=
|
|
p-integration></html>
|
|
------MultipartBoundary--ZqvR75rAxxEQH8LkhDBOtalQHLvXQrJ9wZdrptFy8o----
|
|
Content-Type: text/css
|
|
Content-Transfer-Encoding: quoted-printable
|
|
Content-Location: cid:css-46202b4e-490d-4575-add2-82f9f93fc7ed@mhtml.blink
|
|
|
|
@charset "utf-8";
|
|
|
|
@font-face { font-family: ProximaVara-Roman; src: url("chrome-extension://c=
|
|
ipccbpjpemcnijhjcdjmkjhmhniiick/static/fonts/proxima-vara-roman-black.f99ab=
|
|
2034eea98d11ef4.woff2") format("woff2"), url("chrome-extension://cipccbpjpe=
|
|
mcnijhjcdjmkjhmhniiick/static/fonts/proxima-vara-roman-black.fe9b55be9cb49a=
|
|
68107a.woff") format("woff"); font-weight: 100 1000; font-display: swap; }
|
|
|
|
@keyframes scispace-copilot-fade-in {=20
|
|
0% { visibility: hidden; opacity: 0; }
|
|
100% { visibility: visible; opacity: 1; }
|
|
}
|
|
|
|
.scispace-plugin-maximized { width: calc(100% - 420px) !important; }
|
|
|
|
div[data-section=3D"data-scispace-plugin-highlight-container"] { background=
|
|
-color: rgb(255, 255, 255); position: absolute; z-index: 2147483647; border=
|
|
-radius: 6px; box-shadow: rgba(18, 24, 26, 0.25) 0px 3px 4px; font-family: =
|
|
ProximaVara-Roman, -apple-system, BlinkMacSystemFont, "\"Segoe UI\"", Robot=
|
|
o, "\"Helvetica Neue\"", Arial, "sans-serif", "\"Apple Color Emoji\"", "\"S=
|
|
egoe UI Emoji\"", "\"Segoe UI Symbol\"" !important; }
|
|
|
|
div[data-section=3D"data-scispace-plugin-highlight-container"] div { font-f=
|
|
amily: inherit !important; }
|
|
|
|
div[data-section=3D"data-scispace-plugin-highlight-container"] div .scispac=
|
|
e-plugin-highlight-cta-wrapper { display: flex; flex-direction: row; border=
|
|
-radius: 6px; box-shadow: rgba(18, 24, 26, 0.25) 0px 3px 4px; }
|
|
|
|
div[data-section=3D"data-scispace-plugin-highlight-container"] .scispace-hi=
|
|
ghtlight-tooltip { font-size: 14px; line-height: 20px; }
|
|
|
|
div[data-section=3D"data-scispace-plugin-highlight-container"].fade-in { op=
|
|
acity: 0; animation: 130ms ease-in-out 50ms 1 normal forwards running scisp=
|
|
ace-copilot-fade-in; }
|
|
|
|
div[data-section=3D"data-scispace-plugin-highlight-container"].fade-in.hide=
|
|
{ opacity: 0; animation: 100ms ease-in-out 0s 1 normal forwards running fa=
|
|
de-out; }
|
|
|
|
div[data-section=3D"data-scispace-plugin-highlight-container"] .scispace-hi=
|
|
ghlight-divider { margin: 8px 0px; flex-shrink: 0; border-width: 0px thin 0=
|
|
px 0px; border-style: solid; border-color: rgba(0, 0, 0, 0.5); height: auto=
|
|
; align-self: stretch; background: rgb(255, 255, 255); opacity: 0.6; width:=
|
|
1px !important; }
|
|
|
|
div[data-section=3D"data-scispace-plugin-highlight-container"] button { dis=
|
|
play: flex; flex-direction: row; justify-content: center; align-items: cent=
|
|
er; gap: 10px; padding: 8px; cursor: pointer; outline: none; border: none; =
|
|
border-radius: 6px; -webkit-font-smoothing: antialiased; font-family: inher=
|
|
it !important; margin: 0px !important; color: rgb(37, 47, 53) !important; f=
|
|
ont-weight: 600 !important; font-size: 14px !important; line-height: 20px !=
|
|
important; background-color: rgb(255, 255, 255) !important; }
|
|
|
|
div[data-section=3D"data-scispace-plugin-highlight-container"] button:hover=
|
|
{ background-color: rgb(242, 243, 243) !important; }
|
|
|
|
div[data-section=3D"data-scispace-plugin-highlight-container"] button:disab=
|
|
led { opacity: 0.4 !important; }
|
|
|
|
.scispace-plugin-alert-overlay { --tw-bg-opacity: 1; background-color: rgb(=
|
|
18 24 26/var(--tw-bg-opacity)); opacity: 0.5; inset: 0px; position: fixed; =
|
|
z-index: 2147483647; }
|
|
|
|
.scispace-plugin-alertdialog { width: 384px; position: fixed; top: calc(50%=
|
|
- 100px); left: calc(50% - 192px); padding: 24px; border-radius: 0.375rem;=
|
|
--tw-bg-opacity: 1; background-color: rgb(255 255 255/var(--tw-bg-opacity)=
|
|
); z-index: 2147483647; --tw-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2=
|
|
px 4px -2px rgba(0, 0, 0, 0.1); --tw-shadow-colored: 0 4px 6px -1px var(--t=
|
|
w-shadow-color), 0 2px 4px -2px var(--tw-shadow-color); box-shadow: var(--t=
|
|
w-ring-offset-shadow, 0 0 rgba(0, 0, 0, 0)),var(--tw-ring-shadow, 0 0 rgba(=
|
|
0, 0, 0, 0)),var(--tw-shadow); font-family: ProximaVara-Roman, -apple-syste=
|
|
m, BlinkMacSystemFont, "\"Segoe UI\"", Roboto, "\"Helvetica Neue\"", Arial,=
|
|
"sans-serif", "\"Apple Color Emoji\"", "\"Segoe UI Emoji\"", "\"Segoe UI S=
|
|
ymbol\"" !important; }
|
|
|
|
.scispace-plugin-alertdialog .scispace-plugin-alertdialog-cta { display: fl=
|
|
ex; flex-direction: row; justify-content: space-between; margin-top: 32px; =
|
|
}
|
|
|
|
.scispace-plugin-alertdialog h2, .scispace-plugin-alertdialog p { margin: 0=
|
|
px !important; }
|
|
|
|
.scispace-plugin-alertdialog p { margin-top: 12px !important; }
|
|
|
|
.scispace-plugin-alertdialog h2 > span, .scispace-plugin-alertdialog p > sp=
|
|
an { text-decoration-line: none; line-height: 28px; --tw-text-opacity: 1; c=
|
|
olor: rgb(71 85 90/var(--tw-text-opacity)); font-family: ProximaVara-Roman,=
|
|
-apple-system, BlinkMacSystemFont, "\"Segoe UI\"", Roboto, "\"Helvetica Ne=
|
|
ue\"", Arial, "sans-serif", "\"Apple Color Emoji\"", "\"Segoe UI Emoji\"", =
|
|
"\"Segoe UI Symbol\"" !important; }
|
|
|
|
.scispace-plugin-alertdialog h2 > span { font-weight: 600; font-size: 18px;=
|
|
}
|
|
|
|
.scispace-plugin-alertdialog p > span { font-size: 14px; line-height: 20px;=
|
|
}
|
|
|
|
.scispace-plugin-alertdialog button { flex-direction: row; outline: none; p=
|
|
adding: 8px; --tw-bg-opacity: 1; border-radius: 0.375rem; gap: 8px; display=
|
|
: flex; justify-content: center; align-items: center; cursor: pointer; widt=
|
|
h: 80px; height: 36px; background-color: rgba(0, 0, 0, 0); color: rgb(71, 8=
|
|
5, 90); -webkit-font-smoothing: antialiased; font-family: inherit !importan=
|
|
t; font-weight: 600 !important; font-size: 14px !important; line-height: 20=
|
|
px !important; border: 0.8px solid rgb(198, 200, 202) !important; }
|
|
|
|
.scispace-plugin-alertdialog button:disabled { opacity: 0.4 !important; }
|
|
|
|
.scispace-plugin-alertdialog button.buttonPrimary { border-width: 0px; colo=
|
|
r: rgb(255, 255, 255); background-color: rgb(250 100 0/var(--tw-bg-opacity)=
|
|
); }
|
|
|
|
.scispace-plugin-alertdialog button.buttonClose { position: absolute; top: =
|
|
24px; right: 24px; display: inline-flex; height: 24px; width: 24px; justify=
|
|
-content: center; align-items: center; border-radius: 0.375rem; background:=
|
|
rgb(228, 230, 232); border: none !important; padding: 0px !important; }
|
|
|
|
.scispace-plugin-alertdialog button.gap-6 { gap: 24px; }
|
|
|
|
.scispace-plugin-alertdialog button.font-neutral-600 { color: rgb(88, 102, =
|
|
108) !important; font-size: 16px !important; }
|
|
|
|
@media print {
|
|
#scispace-extension-root { visibility: hidden; }
|
|
.scispace-plugin-maximized { width: initial !important; }
|
|
}
|
|
------MultipartBoundary--ZqvR75rAxxEQH8LkhDBOtalQHLvXQrJ9wZdrptFy8o----
|
|
Content-Type: text/css
|
|
Content-Transfer-Encoding: quoted-printable
|
|
Content-Location: cid:css-6d90d595-da0f-4eb1-bcab-537e583a03bb@mhtml.blink
|
|
|
|
@charset "utf-8";
|
|
|
|
#_copy { align-items: center; background: rgb(68, 148, 213); border-radius:=
|
|
3px; color: rgb(255, 255, 255); cursor: pointer; display: flex; font-size:=
|
|
13px; height: 30px; justify-content: center; position: absolute; width: 60=
|
|
px; z-index: 1000; }
|
|
|
|
#select-tooltip, #sfModal, .modal-backdrop, div[id^=3D"reader-helper"] { di=
|
|
splay: none !important; }
|
|
|
|
.modal-open { overflow: auto !important; }
|
|
|
|
._sf_adjust_body { padding-right: 0px !important; }
|
|
|
|
.super_copy_btns_div { position: fixed; width: 154px; left: 10px; top: 45%;=
|
|
background: rgb(231, 241, 255); border: 2px solid rgb(69, 149, 213); font-=
|
|
weight: 600; border-radius: 2px; font-family: -apple-system, BlinkMacSystem=
|
|
Font, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "He=
|
|
lvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI=
|
|
Emoji", "Segoe UI Symbol"; z-index: 5000; }
|
|
|
|
.super_copy_btns_logo { width: 100%; background: rgb(69, 149, 213); text-al=
|
|
ign: center; font-size: 12px; color: rgb(231, 241, 255); line-height: 30px;=
|
|
height: 30px; }
|
|
|
|
.super_copy_btns_btn { display: block; width: 128px; height: 28px; backgrou=
|
|
nd: rgb(127, 87, 17); border-radius: 4px; color: rgb(255, 255, 255); font-s=
|
|
ize: 12px; border: 0px; outline: 0px; margin: 8px auto; font-weight: 700; c=
|
|
ursor: pointer; opacity: 0.9; }
|
|
|
|
.super_copy_btns_btn:hover { opacity: 0.8; }
|
|
|
|
.super_copy_btns_btn:active { opacity: 1; }
|
|
------MultipartBoundary--ZqvR75rAxxEQH8LkhDBOtalQHLvXQrJ9wZdrptFy8o----
|
|
Content-Type: text/css
|
|
Content-Transfer-Encoding: quoted-printable
|
|
Content-Location: https://doc.rust-lang.org/static.files/normalize-76eba96aa4d2e634.css
|
|
|
|
@charset "utf-8";
|
|
|
|
html { line-height: 1.15; text-size-adjust: 100%; }
|
|
|
|
body { margin: 0px; }
|
|
|
|
main { display: block; }
|
|
|
|
h1 { font-size: 2em; margin: 0.67em 0px; }
|
|
|
|
hr { box-sizing: content-box; height: 0px; overflow: visible; }
|
|
|
|
pre { font-family: monospace, monospace; font-size: 1em; }
|
|
|
|
a { background-color: transparent; }
|
|
|
|
abbr[title] { border-bottom: none; text-decoration: underline dotted; }
|
|
|
|
b, strong { font-weight: bolder; }
|
|
|
|
code, kbd, samp { font-family: monospace, monospace; font-size: 1em; }
|
|
|
|
small { font-size: 80%; }
|
|
|
|
sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-ali=
|
|
gn: baseline; }
|
|
|
|
sub { bottom: -0.25em; }
|
|
|
|
sup { top: -0.5em; }
|
|
|
|
img { border-style: none; }
|
|
|
|
button, input, optgroup, select, textarea { font-family: inherit; font-size=
|
|
: 100%; line-height: 1.15; margin: 0px; }
|
|
|
|
button, input { overflow: visible; }
|
|
|
|
button, select { text-transform: none; }
|
|
|
|
[type=3D"button"], [type=3D"reset"], [type=3D"submit"], button { appearance=
|
|
: button; }
|
|
|
|
fieldset { padding: 0.35em 0.75em 0.625em; }
|
|
|
|
legend { box-sizing: border-box; color: inherit; display: table; max-width:=
|
|
100%; padding: 0px; white-space: normal; }
|
|
|
|
progress { vertical-align: baseline; }
|
|
|
|
textarea { overflow: auto; }
|
|
|
|
[type=3D"checkbox"], [type=3D"radio"] { box-sizing: border-box; padding: 0p=
|
|
x; }
|
|
|
|
[type=3D"number"]::-webkit-inner-spin-button, [type=3D"number"]::-webkit-ou=
|
|
ter-spin-button { height: auto; }
|
|
|
|
[type=3D"search"] { appearance: textfield; outline-offset: -2px; }
|
|
|
|
[type=3D"search"]::-webkit-search-decoration { appearance: none; }
|
|
|
|
::-webkit-file-upload-button { appearance: button; font: inherit; }
|
|
|
|
details { display: block; }
|
|
|
|
summary { display: list-item; }
|
|
|
|
template { display: none; }
|
|
|
|
[hidden] { display: none; }
|
|
------MultipartBoundary--ZqvR75rAxxEQH8LkhDBOtalQHLvXQrJ9wZdrptFy8o----
|
|
Content-Type: text/css
|
|
Content-Transfer-Encoding: quoted-printable
|
|
Content-Location: https://doc.rust-lang.org/static.files/rustdoc-ba5701c5741a7b69.css
|
|
|
|
@charset "utf-8";
|
|
|
|
:root { --nav-sub-mobile-padding: 8px; }
|
|
|
|
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 400=
|
|
; src: local("Fira Sans"), url("FiraSans-Regular-018c141bf0843ffd.woff2") f=
|
|
ormat("woff2"); font-display: swap; }
|
|
|
|
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 500=
|
|
; src: local("Fira Sans Medium"), url("FiraSans-Medium-8f9a781e4970d388.wof=
|
|
f2") format("woff2"); font-display: swap; }
|
|
|
|
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight=
|
|
: 400; src: local("Source Serif 4"), url("SourceSerif4-Regular-46f98efaafac=
|
|
5295.ttf.woff2") format("woff2"); font-display: swap; }
|
|
|
|
@font-face { font-family: "Source Serif 4"; font-style: italic; font-weight=
|
|
: 400; src: local("Source Serif 4 Italic"), url("SourceSerif4-It-acdfaf1a8a=
|
|
f734b1.ttf.woff2") format("woff2"); font-display: swap; }
|
|
|
|
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight=
|
|
: 700; src: local("Source Serif 4 Bold"), url("SourceSerif4-Bold-a2c9cd1067=
|
|
f8b328.ttf.woff2") format("woff2"); font-display: swap; }
|
|
|
|
@font-face { font-family: "Source Code Pro"; font-style: normal; font-weigh=
|
|
t: 400; src: url("SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2") format=
|
|
("woff2"); font-display: swap; }
|
|
|
|
@font-face { font-family: "Source Code Pro"; font-style: italic; font-weigh=
|
|
t: 400; src: url("SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2") format("wof=
|
|
f2"); font-display: swap; }
|
|
|
|
@font-face { font-family: "Source Code Pro"; font-style: normal; font-weigh=
|
|
t: 600; src: url("SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2") forma=
|
|
t("woff2"); font-display: swap; }
|
|
|
|
@font-face { font-family: NanumBarunGothic; src: url("NanumBarunGothic-0f09=
|
|
457c7a19b7c6.ttf.woff2") format("woff2"); font-display: swap; unicode-range=
|
|
: U+AC00-D7AF, U+1100-11FF, U+3130-318F, U+A960-A97F, U+D7B0-D7FF; }
|
|
|
|
* { box-sizing: border-box; }
|
|
|
|
body { font-style: normal; font-variant: normal; font-kerning: auto; font-o=
|
|
ptical-sizing: auto; font-variation-settings: normal; font-weight: normal; =
|
|
font-stretch: normal; font-size: 1rem; line-height: 1.5; font-family: "Sour=
|
|
ce Serif 4", NanumBarunGothic, serif; margin: 0px; position: relative; over=
|
|
flow-wrap: anywhere; font-feature-settings: "kern", "liga"; background-colo=
|
|
r: var(--main-background-color); color: var(--main-color); }
|
|
|
|
h1 { font-size: 1.5rem; }
|
|
|
|
h2 { font-size: 1.375rem; }
|
|
|
|
h3 { font-size: 1.25rem; }
|
|
|
|
h1, h2, h3, h4, h5, h6 { font-weight: 500; }
|
|
|
|
h1, h2, h3, h4 { margin: 25px 0px 15px; padding-bottom: 6px; }
|
|
|
|
.docblock h3, .docblock h4, h5, h6 { margin: 15px 0px 5px; }
|
|
|
|
.docblock > h2:first-child, .docblock > h3:first-child, .docblock > h4:firs=
|
|
t-child, .docblock > h5:first-child, .docblock > h6:first-child { margin-to=
|
|
p: 0px; }
|
|
|
|
.main-heading h1 { margin: 0px; padding: 0px; flex-grow: 1; overflow-wrap: =
|
|
anywhere; }
|
|
|
|
.main-heading { display: flex; flex-wrap: wrap; padding-bottom: 6px; margin=
|
|
-bottom: 15px; }
|
|
|
|
.content h2, .top-doc .docblock > h3, .top-doc .docblock > h4 { border-bott=
|
|
om: 1px solid var(--headings-border-bottom-color); }
|
|
|
|
h1, h2 { line-height: 1.25; padding-top: 3px; padding-bottom: 9px; }
|
|
|
|
h3.code-header { font-size: 1.125rem; }
|
|
|
|
h4.code-header { font-size: 1rem; }
|
|
|
|
.code-header { font-weight: 600; margin: 0px; padding: 0px; white-space: pr=
|
|
e-wrap; }
|
|
|
|
#crate-search, h1, h2, h3, h4, h5, h6, .sidebar, .mobile-topbar, .search-in=
|
|
put, .search-results .result-name, .item-name > a, .out-of-band, span.since=
|
|
, a.srclink, #help-button > a, summary.hideme, .scraped-example-list, ul.al=
|
|
l-items { font-family: "Fira Sans", Arial, NanumBarunGothic, sans-serif; }
|
|
|
|
#toggle-all-docs, a.anchor, .small-section-header a, #source-sidebar a, .ru=
|
|
st a, .sidebar h2 a, .sidebar h3 a, .mobile-topbar h2 a, h1 a, .search-resu=
|
|
lts a, .stab, .result-name .primitive > i, .result-name .keyword > i { colo=
|
|
r: var(--main-color); }
|
|
|
|
span.enum, a.enum, span.struct, a.struct, span.union, a.union, span.primiti=
|
|
ve, a.primitive, span.type, a.type, span.foreigntype, a.foreigntype { color=
|
|
: var(--type-link-color); }
|
|
|
|
span.trait, a.trait, span.traitalias, a.traitalias { color: var(--trait-lin=
|
|
k-color); }
|
|
|
|
span.associatedtype, a.associatedtype, span.constant, a.constant, span.stat=
|
|
ic, a.static { color: var(--assoc-item-link-color); }
|
|
|
|
span.fn, a.fn, span.method, a.method, span.tymethod, a.tymethod { color: va=
|
|
r(--function-link-color); }
|
|
|
|
span.attr, a.attr, span.derive, a.derive, span.macro, a.macro { color: var(=
|
|
--macro-link-color); }
|
|
|
|
span.mod, a.mod { color: var(--mod-link-color); }
|
|
|
|
span.keyword, a.keyword { color: var(--keyword-link-color); }
|
|
|
|
a { color: var(--link-color); text-decoration: none; }
|
|
|
|
ol, ul { padding-left: 24px; }
|
|
|
|
ul ul, ol ul, ul ol, ol ol { margin-bottom: 0.625em; }
|
|
|
|
p { margin: 0px 0px 0.75em; }
|
|
|
|
p:last-child { margin: 0px; }
|
|
|
|
button { padding: 1px 6px; cursor: pointer; }
|
|
|
|
button#toggle-all-docs { padding: 0px; background: none; border: none; appe=
|
|
arance: none; opacity: 1; }
|
|
|
|
.rustdoc { display: flex; flex-flow: row nowrap; }
|
|
|
|
main { position: relative; flex-grow: 1; padding: 10px 15px 40px 45px; min-=
|
|
width: 0px; }
|
|
|
|
.source main { padding: 15px; }
|
|
|
|
.width-limiter { max-width: 960px; margin-right: auto; }
|
|
|
|
details:not(.toggle) summary { margin-bottom: 0.6em; }
|
|
|
|
code, pre, a.test-arrow, .code-header { font-family: "Source Code Pro", mon=
|
|
ospace; }
|
|
|
|
.docblock code, .docblock-short code { border-radius: 3px; padding: 0px 0.1=
|
|
25em; }
|
|
|
|
.docblock pre code, .docblock-short pre code { padding: 0px; }
|
|
|
|
pre { padding: 14px; line-height: 1.5; }
|
|
|
|
pre.item-decl { overflow-x: auto; }
|
|
|
|
.item-decl .type-contents-toggle { contain: initial; }
|
|
|
|
.source .content pre { padding: 20px; }
|
|
|
|
.rustdoc.source .example-wrap pre.src-line-numbers { padding: 20px 0px 20px=
|
|
4px; }
|
|
|
|
img { max-width: 100%; }
|
|
|
|
.sub-logo-container, .logo-container { line-height: 0; display: block; }
|
|
|
|
.sub-logo-container { margin-right: 32px; }
|
|
|
|
.sub-logo-container > img { height: 60px; width: 60px; object-fit: contain;=
|
|
}
|
|
|
|
.rust-logo { filter: var(--rust-logo-filter); }
|
|
|
|
.sidebar { font-size: 0.875rem; flex: 0 0 200px; overflow-y: scroll; oversc=
|
|
roll-behavior: contain; position: sticky; height: 100vh; top: 0px; left: 0p=
|
|
x; }
|
|
|
|
.rustdoc.source .sidebar { flex-basis: 50px; border-right: 1px solid; overf=
|
|
low: hidden; z-index: 1; }
|
|
|
|
.sidebar, .mobile-topbar, .sidebar-menu-toggle, #src-sidebar-toggle, #sourc=
|
|
e-sidebar { background-color: var(--sidebar-background-color); }
|
|
|
|
#src-sidebar-toggle > button:hover, #src-sidebar-toggle > button:focus { ba=
|
|
ckground-color: var(--sidebar-background-color-hover); }
|
|
|
|
.source .sidebar > :not(#src-sidebar-toggle) { visibility: hidden; }
|
|
|
|
.source-sidebar-expanded .source .sidebar { overflow-y: auto; flex-basis: 3=
|
|
00px; }
|
|
|
|
.source-sidebar-expanded .source .sidebar > :not(#src-sidebar-toggle) { vis=
|
|
ibility: visible; }
|
|
|
|
#all-types { margin-top: 1em; }
|
|
|
|
* { }
|
|
|
|
.sidebar { }
|
|
|
|
::-webkit-scrollbar { width: 12px; }
|
|
|
|
.sidebar::-webkit-scrollbar { width: 8px; }
|
|
|
|
::-webkit-scrollbar-track { background-color: var(--scrollbar-track-backgro=
|
|
und-color); }
|
|
|
|
.sidebar::-webkit-scrollbar-track { background-color: var(--scrollbar-track=
|
|
-background-color); }
|
|
|
|
::-webkit-scrollbar-thumb, .sidebar::-webkit-scrollbar-thumb { background-c=
|
|
olor: var(--scrollbar-thumb-background-color); }
|
|
|
|
.hidden { display: none !important; }
|
|
|
|
.sidebar .logo-container { margin-top: 10px; margin-bottom: 10px; text-alig=
|
|
n: center; }
|
|
|
|
.version { overflow-wrap: break-word; }
|
|
|
|
.logo-container > img { height: 100px; width: 100px; }
|
|
|
|
ul.block, .block li { padding: 0px; margin: 0px; list-style: none; }
|
|
|
|
.sidebar-elems a, .sidebar > h2 a { display: block; padding: 0.25rem; margi=
|
|
n-left: -0.25rem; }
|
|
|
|
.sidebar h2 { overflow-wrap: anywhere; padding: 0px; margin: 0.7rem 0px; }
|
|
|
|
.sidebar h3 { font-size: 1.125rem; padding: 0px; margin: 0px; }
|
|
|
|
.sidebar-elems, .sidebar > h2 { padding-left: 24px; }
|
|
|
|
.sidebar a { color: var(--sidebar-link-color); }
|
|
|
|
.sidebar .current, .sidebar a:hover:not(.logo-container) { background-color=
|
|
: var(--sidebar-current-link-background-color); }
|
|
|
|
.sidebar-elems .block { margin-bottom: 2em; }
|
|
|
|
.sidebar-elems .block li a { white-space: nowrap; text-overflow: ellipsis; =
|
|
overflow: hidden; }
|
|
|
|
.mobile-topbar { display: none; }
|
|
|
|
.rustdoc .example-wrap { display: flex; position: relative; margin-bottom: =
|
|
10px; }
|
|
|
|
.rustdoc .example-wrap:last-child { margin-bottom: 0px; }
|
|
|
|
.rustdoc .example-wrap pre { margin: 0px; flex-grow: 1; }
|
|
|
|
.rustdoc:not(.source) .example-wrap pre { overflow: auto hidden; }
|
|
|
|
.rustdoc .example-wrap pre.example-line-numbers, .rustdoc .example-wrap pre=
|
|
.src-line-numbers { flex-grow: 0; min-width: fit-content; overflow: initial=
|
|
; text-align: right; user-select: none; padding: 14px 8px; color: var(--src=
|
|
-line-numbers-span-color); }
|
|
|
|
.rustdoc .example-wrap pre.src-line-numbers { padding: 14px 0px; }
|
|
|
|
.src-line-numbers a, .src-line-numbers span { color: var(--src-line-numbers=
|
|
-span-color); padding: 0px 8px; }
|
|
|
|
.src-line-numbers :target { background-color: transparent; border-right: no=
|
|
ne; padding: 0px 8px; }
|
|
|
|
.src-line-numbers .line-highlighted { background-color: var(--src-line-numb=
|
|
er-highlighted-background-color); }
|
|
|
|
.search-loading { text-align: center; }
|
|
|
|
.docblock-short { overflow-wrap: anywhere; }
|
|
|
|
.docblock :not(pre) > code, .docblock-short code { white-space: pre-wrap; }
|
|
|
|
.top-doc .docblock h2 { font-size: 1.375rem; }
|
|
|
|
.top-doc .docblock h3 { font-size: 1.25rem; }
|
|
|
|
.top-doc .docblock h4, .top-doc .docblock h5 { font-size: 1.125rem; }
|
|
|
|
.top-doc .docblock h6 { font-size: 1rem; }
|
|
|
|
.docblock h5 { font-size: 1rem; }
|
|
|
|
.docblock h6 { font-size: 0.875rem; }
|
|
|
|
.docblock { margin-left: 24px; position: relative; }
|
|
|
|
.docblock > :not(.more-examples-toggle):not(.example-wrap) { max-width: 100=
|
|
%; overflow-x: auto; }
|
|
|
|
.out-of-band { flex-grow: 0; font-size: 1.125rem; }
|
|
|
|
.docblock code, .docblock-short code, pre, .rustdoc.source .example-wrap { =
|
|
background-color: var(--code-block-background-color); }
|
|
|
|
#main-content { position: relative; }
|
|
|
|
.docblock table { margin: 0.5em 0px; border-collapse: collapse; }
|
|
|
|
.docblock table td, .docblock table th { padding: 0.5em; border: 1px solid =
|
|
var(--border-color); }
|
|
|
|
.docblock table tbody tr:nth-child(2n) { background: var(--table-alt-row-ba=
|
|
ckground-color); }
|
|
|
|
.method .where, .fn .where, .where.fmt-newline { display: block; white-spac=
|
|
e: pre-wrap; font-size: 0.875rem; }
|
|
|
|
.item-info { display: block; margin-left: 24px; }
|
|
|
|
.item-info code { font-size: 0.875rem; }
|
|
|
|
#main-content > .item-info { margin-left: 0px; }
|
|
|
|
nav.sub { flex-grow: 1; flex-flow: row nowrap; margin: 4px 0px 25px; displa=
|
|
y: flex; align-items: center; }
|
|
|
|
.search-form { position: relative; display: flex; height: 34px; flex-grow: =
|
|
1; }
|
|
|
|
.source nav.sub { margin: 0px 0px 15px; }
|
|
|
|
.small-section-header { display: block; position: relative; }
|
|
|
|
.small-section-header:hover > .anchor, .impl:hover > .anchor, .trait-impl:h=
|
|
over > .anchor, .variant:hover > .anchor { display: initial; }
|
|
|
|
.anchor { display: none; position: absolute; left: -0.5em; background: none=
|
|
!important; }
|
|
|
|
.anchor.field { left: -5px; }
|
|
|
|
.small-section-header > .anchor { left: -15px; padding-right: 8px; }
|
|
|
|
h2.small-section-header > .anchor { padding-right: 6px; }
|
|
|
|
.main-heading a:hover, .example-wrap .rust a:hover, .all-items a:hover, .do=
|
|
cblock a:not(.test-arrow):not(.scrape-help):not(.tooltip):hover, .docblock-=
|
|
short a:not(.test-arrow):not(.scrape-help):not(.tooltip):hover, .item-info =
|
|
a { text-decoration: underline; }
|
|
|
|
.crate.block a.current { font-weight: 500; }
|
|
|
|
table, .item-table { overflow-wrap: break-word; }
|
|
|
|
.item-table { display: table; padding: 0px; margin: 0px; }
|
|
|
|
.item-table > li { display: table-row; }
|
|
|
|
.item-table > li > div { display: table-cell; }
|
|
|
|
.item-table > li > .item-name { padding-right: 1.25rem; }
|
|
|
|
.search-results-title { margin-top: 0px; white-space: nowrap; display: flex=
|
|
; align-items: baseline; }
|
|
|
|
#crate-search-div { position: relative; min-width: 5em; }
|
|
|
|
#crate-search { min-width: 115px; padding: 0px 23px 0px 4px; max-width: 100=
|
|
%; text-overflow: ellipsis; border: 1px solid var(--border-color); border-r=
|
|
adius: 4px; outline: none; cursor: pointer; appearance: none; text-indent: =
|
|
0.01px; background-color: var(--main-background-color); color: inherit; lin=
|
|
e-height: 1.5; font-weight: 500; }
|
|
|
|
#crate-search:hover, #crate-search:focus { border-color: var(--crate-search=
|
|
-hover-border); }
|
|
|
|
#crate-search-div::after { pointer-events: none; width: 100%; height: 100%;=
|
|
position: absolute; top: 0px; left: 0px; content: ""; background-repeat: n=
|
|
o-repeat; background-size: 20px; background-position: calc(100% - 2px) 56%;=
|
|
background-image: url("data:image/svg+xml,<svg xmlns=3D\"http://www.w3.org=
|
|
/2000/svg\" \9 width=3D\"128\" height=3D\"128\" viewBox=3D\"-30 -20 176 176=
|
|
\"><path d=3D\"M111,40.5L64,87.499L17,40.5\" \9 fill=3D\"none\" stroke=3D\"=
|
|
black\" strike-linecap=3D\"square\" stroke-miterlimit=3D\"10\" stroke-width=
|
|
=3D\"12\"/> \9 </svg>"); filter: var(--crate-search-div-filter); }
|
|
|
|
#crate-search-div:hover::after, #crate-search-div:focus-within::after { fil=
|
|
ter: var(--crate-search-div-hover-filter); }
|
|
|
|
#crate-search > option { font-size: 1rem; }
|
|
|
|
.search-input { appearance: none; outline: none; border: 1px solid var(--bo=
|
|
rder-color); border-radius: 2px; padding: 8px; font-size: 1rem; flex-grow: =
|
|
1; background-color: var(--button-background-color); color: var(--search-co=
|
|
lor); }
|
|
|
|
.search-input:focus { border-color: var(--search-input-focused-border-color=
|
|
); }
|
|
|
|
.search-results { display: none; }
|
|
|
|
.search-results.active { display: block; }
|
|
|
|
.search-results > a { display: flex; margin-left: 2px; margin-right: 2px; b=
|
|
order-bottom: 1px solid var(--search-result-border-color); gap: 1em; }
|
|
|
|
.search-results > a > div { flex: 1 1 0%; }
|
|
|
|
.search-results > a > div.desc { white-space: nowrap; text-overflow: ellips=
|
|
is; overflow: hidden; }
|
|
|
|
.search-results a:hover, .search-results a:focus { background-color: var(--=
|
|
search-result-link-focus-background-color); }
|
|
|
|
.search-results .result-name span.alias { color: var(--search-results-alias=
|
|
-color); }
|
|
|
|
.search-results .result-name span.grey { color: var(--search-results-grey-c=
|
|
olor); }
|
|
|
|
.popover { position: absolute; top: 100%; right: 0px; z-index: 2; margin-to=
|
|
p: 7px; border-radius: 3px; border: 1px solid var(--border-color); backgrou=
|
|
nd-color: var(--main-background-color); color: var(--main-color); --popover=
|
|
-arrow-offset: 11px; }
|
|
|
|
.popover::before { content: ""; position: absolute; right: var(--popover-ar=
|
|
row-offset); border-top-color: ; border-top-style: ; border-right-color: ; =
|
|
border-right-style: ; border-bottom-color: ; border-bottom-style: ; border-=
|
|
left-color: ; border-left-style: ; border-image-source: ; border-image-slic=
|
|
e: ; border-image-width: ; border-image-outset: ; border-image-repeat: ; bo=
|
|
rder-width: 1px 1px 0px 0px; background-color: var(--main-background-color)=
|
|
; padding: 4px; transform: rotate(-45deg); top: -5px; }
|
|
|
|
#help.popover { max-width: 600px; --popover-arrow-offset: 48px; }
|
|
|
|
#help dt { float: left; clear: left; margin-right: 0.5rem; }
|
|
|
|
#help span.top, #help span.bottom { text-align: center; display: block; fon=
|
|
t-size: 1.125rem; }
|
|
|
|
#help span.top { margin: 10px 0px 6px; border-bottom: 1px solid var(--borde=
|
|
r-color); padding-bottom: 4px; }
|
|
|
|
#help span.bottom { clear: both; border-top: 1px solid var(--border-color);=
|
|
}
|
|
|
|
.side-by-side > div { width: 50%; float: left; padding: 0px 20px 20px 17px;=
|
|
}
|
|
|
|
.item-info .stab { min-height: 36px; display: flex; padding: 3px; margin-bo=
|
|
ttom: 5px; }
|
|
|
|
.item-name .stab { margin-left: 0.3125em; }
|
|
|
|
.stab { padding: 0px 2px; font-size: 0.875rem; font-weight: normal; color: =
|
|
var(--main-color); background-color: var(--stab-background-color); width: f=
|
|
it-content; align-items: center; white-space: pre-wrap; border-radius: 3px;=
|
|
display: inline-flex; vertical-align: text-bottom; }
|
|
|
|
.stab.portability > code { background: none; color: var(--stab-code-color);=
|
|
}
|
|
|
|
.stab .emoji { font-size: 1.25rem; margin-right: 0.3rem; }
|
|
|
|
.emoji { text-shadow: black 1px 0px 0px, black -1px 0px 0px, black 0px 1px =
|
|
0px, black 0px -1px 0px; }
|
|
|
|
.since { font-weight: normal; font-size: initial; }
|
|
|
|
.rightside { padding-left: 12px; float: right; }
|
|
|
|
.rightside:not(a), .out-of-band { color: var(--right-side-color); }
|
|
|
|
pre.rust { tab-size: 4; }
|
|
|
|
pre.rust .kw { color: var(--code-highlight-kw-color); }
|
|
|
|
pre.rust .kw-2 { color: var(--code-highlight-kw-2-color); }
|
|
|
|
pre.rust .lifetime { color: var(--code-highlight-lifetime-color); }
|
|
|
|
pre.rust .prelude-ty { color: var(--code-highlight-prelude-color); }
|
|
|
|
pre.rust .prelude-val { color: var(--code-highlight-prelude-val-color); }
|
|
|
|
pre.rust .string { color: var(--code-highlight-string-color); }
|
|
|
|
pre.rust .number { color: var(--code-highlight-number-color); }
|
|
|
|
pre.rust .bool-val { color: var(--code-highlight-literal-color); }
|
|
|
|
pre.rust .self { color: var(--code-highlight-self-color); }
|
|
|
|
pre.rust .attr { color: var(--code-highlight-attribute-color); }
|
|
|
|
pre.rust .macro, pre.rust .macro-nonterminal { color: var(--code-highlight-=
|
|
macro-color); }
|
|
|
|
pre.rust .question-mark { font-weight: bold; color: var(--code-highlight-qu=
|
|
estion-mark-color); }
|
|
|
|
pre.rust .comment { color: var(--code-highlight-comment-color); }
|
|
|
|
pre.rust .doccomment { color: var(--code-highlight-doc-comment-color); }
|
|
|
|
.rustdoc.source .example-wrap pre.rust a { background: var(--codeblock-link=
|
|
-background); }
|
|
|
|
.example-wrap.compile_fail, .example-wrap.should_panic { border-left: 2px s=
|
|
olid var(--codeblock-error-color); }
|
|
|
|
.ignore.example-wrap { border-left: 2px solid var(--codeblock-ignore-color)=
|
|
; }
|
|
|
|
.example-wrap.compile_fail:hover, .example-wrap.should_panic:hover { border=
|
|
-left: 2px solid var(--codeblock-error-hover-color); }
|
|
|
|
.example-wrap.ignore:hover { border-left: 2px solid var(--codeblock-ignore-=
|
|
hover-color); }
|
|
|
|
.example-wrap.compile_fail .tooltip, .example-wrap.should_panic .tooltip { =
|
|
color: var(--codeblock-error-color); }
|
|
|
|
.example-wrap.ignore .tooltip { color: var(--codeblock-ignore-color); }
|
|
|
|
.example-wrap.compile_fail:hover .tooltip, .example-wrap.should_panic:hover=
|
|
.tooltip { color: var(--codeblock-error-hover-color); }
|
|
|
|
.example-wrap.ignore:hover .tooltip { color: var(--codeblock-ignore-hover-c=
|
|
olor); }
|
|
|
|
.example-wrap .tooltip { position: absolute; display: block; left: -25px; t=
|
|
op: 5px; margin: 0px; line-height: 1; }
|
|
|
|
.example-wrap.compile_fail .tooltip, .example-wrap.should_panic .tooltip, .=
|
|
example-wrap.ignore .tooltip { font-weight: bold; font-size: 1.25rem; }
|
|
|
|
a.test-arrow { visibility: hidden; position: absolute; padding: 5px 10px; b=
|
|
order-radius: 5px; font-size: 1.375rem; top: 5px; right: 5px; z-index: 1; c=
|
|
olor: var(--test-arrow-color); background-color: var(--test-arrow-backgroun=
|
|
d-color); }
|
|
|
|
a.test-arrow:hover { color: var(--test-arrow-hover-color); background-color=
|
|
: var(--test-arrow-hover-background-color); }
|
|
|
|
.example-wrap:hover .test-arrow { visibility: visible; }
|
|
|
|
.code-attribute { font-weight: 300; color: var(--code-attribute-color); }
|
|
|
|
.item-spacer { width: 100%; height: 12px; display: block; }
|
|
|
|
.out-of-band > span.since { font-size: 1.25rem; }
|
|
|
|
.sub-variant h4 { font-size: 1rem; font-weight: 400; margin-top: 0px; margi=
|
|
n-bottom: 0px; }
|
|
|
|
.sub-variant { margin-left: 24px; margin-bottom: 40px; }
|
|
|
|
.sub-variant > .sub-variant-field { margin-left: 24px; }
|
|
|
|
:target { padding-right: 3px; background-color: var(--target-background-col=
|
|
or); border-right: 3px solid var(--target-border-color); }
|
|
|
|
.code-header a.tooltip { color: inherit; margin-right: 15px; position: rela=
|
|
tive; }
|
|
|
|
a.tooltip:hover::after { position: absolute; top: calc(100% - 10px); left: =
|
|
-15px; right: -15px; height: 20px; content: "=C2=A0"; }
|
|
|
|
.popover.tooltip .content { margin: 0.25em 0.5em; }
|
|
|
|
.popover.tooltip .content pre, .popover.tooltip .content code { background:=
|
|
transparent; margin: 0px; padding: 0px; font-size: 1.25rem; white-space: p=
|
|
re-wrap; }
|
|
|
|
.popover.tooltip .content > h3:first-child { margin: 0px 0px 5px; }
|
|
|
|
.search-failed { text-align: center; margin-top: 20px; display: none; }
|
|
|
|
.search-failed.active { display: block; }
|
|
|
|
.search-failed > ul { text-align: left; max-width: 570px; margin-left: auto=
|
|
; margin-right: auto; }
|
|
|
|
#search-tabs { display: flex; flex-direction: row; gap: 1px; margin-bottom:=
|
|
4px; }
|
|
|
|
#search-tabs button { text-align: center; font-size: 1.125rem; border-width=
|
|
: 2px 0px 0px; border-right-style: initial; border-bottom-style: initial; b=
|
|
order-left-style: initial; border-color: initial; border-image: initial; bo=
|
|
rder-top-style: solid; flex: 1 1 0%; line-height: 1.5; color: inherit; }
|
|
|
|
#search-tabs button:not(.selected) { background-color: var(--search-tab-but=
|
|
ton-not-selected-background); border-top-color: var(--search-tab-button-not=
|
|
-selected-border-top-color); }
|
|
|
|
#search-tabs button:hover, #search-tabs button.selected { background-color:=
|
|
var(--search-tab-button-selected-background); border-top-color: var(--sear=
|
|
ch-tab-button-selected-border-top-color); }
|
|
|
|
#search-tabs .count { font-size: 1rem; color: var(--search-tab-title-count-=
|
|
color); }
|
|
|
|
#search .error code { border-radius: 3px; background-color: var(--search-er=
|
|
ror-code-background-color); }
|
|
|
|
#src-sidebar-toggle { position: sticky; top: 0px; left: 0px; font-size: 1.2=
|
|
5rem; border-bottom: 1px solid; display: flex; height: 40px; justify-conten=
|
|
t: stretch; align-items: stretch; z-index: 10; }
|
|
|
|
#source-sidebar { width: 100%; overflow: auto; }
|
|
|
|
#source-sidebar > .title { font-size: 1.5rem; text-align: center; border-bo=
|
|
ttom: 1px solid var(--border-color); margin-bottom: 6px; }
|
|
|
|
#source-sidebar div.files > a:hover, details.dir-entry summary:hover, #sour=
|
|
ce-sidebar div.files > a:focus, details.dir-entry summary:focus { backgroun=
|
|
d-color: var(--source-sidebar-background-hover); }
|
|
|
|
#source-sidebar div.files > a.selected { background-color: var(--source-sid=
|
|
ebar-background-selected); }
|
|
|
|
#src-sidebar-toggle > button { font-size: inherit; font-weight: bold; backg=
|
|
round: none; color: inherit; text-align: center; border: none; outline: non=
|
|
e; flex: 1 1 0%; appearance: none; opacity: 1; }
|
|
|
|
#settings-menu, #help-button { margin-left: 4px; display: flex; }
|
|
|
|
#settings-menu > a, #help-button > a { display: flex; align-items: center; =
|
|
justify-content: center; background-color: var(--button-background-color); =
|
|
border: 1px solid var(--border-color); border-radius: 2px; color: var(--set=
|
|
tings-button-color); font-size: 20px; width: 33px; }
|
|
|
|
#settings-menu > a:hover, #settings-menu > a:focus, #help-button > a:hover,=
|
|
#help-button > a:focus { border-color: var(--settings-button-border-focus)=
|
|
; }
|
|
|
|
#copy-path { color: var(--copy-path-button-color); background: var(--main-b=
|
|
ackground-color); height: 34px; margin-left: 10px; padding: 0px 0px 0px 2px=
|
|
; border: 0px; width: 33px; }
|
|
|
|
#copy-path > img { filter: var(--copy-path-img-filter); }
|
|
|
|
#copy-path:hover > img { filter: var(--copy-path-img-hover-filter); }
|
|
|
|
@keyframes rotating {=20
|
|
0% { transform: rotate(0deg); }
|
|
100% { transform: rotate(360deg); }
|
|
}
|
|
|
|
#settings-menu.rotate > a img { animation: 2s linear 0s infinite normal non=
|
|
e running rotating; }
|
|
|
|
kbd { display: inline-block; padding: 3px 5px; font: 15px / 10px monospace;=
|
|
vertical-align: middle; border: solid 1px var(--border-color); border-radi=
|
|
us: 3px; color: var(--kbd-color); background-color: var(--kbd-background); =
|
|
box-shadow: inset 0 -1px 0 var(--kbd-box-shadow-color); }
|
|
|
|
ul.all-items > li { list-style: none; }
|
|
|
|
details.dir-entry { padding-left: 4px; }
|
|
|
|
details.dir-entry > summary { margin: 0px 0px 0px -4px; padding: 0px 0px 0p=
|
|
x 4px; cursor: pointer; }
|
|
|
|
details.dir-entry div.folders, details.dir-entry div.files { padding-left: =
|
|
23px; }
|
|
|
|
details.dir-entry a { display: block; }
|
|
|
|
details.toggle { contain: layout; position: relative; }
|
|
|
|
details.toggle > summary.hideme { cursor: pointer; font-size: 1rem; }
|
|
|
|
details.toggle > summary { list-style: none; outline: none; }
|
|
|
|
details.toggle > summary::-webkit-details-marker, details.toggle > summary:=
|
|
:marker { display: none; }
|
|
|
|
details.toggle > summary.hideme > span { margin-left: 9px; }
|
|
|
|
details.toggle > summary::before { background: url("data:image/svg+xml,<svg=
|
|
width=3D\"17\" height=3D\"17\" shape-rendering=3D\"crispEdges\" stroke=3D\=
|
|
"black\" fill=3D\"none\" xmlns=3D\"http://www.w3.org/2000/svg\"><path d=3D\=
|
|
"M5 2.5H2.5v12H5m7-12h2.5v12H12M5 8.5h7M8.5 12V8.625v0V5\"/></svg>") left t=
|
|
op no-repeat; content: ""; cursor: pointer; width: 16px; height: 16px; disp=
|
|
lay: inline-block; vertical-align: middle; opacity: 0.5; filter: var(--togg=
|
|
le-filter); }
|
|
|
|
details.toggle > summary.hideme > span, .more-examples-toggle summary, .mor=
|
|
e-examples-toggle .hide-more { color: var(--toggles-color); }
|
|
|
|
details.toggle > summary::after { content: "Expand"; overflow: hidden; widt=
|
|
h: 0px; height: 0px; position: absolute; }
|
|
|
|
details.toggle > summary.hideme::after { content: ""; }
|
|
|
|
details.toggle > summary:focus::before, details.toggle > summary:hover::bef=
|
|
ore { opacity: 1; }
|
|
|
|
details.toggle > summary:focus-visible::before { outline: rgb(0, 0, 0) dott=
|
|
ed 1px; outline-offset: 1px; }
|
|
|
|
details.non-exhaustive { margin-bottom: 8px; }
|
|
|
|
details.toggle > summary.hideme::before { position: relative; }
|
|
|
|
details.toggle > summary:not(.hideme)::before { position: absolute; left: -=
|
|
24px; top: 4px; }
|
|
|
|
.impl-items > details.toggle > summary:not(.hideme)::before { position: abs=
|
|
olute; left: -24px; }
|
|
|
|
details.toggle[open] > summary.hideme { position: absolute; }
|
|
|
|
details.toggle[open] > summary.hideme > span { display: none; }
|
|
|
|
details.toggle[open] > summary::before { background: url("data:image/svg+xm=
|
|
l,<svg width=3D\"17\" height=3D\"17\" shape-rendering=3D\"crispEdges\" stro=
|
|
ke=3D\"black\" fill=3D\"none\" xmlns=3D\"http://www.w3.org/2000/svg\"><path=
|
|
d=3D\"M5 2.5H2.5v12H5m7-12h2.5v12H12M5 8.5h7\"/></svg>") left top no-repea=
|
|
t; }
|
|
|
|
details.toggle[open] > summary::after { content: "Collapse"; }
|
|
|
|
.docblock summary > * { display: inline-block; }
|
|
|
|
.docblock > .example-wrap:first-child .tooltip { margin-top: 16px; }
|
|
|
|
@media (max-width: 700px) {
|
|
[id] { scroll-margin-top: 45px; }
|
|
.rustdoc { display: block; }
|
|
main { padding-left: 15px; padding-top: 0px; }
|
|
.main-heading { flex-direction: column; }
|
|
.out-of-band { text-align: left; margin-left: initial; padding: initial; =
|
|
}
|
|
.out-of-band .since::before { content: "Since "; }
|
|
.sidebar .logo-container, .sidebar .location { display: none; }
|
|
.sidebar { position: fixed; top: 45px; left: -1000px; z-index: 11; height=
|
|
: calc(100vh - 45px); width: 200px; }
|
|
.source main, .rustdoc.source .sidebar { top: 0px; padding: 0px; height: =
|
|
100vh; border: 0px; }
|
|
.sidebar.shown, .source-sidebar-expanded .source .sidebar, .rustdoc:not(.=
|
|
source) .sidebar:focus-within { left: 0px; }
|
|
.mobile-topbar h2 { padding-bottom: 0px; margin: auto 0.5em auto auto; ov=
|
|
erflow: hidden; font-size: 24px; }
|
|
.mobile-topbar h2 a { display: block; text-overflow: ellipsis; overflow: =
|
|
hidden; white-space: nowrap; }
|
|
.mobile-topbar .logo-container > img { max-width: 35px; max-height: 35px;=
|
|
margin: 5px 0px 5px 20px; }
|
|
.mobile-topbar { display: flex; flex-direction: row; position: sticky; z-=
|
|
index: 10; font-size: 2rem; height: 45px; width: 100%; left: 0px; top: 0px;=
|
|
}
|
|
.sidebar-menu-toggle { width: 45px; font-size: 32px; border: none; color:=
|
|
var(--main-color); }
|
|
.sidebar-elems { margin-top: 1em; }
|
|
.anchor { display: none !important; }
|
|
#search-tabs .count { display: block; }
|
|
#main-content > details.toggle > summary::before, #main-content > div > d=
|
|
etails.toggle > summary::before { left: -11px; }
|
|
#src-sidebar-toggle { position: fixed; left: 1px; top: 100px; width: 30px=
|
|
; font-size: 1.5rem; padding: 0px; z-index: 10; border-top-right-radius: 3p=
|
|
x; border-bottom-right-radius: 3px; border-width: 1px 1px 1px 0px; border-t=
|
|
op-style: solid; border-right-style: solid; border-bottom-style: solid; bor=
|
|
der-color: initial; border-image: initial; border-left-style: initial; }
|
|
.source-sidebar-expanded #src-sidebar-toggle { left: unset; top: unset; w=
|
|
idth: unset; border-top-right-radius: unset; border-bottom-right-radius: un=
|
|
set; position: sticky; border-width: 0px 0px 1px; border-top-style: initial=
|
|
; border-right-style: initial; border-left-style: initial; border-color: in=
|
|
itial; border-image: initial; border-bottom-style: solid; }
|
|
#copy-path, #help-button { display: none; }
|
|
.item-table, .item-row, .item-table > li, .item-table > li > div, .search=
|
|
-results > a, .search-results > a > div { display: block; }
|
|
.search-results > a { padding: 5px 0px; }
|
|
.search-results > a > div.desc, .item-table > li > div.desc { padding-lef=
|
|
t: 2em; }
|
|
.source-sidebar-expanded .source .sidebar { max-width: 100vw; width: 100v=
|
|
w; }
|
|
details.toggle:not(.top-doc) > summary { margin-left: 10px; }
|
|
.impl-items > details.toggle > summary:not(.hideme)::before, #main-conten=
|
|
t > details.toggle:not(.top-doc) > summary::before, #main-content > div > d=
|
|
etails.toggle > summary::before { left: -11px; }
|
|
.impl-items > .item-info { margin-left: 34px; }
|
|
.source nav.sub { margin: 0px; padding: var(--nav-sub-mobile-padding); }
|
|
}
|
|
|
|
@media (min-width: 701px) {
|
|
.scraped-example-title { position: absolute; z-index: 10; background: var=
|
|
(--main-background-color); bottom: 8px; right: 5px; padding: 2px 4px; box-s=
|
|
hadow: 0 0 4px var(--main-background-color); }
|
|
}
|
|
|
|
@media print {
|
|
nav.sidebar, nav.sub, .out-of-band, a.srclink, #copy-path, details.toggle=
|
|
[open] > summary::before, details.toggle > summary::before, details.toggle.=
|
|
top-doc > summary { display: none; }
|
|
.docblock { margin-left: 0px; }
|
|
main { padding: 10px; }
|
|
}
|
|
|
|
@media (max-width: 464px) {
|
|
.docblock { margin-left: 12px; }
|
|
.docblock code { overflow-wrap: anywhere; }
|
|
nav.sub { flex-direction: column; }
|
|
.search-form { align-self: stretch; }
|
|
.sub-logo-container > img { height: 35px; width: 35px; margin-bottom: var=
|
|
(--nav-sub-mobile-padding); }
|
|
}
|
|
|
|
.variant, .implementors-toggle > summary, .impl, #implementors-list > .docb=
|
|
lock, .impl-items > section, .impl-items > .toggle > summary, .methods > se=
|
|
ction, .methods > .toggle > summary { margin-bottom: 0.75em; }
|
|
|
|
.variants > .docblock, .implementors-toggle > .docblock, .impl-items > .tog=
|
|
gle[open]:not(:last-child), .methods > .toggle[open]:not(:last-child), .imp=
|
|
lementors-toggle[open]:not(:last-child) { margin-bottom: 2em; }
|
|
|
|
#trait-implementations-list .impl-items > .toggle:not(:last-child), #synthe=
|
|
tic-implementations-list .impl-items > .toggle:not(:last-child), #blanket-i=
|
|
mplementations-list .impl-items > .toggle:not(:last-child) { margin-bottom:=
|
|
1em; }
|
|
|
|
.scraped-example-list .scrape-help { margin-left: 10px; padding: 0px 4px; f=
|
|
ont-weight: normal; font-size: 12px; position: relative; bottom: 1px; borde=
|
|
r: 1px solid var(--scrape-example-help-border-color); border-radius: 50px; =
|
|
color: var(--scrape-example-help-color); }
|
|
|
|
.scraped-example-list .scrape-help:hover { border-color: var(--scrape-examp=
|
|
le-help-hover-border-color); color: var(--scrape-example-help-hover-color);=
|
|
}
|
|
|
|
.scraped-example { position: relative; }
|
|
|
|
.scraped-example .code-wrapper { position: relative; display: flex; flex-fl=
|
|
ow: row wrap; width: 100%; }
|
|
|
|
.scraped-example:not(.expanded) .code-wrapper { max-height: calc(7.5em + 10=
|
|
px); }
|
|
|
|
.scraped-example:not(.expanded) .code-wrapper pre { overflow-y: hidden; pad=
|
|
ding-bottom: 0px; max-height: calc(7.5em + 10px); }
|
|
|
|
.more-scraped-examples .scraped-example:not(.expanded) .code-wrapper, .more=
|
|
-scraped-examples .scraped-example:not(.expanded) .code-wrapper pre { max-h=
|
|
eight: calc(15em + 10px); }
|
|
|
|
.scraped-example .code-wrapper .next, .scraped-example .code-wrapper .prev,=
|
|
.scraped-example .code-wrapper .expand { color: var(--main-color); positio=
|
|
n: absolute; top: 0.25em; z-index: 1; padding: 0px; background: none; borde=
|
|
r: none; appearance: none; opacity: 1; }
|
|
|
|
.scraped-example .code-wrapper .prev { right: 2.25em; }
|
|
|
|
.scraped-example .code-wrapper .next { right: 1.25em; }
|
|
|
|
.scraped-example .code-wrapper .expand { right: 0.25em; }
|
|
|
|
.scraped-example:not(.expanded) .code-wrapper::before, .scraped-example:not=
|
|
(.expanded) .code-wrapper::after { content: " "; width: 100%; height: 5px; =
|
|
position: absolute; z-index: 1; }
|
|
|
|
.scraped-example:not(.expanded) .code-wrapper::before { top: 0px; backgroun=
|
|
d: linear-gradient(to bottom,var(--scrape-example-code-wrapper-background-s=
|
|
tart),var(--scrape-example-code-wrapper-background-end)); }
|
|
|
|
.scraped-example:not(.expanded) .code-wrapper::after { bottom: 0px; backgro=
|
|
und: linear-gradient(to top,var(--scrape-example-code-wrapper-background-st=
|
|
art),var(--scrape-example-code-wrapper-background-end)); }
|
|
|
|
.scraped-example .code-wrapper .example-wrap { width: 100%; overflow-y: hid=
|
|
den; margin-bottom: 0px; }
|
|
|
|
.scraped-example:not(.expanded) .code-wrapper .example-wrap { overflow-x: h=
|
|
idden; }
|
|
|
|
.scraped-example .example-wrap .rust span.highlight { background: var(--scr=
|
|
ape-example-code-line-highlight); }
|
|
|
|
.scraped-example .example-wrap .rust span.highlight.focus { background: var=
|
|
(--scrape-example-code-line-highlight-focus); }
|
|
|
|
.more-examples-toggle { max-width: calc(100% + 25px); margin-top: 10px; mar=
|
|
gin-left: -25px; }
|
|
|
|
.more-examples-toggle .hide-more { margin-left: 25px; cursor: pointer; }
|
|
|
|
.more-scraped-examples { margin-left: 25px; position: relative; }
|
|
|
|
.toggle-line { position: absolute; top: 5px; bottom: 0px; right: calc(100% =
|
|
+ 10px); padding: 0px 4px; cursor: pointer; }
|
|
|
|
.toggle-line-inner { min-width: 2px; height: 100%; background: var(--scrape=
|
|
-example-toggle-line-background); }
|
|
|
|
.toggle-line:hover .toggle-line-inner { background: var(--scrape-example-to=
|
|
ggle-line-hover-background); }
|
|
|
|
.more-scraped-examples .scraped-example, .example-links { margin-top: 20px;=
|
|
}
|
|
|
|
.more-scraped-examples .scraped-example:first-child { margin-top: 5px; }
|
|
|
|
.example-links ul { margin-bottom: 0px; }
|
|
------MultipartBoundary--ZqvR75rAxxEQH8LkhDBOtalQHLvXQrJ9wZdrptFy8o----
|
|
Content-Type: text/css
|
|
Content-Transfer-Encoding: quoted-printable
|
|
Content-Location: https://doc.rust-lang.org/static.files/dark-1097f8e92a01e3cf.css
|
|
|
|
@charset "utf-8";
|
|
|
|
:root { --main-background-color: #353535; --main-color: #ddd; --settings-in=
|
|
put-color: #2196f3; --settings-input-border-color: #999; --settings-button-=
|
|
color: #000; --settings-button-border-focus: #ffb900; --sidebar-background-=
|
|
color: #505050; --sidebar-background-color-hover: #676767; --code-block-bac=
|
|
kground-color: #2A2A2A; --scrollbar-track-background-color: #717171; --scro=
|
|
llbar-thumb-background-color: rgba(32,34,37,.6); --scrollbar-color: rgba(32=
|
|
,34,37,.6) #5a5a5a; --headings-border-bottom-color: #d2d2d2; --border-color=
|
|
: #e0e0e0; --button-background-color: #f0f0f0; --right-side-color: grey; --=
|
|
code-attribute-color: #999; --toggles-color: #999; --toggle-filter: invert(=
|
|
100%); --search-input-focused-border-color: #008dfd; --copy-path-button-col=
|
|
or: #999; --copy-path-img-filter: invert(50%); --copy-path-img-hover-filter=
|
|
: invert(65%); --codeblock-error-hover-color: rgb(255,0,0); --codeblock-err=
|
|
or-color: rgba(255,0,0,.5); --codeblock-ignore-hover-color: rgb(255,142,0);=
|
|
--codeblock-ignore-color: rgba(255,142,0,.6); --type-link-color: #2dbfb8; =
|
|
--trait-link-color: #b78cf2; --assoc-item-link-color: #d2991d; --function-l=
|
|
ink-color: #2bab63; --macro-link-color: #09bd00; --keyword-link-color: #d29=
|
|
91d; --mod-link-color: #d2991d; --link-color: #d2991d; --sidebar-link-color=
|
|
: #fdbf35; --sidebar-current-link-background-color: #444; --search-result-l=
|
|
ink-focus-background-color: #616161; --search-result-border-color: #aaa3; -=
|
|
-search-color: #111; --search-error-code-background-color: #484848; --searc=
|
|
h-results-alias-color: #fff; --search-results-grey-color: #ccc; --search-ta=
|
|
b-title-count-color: #888; --search-tab-button-not-selected-border-top-colo=
|
|
r: #252525; --search-tab-button-not-selected-background: #252525; --search-=
|
|
tab-button-selected-border-top-color: #0089ff; --search-tab-button-selected=
|
|
-background: #353535; --stab-background-color: #314559; --stab-code-color: =
|
|
#e6e1cf; --code-highlight-kw-color: #ab8ac1; --code-highlight-kw-2-color: #=
|
|
769acb; --code-highlight-lifetime-color: #d97f26; --code-highlight-prelude-=
|
|
color: #769acb; --code-highlight-prelude-val-color: #ee6868; --code-highlig=
|
|
ht-number-color: #83a300; --code-highlight-string-color: #83a300; --code-hi=
|
|
ghlight-literal-color: #ee6868; --code-highlight-attribute-color: #ee6868; =
|
|
--code-highlight-self-color: #ee6868; --code-highlight-macro-color: #3e999f=
|
|
; --code-highlight-question-mark-color: #ff9011; --code-highlight-comment-c=
|
|
olor: #8d8d8b; --code-highlight-doc-comment-color: #8ca375; --src-line-numb=
|
|
ers-span-color: #3b91e2; --src-line-number-highlighted-background-color: #0=
|
|
a042f; --test-arrow-color: #dedede; --test-arrow-background-color: rgba(78,=
|
|
139,202,0.2); --test-arrow-hover-color: #dedede; --test-arrow-hover-backgro=
|
|
und-color: #4e8bca; --target-background-color: #494a3d; --target-border-col=
|
|
or: #bb7410; --kbd-color: #000; --kbd-background: #fafbfc; --kbd-box-shadow=
|
|
-color: #c6cbd1; --rust-logo-filter: drop-shadow(1px 0 0px #fff) drop-shado=
|
|
w(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff); --cr=
|
|
ate-search-div-filter: invert(94%) sepia(0%) saturate(721%) hue-rotate(255d=
|
|
eg) brightness(90%) contrast(90%); --crate-search-div-hover-filter: invert(=
|
|
69%) sepia(60%) saturate(6613%) hue-rotate(184deg) brightness(100%) contras=
|
|
t(91%); --crate-search-hover-border: #2196f3; --source-sidebar-background-s=
|
|
elected: #333; --source-sidebar-background-hover: #444; --table-alt-row-bac=
|
|
kground-color: #2A2A2A; --codeblock-link-background: #333; --scrape-example=
|
|
-toggle-line-background: #999; --scrape-example-toggle-line-hover-backgroun=
|
|
d: #c5c5c5; --scrape-example-code-line-highlight: rgb(91,59,1); --scrape-ex=
|
|
ample-code-line-highlight-focus: rgb(124,75,15); --scrape-example-help-bord=
|
|
er-color: #aaa; --scrape-example-help-color: #eee; --scrape-example-help-ho=
|
|
ver-border-color: #fff; --scrape-example-help-hover-color: #fff; --scrape-e=
|
|
xample-code-wrapper-background-start: rgba(53,53,53,1); --scrape-example-co=
|
|
de-wrapper-background-end: rgba(53,53,53,0); }
|
|
------MultipartBoundary--ZqvR75rAxxEQH8LkhDBOtalQHLvXQrJ9wZdrptFy8o----
|
|
Content-Type: image/svg+xml
|
|
Content-Transfer-Encoding: quoted-printable
|
|
Content-Location: https://doc.rust-lang.org/static.files/rust-logo-151179464ae7ed46.svg
|
|
|
|
<svg version=3D"1.1" height=3D"106" width=3D"106" xmlns=3D"http://www.w3.or=
|
|
g/2000/svg" xmlns:xlink=3D"http://www.w3.org/1999/xlink">
|
|
<g id=3D"logo" transform=3D"translate(53, 53)">
|
|
<path id=3D"r" transform=3D"translate(0.5, 0.5)" stroke=3D"black" stroke-=
|
|
width=3D"1" stroke-linejoin=3D"round" d=3D"
|
|
M -9,-15 H 4 C 12,-15 12,-7 4,-7 H -9 Z
|
|
M -40,22 H 0 V 11 H -9 V 3 H 1 C 12,3 6,22 15,22 H 40
|
|
V 3 H 34 V 5 C 34,13 25,12 24,7 C 23,2 19,-2 18,-2 C 33,-10 24,-26 12,-=
|
|
26 H -35
|
|
V -15 H -25 V 11 H -40 Z" />
|
|
<g id=3D"gear" mask=3D"url(#holes)">
|
|
<circle r=3D"43" fill=3D"none" stroke=3D"black" stroke-width=3D"9" />
|
|
<g id=3D"cogs">
|
|
<polygon id=3D"cog" stroke=3D"black" stroke-width=3D"3" stroke-linejo=
|
|
in=3D"round" points=3D"46,3 51,0 46,-3" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(11.25)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(22.50)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(33.75)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(45.00)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(56.25)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(67.50)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(78.75)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(90.00)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(101.25)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(112.50)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(123.75)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(135.00)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(146.25)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(157.50)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(168.75)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(180.00)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(191.25)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(202.50)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(213.75)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(225.00)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(236.25)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(247.50)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(258.75)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(270.00)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(281.25)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(292.50)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(303.75)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(315.00)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(326.25)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(337.50)" />
|
|
<use xlink:href=3D"#cog" transform=3D"rotate(348.75)" />
|
|
</g>
|
|
<g id=3D"mounts">
|
|
<polygon id=3D"mount" stroke=3D"black" stroke-width=3D"6" stroke-line=
|
|
join=3D"round" points=3D"-7,-42 0,-35 7,-42" />
|
|
<use xlink:href=3D"#mount" transform=3D"rotate(72)" />
|
|
<use xlink:href=3D"#mount" transform=3D"rotate(144)" />
|
|
<use xlink:href=3D"#mount" transform=3D"rotate(216)" />
|
|
<use xlink:href=3D"#mount" transform=3D"rotate(288)" />
|
|
</g>
|
|
</g>
|
|
<mask id=3D"holes">
|
|
<rect x=3D"-60" y=3D"-60" width=3D"120" height=3D"120" fill=3D"white"/>
|
|
<circle id=3D"hole" cy=3D"-40" r=3D"3" />
|
|
<use xlink:href=3D"#hole" transform=3D"rotate(72)" />
|
|
<use xlink:href=3D"#hole" transform=3D"rotate(144)" />
|
|
<use xlink:href=3D"#hole" transform=3D"rotate(216)" />
|
|
<use xlink:href=3D"#hole" transform=3D"rotate(288)" />
|
|
</mask>
|
|
</g>
|
|
</svg>=0A
|
|
------MultipartBoundary--ZqvR75rAxxEQH8LkhDBOtalQHLvXQrJ9wZdrptFy8o----
|
|
Content-Type: image/svg+xml
|
|
Content-Transfer-Encoding: quoted-printable
|
|
Content-Location: https://doc.rust-lang.org/static.files/wheel-7b819b6101059cd0.svg
|
|
|
|
<svg xmlns=3D"http://www.w3.org/2000/svg" width=3D"27.434" height=3D"29.5" =
|
|
enable-background=3D"new 0 0 27.434 29.5" viewBox=3D"0 0 27.434 29.5"><path=
|
|
d=3D"M27.316 18.39a2.696 2.696 0 0 0-.98-1.46 1.62 1.62 0 0 1-.016-.762l.0=
|
|
35-.176v-1.191c0-1.246-.003-1.278-.046-1.473a1.717 1.717 0 0 1 .007-.805c.4=
|
|
77-.343.829-.859.997-1.472.257-.957.074-2.094-.508-3.117l-.594-1.032c-.746-=
|
|
1.304-1.965-2.117-3.18-2.117-.379 0-.75.078-1.086.235a1.958 1.958 0 0 1-.85=
|
|
5-.391l-.102-.082-.117-.063-1.855-1.07-.094-.055-.106-.043c-.378-.156-.66-.=
|
|
41-.77-.554C17.919 1.172 16.349 0 14.297 0h-1.155c-2.043 0-3.61 1.152-3.75 =
|
|
2.723-.114.14-.391.382-.758.527l-.102.04-.094.05-1.94 1.066-.134.074-.117.0=
|
|
94a2.019 2.019 0 0 1-.832.403 2.518 2.518 0 0 0-1.008-.211c-1.199 0-2.414.8=
|
|
2-3.168 2.14l-.59 1.032c-.41.718-.64 1.523-.64 2.257-.004.953.36 1.758 1.01=
|
|
2 2.258.035.152.058.445-.016.785-.04.168-.063.282-.063 1.563 0 1.148 0 1.14=
|
|
8.016 1.261l.008.075.015.074c.075.344.047.64.012.8-.644.5-1.004 1.302-.992 =
|
|
2.259.008.726.238 1.52.648 2.242l.59 1.027c.758 1.332 1.965 2.16 3.149 2.16=
|
|
.324 0 .644-.062.937-.187.168.039.492.156.813.418l.11.086.124.07 2.047 1.15=
|
|
6.102.059.105.043c.363.144.648.379.766.52.164 1.519 1.718 2.632 3.746 2.632=
|
|
h1.156c2.035 0 3.598-1.133 3.746-2.672.117-.144.402-.394.773-.55l.114-.047.=
|
|
101-.063 1.961-1.156.106-.063.097-.078c.309-.246.653-.37.832-.398.313.136.6=
|
|
6.21 1.016.21 1.2 0 2.41-.82 3.164-2.14l.594-1.031c.59-1.028.777-2.164.52-3=
|
|
.117Zm-2.043 2.247-.59 1.031c-.437.766-1.105 1.25-1.636 1.25a.7.7 0 0 1-.37=
|
|
1-.094 1.146 1.146 0 0 0-.567-.129c-.593 0-1.382.297-2.007.797l-1.961 1.156=
|
|
c-1.016.426-1.848 1.293-1.848 1.93 0 .64-.898 1.16-1.996 1.16H13.14c-1.102 =
|
|
0-2-.515-2-1.14 0-.63-.832-1.477-1.852-1.887l-2.047-1.16c-.637-.512-1.426-.=
|
|
813-2.008-.813-.199 0-.379.035-.515.114a.648.648 0 0 1-.332.085c-.52 0-1.18=
|
|
-.5-1.621-1.273l-.59-1.031c-.543-.953-.555-1.98-.024-2.285.532-.305.782-1.4=
|
|
34.551-2.504V14.8c0-1.09.02-1.18.02-1.18.238-1.074-.008-2.203-.551-2.516-.5=
|
|
4-.304-.54-1.34.008-2.293l.59-1.03c.437-.766 1.101-1.255 1.636-1.255a.73.73=
|
|
0 0 1 .364.094c.152.086.343.125.566.125.594 0 1.379-.297 2.004-.793l1.945-=
|
|
1.066c1.02-.407 1.856-1.278 1.856-1.934 0-.656.898-1.191 2-1.191h1.156c1.09=
|
|
8 0 1.996.543 1.996 1.21 0 .669.832 1.555 1.848 1.973L20 6.012c.617.492 1.4=
|
|
02.777 2.012.777.242 0 .453-.047.62-.14a.79.79 0 0 1 .403-.102c.55 0 1.223.=
|
|
476 1.652 1.23l.59 1.032c.543.953.52 2.004-.062 2.336-.574.332-.86 1.48-.62=
|
|
5 2.554 0 0 .008.04.008 1.102v1.011c-.215 1.051.07 2.176.636 2.5.567.325.58=
|
|
6 1.368.04 2.325Zm0 0"/><path d=3D"M13.61 7.61a7.084 7.084 0 0 0-7.083 7.08=
|
|
5 7.085 7.085 0 1 0 14.168 0A7.088 7.088 0 0 0 13.61 7.61Zm0 12.41a5.33 5.3=
|
|
3 0 0 1-5.325-5.325 5.33 5.33 0 0 1 5.324-5.32 5.327 5.327 0 0 1 5.325 5.32=
|
|
5.328 5.328 0 0 1-5.325 5.325Zm0 0"/><path d=3D"M13.684 9.906a4.722 4.722 =
|
|
0 0 0-4.72 4.719 4.722 4.722 0 0 0 4.72 4.719 4.724 4.724 0 0 0 4.714-4.719=
|
|
4.724 4.724 0 0 0-4.714-4.719Zm0 7.676a2.954 2.954 0 1 1 0-5.91 2.953 2.95=
|
|
3 0 0 1 2.953 2.953 2.957 2.957 0 0 1-2.953 2.957Zm0 0"/></svg>
|
|
------MultipartBoundary--ZqvR75rAxxEQH8LkhDBOtalQHLvXQrJ9wZdrptFy8o----
|
|
Content-Type: image/svg+xml
|
|
Content-Transfer-Encoding: quoted-printable
|
|
Content-Location: https://doc.rust-lang.org/static.files/clipboard-7571035ce49a181d.svg
|
|
|
|
<svg width=3D"24" height=3D"25" viewBox=3D"0 0 24 25" xmlns=3D"http://www.w=
|
|
3.org/2000/svg" aria-label=3D"Copy to clipboard"><path d=3D"M18 20h2v3c0 1-=
|
|
1 2-2 2H2c-.998 0-2-1-2-2V5c0-.911.755-1.667 1.667-1.667h5A3.323 3.323 0 01=
|
|
10 0a3.323 3.323 0 013.333 3.333h5C19.245 3.333 20 4.09 20 5v8.333h-2V9H2v1=
|
|
4h16v-3zM3 7h14c0-.911-.793-1.667-1.75-1.667H13.5c-.957 0-1.75-.755-1.75-1.=
|
|
666C11.75 2.755 10.957 2 10 2s-1.75.755-1.75 1.667c0 .911-.793 1.666-1.75 1=
|
|
.666H4.75C3.793 5.333 3 6.09 3 7z"/><path d=3D"M4 19h6v2H4zM12 11H4v2h8zM4 =
|
|
17h4v-2H4zM15 15v-3l-4.5 4.5L15 21v-3l8.027-.032L23 15z"/></svg>=0A
|
|
------MultipartBoundary--ZqvR75rAxxEQH8LkhDBOtalQHLvXQrJ9wZdrptFy8o------
|
|
|
|
========================================================================================================================================================================================================================================================
|
|
========================================================================================================================================================================================================================================================
|
|
Following content is randomly copied from above
|
|
========================================================================================================================================================================================================================================================
|
|
========================================================================================================================================================================================================================================================
|
|
; }
|
|
|
|
ldrements:<.5 4.5L15 2uctural for <code>field</code></a></h3>
|
|
<p>It n.html#method.take=
|
|
|
|
argument. This
|
|
is the exact point mmary.hideme { position: absolute; }
|
|
|
|
dtle=3D"struct sot cause unsoundnesssition: absolute; z-d=3D"mounts">
|
|
<polygon id=3D"mo
|
|
<use xlink:hrswap; }
|
|
|
|
@font-face uch as the type=3D"submit"], button { appearance=
|
|
: buttonx: 10; font-size: 2--ZqvR75r
|
|
settings"><img width=3D"22" height=3D"22" atF"#cog" transform=3D"rotate(135.0lineem; }
|
|
|
|
.search-results > a > div { flex: 1 1 061-1.156.106-.063.097-.078c.309-.246.653-.37.e=3D"Vec">Vec</ahe theoretical discussion continues</aresult-namew(%22wure/trait.Future.html#tymethod.=
|
|
poll" t:3D\"17\" shape-rendering=3D\"crispEdges\n</code>/<code>get_pin_mut</code>
|
|
methods tpper-bacue-rotate(184deg) brightness(100%) c>Box</a>child) { margin-bottom: 2em; }
|
|
|
|
#trait-implemen
|
|
truct.Box.h
|
|
span.mod, a.mod { coleft: 10px; paddinition: absolute; z-index: 214748364pin.html" title=3D"trait std::marker::U#hole" transform=3D"rotate(288)" />
|
|
pitself. Allocation is controll3c-.378-.156-.66!importt-display: { font-family: "Source Serif 4"; fay in the}"></div><t;T></code>,
|
|
or <code><a href=3D"olid; display:t, even <code><a href=3D"https://doc.rust-ors-toggle > summary, .iap: =
|
|
anywhere; }
|
|
|
|
.main-hd-color=
|
|
: var(--ttruct.Pin.html">
|
|
------MultipartBound><span class=3D"kw">fn </spa><ist > .docb=
|
|
lock
|
|
org/std/boxed/struo+long+a <span class=3D"kw">use </span>std::4-4.719=
|
|
4.724 4.724 0 0 0-4.714-4.719Zm0 the type that { overflow-y: hidden; D"http://www.w3.or=
|
|
g/2000/svg" xmlns:xlink=3Di>
|
|
<p>The raped-example .code-wrapper .e" transform=3D"rotate(14gnore-hover-c=
|
|
olor);e>poll</code></a>.
|
|
But if your combinator cont55,0,0); --codeblock-err=
|
|
or-color: r
|
|
html"><img clasit.Drop=
|
|
.html#tymethod.drop" title=3D"method title=3D"ops=
|
|
::Deref"><code>Deref</code></ade-highlight-attribute=3D"kw-2">&mut </span>T=
|
|
>) {
|
|
<span ce-sidebar divpx; position: absolute; }
|
|
|
|
=3D\=
|
|
kgroun=
|
|
d-color: var45px; min- a, .sidmargin: 0px; }
|
|
|
|
button, input { ov" transform=3D"rotate(247.50)" />
|
|
<use x<code>Unpin</code></a>) even if the =
|
|
<codwrap; margin: 4px 0px 25px; displa=
|
|
y: flen-alertdialog p { ma==
|
|
in</a><<a href=3D"httanded .source .sit-lang.org/std/cell/struct.RefCence.html" ti=
|
|
tle=3D"mutable ref:+ipboard"><path d=3D"M18 20h2v3c0 1-=
|
|
1 ar { flex-basis: 50px; borf", "\"Apple Color Emoji\"", " justify-content: center; position: absolPint_eq!(still_unmoved.slice,+NonNull::fromary::before { left: -11gt;</code> ge=
|
|
ts dropped, so do its conype {
|
|
; width: 100%; heigh
|
|
ospace; }
|
|
|
|
.docblock code, .docblocm; }
|
|
|
|
small
|
|
<span class=3D"kw">useype,
|
|
"h{ feyfr8-.64 1.523-.6
|
|
}
|
|
|
|
.scispace-plugin-alertdialog h2, .sciped in <code><a hr-val-c60.%0A%7D%0A%7D&edi trait.Unpin.html" ti=
|
|
tle4 9.906a4.722 4.722 =
|
|
0 0 0-4.72 4.719 4.722 }
|
|
|
|
#source-sidebar > .title { font-si-example, .example-links { margin-top: 20
|
|
put" name=3D"search" aria-label=3D"Run search ;mut</a> lang.org/=
|
|
std/vec/sn-top: 4=3D Unmo."example-wrap compile_fail"><a href=3D"https:/links ul { margin-bottom: 0px; }
|
|
------Mulition: sticky; border-width: 0px 0px 1uture::Future"><MafCell<T> =3D rc.into_ref().get_ref();+we+use+a.org/st=
|
|
d/ops::Drop::drop"><code>drop</code><=
|
|
/a> returns code>Drop</code></a>. The <a hrefe-wrap pre.src-line-numberBlinkMacSystemFont, "\"Segoe UI\"", Robot=
|
|
o, ):not(.example-wrap)in-bispace-plugin-alertdiaver > img { filter: var(--copy-pat<p>However, sor: var(--code-highlight-literal-co181d.s5c-.957 0-1.75-.755-1.75-1.=
|
|
666C11.75 2.755 10.enum std::option::al=
|
|
l <a href=3D"httight=3D"25" viewBox=3D"0 0 24 25" xmlns=3D"http2"><link reily: "Source Code P
|
|
apse all doormt=
|
|
("woff2"); font-disple address.self%60+is.%0A++++++++unsafe+%7B+self.map_unche7D%0A 29.5" viewBox=3D" contents.</p>
|
|
<p>A <code><a href=3D"https:// href=3D"https://doc.rustr(--trait-lin=
|
|
k-color); }
|
|
{ margin: 0px 02" crossorigin=3D+++++++let+mut+boang.org/std/od-printable
|
|
Contenle-count-color:1059cd0.svg
|
|
|
|
<svg xmlns=3D"httpat is in conflict with pinning.</p>
|
|
<p oc.rust-lan=
|
|
g.org/static.files/Sourcther
|
|
the pinned</a><<a href=3D"https:var(--code-block-background-color); }
|
|
|
|
></a></.org/std/pin/index.htn">Pin</a><<a href=3D"https=
|
|
://doc.rust-lanoff2") flay: swap; }
|
|
|
|
@font-face { font-famro"ef.html#asso=
|
|
ciatedtype.Target" titleelems { margin-top: 1em; }
|
|
.anchruct </span>Unmovable {
|
|
data: Se.html#tymetho=
|
|
d.poll" title
|
|
::-webkit-scs://doc.rust-lstd/pin/=
|
|
struct.Pin.html" title=3D"struct keyword > i { colo=
|
|
r: var(--main-color); mory does not change, and canfont-weighren=
|
|
ce">&mut</a> T></code>.
|
|
Then we cself:+Pin%3C%26mut+Self%ils.toggle > summary:not(. box-sizing: border-box; color: inheritipl-items > "utf-8";
|
|
|
|
@font-face { 48 1.293-1.848 1.93 0 .64-.898 1.16-1.><meta name=3D"generator" content=3D"r=
|
|
ustd/pin/index.html
|
|
|
|
<!DOCTYP0 0 1-.37nd <a href=3D"htthover-border); }
|
|
|
|
#crate-search-de=3D"struct std=
|
|
::pin::Pin">Pin</a><P></ompile:
|
|
// let mut new_unmoved =3D Unmovable::ne data,
|
|
255); background-color: rgb(250 100 0/ref=3D"https://pla=
|
|
y.rust-lang.org/?code= struct might num</code>, and also =
|
|
when considermmary.hideme > span, .more-exam============================================pe-contents-toggle { contain: initial; }
|
|
|
|
.stop: 10px; margin-b; bottom: 8px; right: 5px; padding: 2px 4px; bet </span>res vable {
|
|
<span class=3D"c====================================e6868; --0px; }
|
|
}
|
|
|
|
@media (max-/a> f
|
|
|
|
.example-wrap.ignore:hover { border-left: 2px ntainer { margin-ottom: 10px; text-alig=
|
|
amp;mut T` to th.875rem; }
|
|
|
|
.docblock { margin-left: 24px; positcol}
|
|
|
|
.exam.search-results.active { display:lo5-1.75 1.667c0 +%7B%0A++++++++let+res+=3D+Unmovablang.org/std/collections/struct.Vecwith a normal reference,
|
|
// as this pattg button.gap-6 { gap: 24px; }
|
|
tab { padding be aware that deciding to make
|
|
use o>drop</code></a> functioce: nn/index.://doc.rust-lang.org/std/primitive.reference.hstruct.Pin.html" title=
|
|
=3D"stf2"); font-display: swap; }
|
|
|
|
@font-face { fx">Bo=
|
|
x</a>&lhttps://doc.rusell.html"=
|
|
tst-=
|
|
lang.org/std/pin/index.htmlckground-color: #484848; --searc=
|
|
h-resuf a datt-arrow { visibility: hidden; positioe data fiere.rust .doccomment { color: var(--code-hig --search-=
|
|
tab-button-selected3D"#var(--code-highlight-comment-color); }
|
|
|
|
phligod that takes just <code>olor); padding: 0px 8px; }
|
|
|
|
t: 500; }
|
|
|
|
#crate-searcht;></code> is a refe=
|
|
rence-counted pointer ans-Regular-018c141bf0843ffd.woff2=
|
|
"0); }
|
|
------MultipartBx=3D"-60" yst-lang.org
|
|
-toggle-line-background: #999; doc.rust-lang.org/static.fileD"drop-implementation"><a href=3D"https://dpin-button, [type=3D"number"]::-webkit-ou=
|
|
ter-s============================================== -1px 0px E,%0A++++_pin:+PhantomPi.64.012.8-.644.5-1.004 1.302-.992 =
|
|
2.259.008.726gin-bo=
|
|
ttom: 5px; }
|
|
|
|
.item-name .staer=
|
|
.tooltip { co========================ryle: normal; font-weight=
|
|
: rust-example-D"font/woff"" .058.445-.016.785-.04.168-side/code></a<h2 id=3oc.rust-lang.org/fore { background: url("data:image/svg+d/pin/struct.Pin.html" =
|
|
=============ortant; font-size: 14px !important; line-heig }
|
|
|
|
earch-div:hover::after, #crate-see-wrap; }
|
|
|
|
.top-doc .docblock h2 { foxample:not(.expanded) .code-wrapper::before, .sf-referential struct because the sl=
|
|
ice <use xlink:href=3D0)" />
|
|
<use xlink:<
|
|
ht-number-color: #83a300; --code"https://doc.rust-lan}
|
|
|
|
div[data-sectoloc.rust-lang.org/stdd std::ops.Vec.html=
|
|
" title=3D"Vec">Vec</a><T></cang.org/std/cell/struct.Ref-left: 2px; margin-right: 2px; b=
|
|
order-botttruct.Pin.html" titnt: "Since "; }
|
|
.sidebarn-items: center; background: rgbr: rgb(231, 241, if your type was previously pitymethod.drop" title=3D"m
|
|
/struct.Box.html" title=3D"Box">Box</a><Ty do not have structuraxed; top: 45px; left: -1000px; z-iground: none; borde=
|
|
r: none; appearential+struct+hen=
|
|
ce its fields) might have been pinned
|
|
beer-ttings" src=3D"h=
|
|
tto----
|
|
Content-Tya href=3D"https://doc.ru.rust-lang.orglight-prelude-val-color); }
|
|
|
|
pre.ru
|
|
|
|
button { padding: 1px 6px; cursor: pointer;bu
|
|
<code><ad-colors unsafe code, so the fact th; border-top-color: var(--search-tab-button-bd-backgrounm; gap: 8ppinned=E2=80=9D. Things get more s-.77-.554C17.919 1.172 16.349 0 14.297 0h-1.155c-2The same question code>:
|
|
when a <code><a href=3D"https://doc.ruste3D"https://doc.rust-lang.org/s<le top-doc" open=3D""><summary class=3D"hideme">order-color: var(--crate-sear41a7b69.cs-.106-.04-.=
|
|
41.pple Color Emoji\"", "(using <code><a href=3D"h=
|
|
ttps://doc.rust-lCel(157e it can lead to: inhey of ngs-7b=
|
|
fb4c59cc6bc502.css" data-theme-light-css type="text/html";
|
|
boundary="----Multipaauto; ov=
|
|
erf"SourceSerif4-It-acdfaf1a8a=
|
|
f734struct.Pin.html" title=3D"struct std::pin::Pin">s://doc.rust-lang.org/std/mem/fn.swap.h { font-weight: normal; font-size: : =
|
|
10px; }
|
|
|
|
.rustdr,+though+one+which+is+ke: 1.125rem; }
|
|
|
|
#he=3D"" data-resource-suffix=3D"1.70t<=
|
|
/a> Field</code>?
|
|
arises with the fields of: none; outline: none; }
|
|
|
|
detailaps a pointer type <code>P</code>, so
|
|
<: htt=93=98</a><pre class=3D"rust rust-example-rendeor); }
|
|
|
|
.ignore.examoved+before+we+even+startd/ptr/fn.write.html" title=3D"ptr::write"><elp you
|
|
not s/dark-1097f8e92a01e3cf.css" ti0ion: relative; }
|
|
|
|
.docblock > :not(.m to drop them. It might even do
|
|
that for fitle=3D"mutable reference">&mgn-items: center; =
|
|
justifng-left: 24px; }
|
|
|
|
ul ul, ol ul, ul ol, ol2.29<T></code>
|
|
or <lang.org/std///nce">&=
|
|
mut</a> T</code3D"reset"], [; }
|
|
|
|
fieldset { padd/p>
|
|
<h3 id=3D"pinnoc.rust32-.86 1.48-.62=
|
|
5 2.554 0 0 .008.04.008 1.102searchab This includes all ther-background-end)); }
|
|
{ color: var(--assoc-D"{"d/mem/frust-lang.org/std/inde.031c-.543-.953-.555-1.98-.024-2.285.53ref=3D"https://doc.rust-lang.org/stdackgro=
|
|
und: linear-gradient(to top,var(--struc=
|
|
t.Vec.html" title=3D"Vec">Vec</a>&lndered"><code=
|
|
><s" xmlns=3"http://www.w3.organg.org/s=
|
|
td/boxed/struct.Box.html" title=3D"-ignore-color); }
|
|
|
|
.example-wrap.compile.
|
|
</span><sp20d218678b618.svg"=
|
|
><!--[if lte IE 11]><div3D"alternate icon" type=3D"image/png" href=3Dnsform: none; }
|
|
|
|
[type=3D"button"], [type=ing: o <code>impl <a href=3D"htt================= title=3D"tr 1 5.325 5.32=
|
|
5.328 5.328 0 0 1-5.325 5.325Zm 100%; overflow: auto;ze: 1.5rem; text-align: cedocblock h6 { font-size: 1rem; }
|
|
|
|
.docblock h5 {ex:es-toggle { max-width: calc(100% + 25px); mc.html" title=3D"Vec">
|
|
to call <a href=3D"https://doc.rust-la
|
|
2-3.168 2.14l-.59 1 <code><a href=3D"https:/=
|
|
/doc.rust-lang.oar(--button-back" ti=
|
|
tle=3D"cell::RefCell">Rshort pre code { paddinmargin-left: 9px; }
|
|
|
|
damp=
|
|
;mut </span><span class=3D"self">self</sp34px; margin-lg: 0px 0px 0px 2px=
|
|
; bo ht-doc-cfetilang.org/std=
|
|
/primitiv.org/2000/svg\"><path=
|
|
d=3Dike
|
|
<://doc.rust-lang.org/s0px; }
|
|
|
|
.main-heading h1 { margin: 0px; padding:emory." dott=
|
|
ed 1px; outline-offse</div>
|
|
<p>It is wort==================================================r: #717171; --scro=
|
|
llbar-thumb-backgroun-> Pin<Box&=
|
|
lt;<span cfiles/Sour=
|
|
ceSerif4-Bold-a2c9cd1067f8b328.t because we know =
|
|
this value iius: 3px; border-width: 1px 1px 1px 0px; border--left: 0px; }
|
|
"), url("chrome: relative; bin::as_mut(%26mut+=
|
|
boxed);%0A++++++++++++Pidding-bott@mhtml.blink
|
|
|
|
@charsetoke-line=
|
|
join=3D"round" poiguaranteed not to move,
|
|
in the sense that thd suc=
|
|
cessor in
|
|
the list. Elements castatic.get_pin_mut();+%7D+//+Here+we+get+pinnb
|
|
lang.org/std/pihtml#pinningock h3 ont-sopt
|
|
<code><a href=3D"https://dociground-color: rgb(=
|
|
18 24 26/var(--tw-25px; t=
|
|
op:5px; margin: 0px; line-height: 1; code, pre, a.test-arrow, .code-hen class=3D"kw">foc.=
|
|
.105}
|
|
|
|
.rustdoc:not(.source) .example-wrap pr
|
|
|
|
.sub-variant h4 form=3D"rotate(72)" />
|
|
<use xlink:hrefings-menu > a:hov-1.6; font-fa--search-result-l=
|
|
ink-focus-background-color: 5px; }
|
|
.rustdoc { display: blockrotate(225.00)" />
|
|
<use xlink:hra href=3D"https://doc.rust-lang.org/std/pin/strked_mut" titl <polygon id=3H13.14c-1.102 =
|
|
0-2-.515-2-1.14 0-.63-.832-1.47
|
|
you ca: cants if one of the
|
|
destructors panics. ove the <code>T</code>:=
|
|
the <code><a hrng.org/std/mr a { color: var(--sidebar-link-color); e > summaord-link-color: #d29=
|
|
91d; --modc.rust-l=
|
|
ang.org/std a:hover, .search-resul</section></div=
|
|
></main></bo/code></a> combinator,=
|
|
yrence.html" title=3D"m4 0-.656.898-1.191 2-1.191h1.156c1.09imitive.reference.html"ding self-referential struc=
|
|
, a.trait, span.traitaliass data.</p>
|
|
<p>For a more complex example o4px; color: rgb(255, 255, 255); font-s=ss"></div><link pointed-to type <code>-rust-logo/std/mem/fn.swapplacing a <code><a href=3D"httpd.unsafe.html" title=3D"keyword =
|
|
unsafn">> \9 </svg>"); filterst-lang.org/static.files/clipboarda 2.5H2.5v12H5m7-12e, monospace; font-size: 1 { clt-link-focus-background-color); }
|
|
|
|
.search-reust-lDeqfn+main()+%7B%0Ause+std::=
|
|
pithat <span class=3D"comment">// This i57Zm0 0"/></svgary--ZqvRansform=3D"rotate(22.50)" />
|
|
<use xltle=3D"struct std::pin::Pin">Pin</a><<a =
|
|
ct std::pin::Pin">Pin</a>&l5, 255) !imp>impl<T> <a href=3D"https://doc.rust-l5011b6st-lanD"#coglink:href=3D"#cog" transform=3D"rotate(258.ction, .im3D"3" stroke-linejo=ode> does not actually mef=3D"https:doc.rust-lang.org/std/pin/struct.h-resultsts a:focus { backgro <rect =3D"-60" width=3D"120" height=, .sidebar-menu-toggle, #src-sidebar-toggle, #so data to its=
|
|
location in memory.</p>
|
|
ro" href=3D"=
|
|
https:td::marker::Unpin-height: 0; position: relative53,1); --scrape-example-co=
|
|
hld.
|
|
// We cannot inform the compiler aboutemsitle=3D"=
|
|
traitent-Transfert">// Actual drop code32 1.965 2.16 3.149 2.16=
|
|
.324 0 .644-.0ilter); }
|
|
|
|
.sidebar { font-size: 0.875rem; f 5HLvXQrJ9wZdrptFy8o--.orent-Transfer-Enc75rAxxEQH8LkhDBOtalQHLvXQrJ9wZdrptFy8o------
|
|
|
|
w3.org=
|
|
/200rust-la3D"trait std::marker::Unpin">Un: 1.5rem; padding//doc=
|
|
.rust-langang.org/std/primitivchor { display: none; position:unmoved,+%26mut+not move a field inside your <a h=
|
|
argin-top: 12px !im;=
|
|
P></code>. For <code>T: <a ight: rder:
|
|
|
|
h1, h2, h3, h4 { margin: 25px 0px 15px; pass=3D"self">Self</span>>> {
|
|
ttps://doc.rust-lang.orlight-focus); }
|
|
|
|
.more-examplargin-top: 10px;
|
|
" title=3D"struct st
|
|
|
|
span.keyword, a.keyword { color: var(--keywt-family: "Source Serif 4
|
|
|
|
.stab.portability > code { bag/std/prieel-7b819b610://wwttps://doc.rust-lang.source-sidebar-expdebar, .rustdoc:not(.=
|
|
sourcp>
|
|
<p>It turns out that it is actually up to the3D"struct stdex.htt;<span class=3D"kw-2"ps://doc.rust-lang.org/std/o=
|
|
ps/trait.Dolor=
|
|
: var(--type-link-cr); }
|
|
|
|
span.trait,s://dot: auto=
|
|
; margin-right: auto; }
|
|
|
|
#searchollapse: collapse; }
|
|
|
|
.docblock ta
|
|
uarantee">skip to where t>.</p>
|
|
|
|
<di 100%; background: var(--scr><code>drscrape-examplhtml" title=3D"trait std::o
|
|
.source .s <a hrrgin: 0px; flex-grow: 1; e { ot of their <code>sel=
|
|
f</code>=
|
|
2.723-.114.14-.391.382-.758.5ils.non-exhaustive { margin-bottom: 8pxone; border: 1px solid var(--bo=
|
|
rcode> itself that gow" target=3D"_blank" href=3D"https:r(--main;T></code> can fail=ng.org/st; } <smples"><a href=3D"https://doc.rust-lang.or-lang.org/settings.html" title=3D=
|
|
"lt=3s://doc.rust-lang.org/=
|
|
std/ops/traiark-1097f8e92a01e3cf.css
|
|
|
|
@cha.3v1.011c-.215 1.051.07 2.176.636 2.5.567.325.58=
|
|
ker::Unpin"><code>Unpin</code></a>. Wr: rgba(32,34,37,.6); --scrollbar-color: rgba(32-t;=
|
|
</code> and <cing a st basic types (la href=3D"https://docre.
|
|
</span>}
|
|
}
|
|
}</co=
|
|
/var(--code-highlight-=
|
|
macro-color); }
|
|
|
|
ait.Unpin.62 2.336-.574
|
|
6 implementing a type =
|
|
that
|
|
x; padding: 0px; white-space: pr=
|
|
e-wrap; }
|
|
|
|
#" title=3D"coll=
|
|
cs">[<span>=E2=88=92</span>]</bu=
|
|
le=3D"Option">Option</a><ipan><span class=3D"kw-2">mut </span>still_=
|
|
r-46f98efaafac5295.ttf.woff2"ant; f=
|
|
ont-(--search-co=
|
|
lor); }
|
|
|
|
.search-.59-1.028.777-2.164.52-3=s, =
|
|
because moving the
|
|
<code><a href=3D"
|
|
.scispa 1.146 1.146 0 0 tent=3D"Types that pin data to its lo=
|
|
cation in ght: 32px; }
|
|
|
|
.sub-logo-container > img { heheap+where+it+wil=
|
|
l+stay+for+ield></code> or <code><a href=3D"httpnt-size: 14px !important; line-height: 2ox-sizing: border-boxt-size: 1rem; }
|
|
|
|
r { }
|
|
rollbar { width: 12pxcblock > .example-wrap:first-chilaped-example .examptd::marker::Unpin=
|
|
"><code>Unpin</co.org/std/primitivrs to itself will invalidate them, which cou=0, 202) !important;on-2c0 class=3D"warning">This ocode></a> implementation asahideme)::before { position: absolu" \9 width=3D\"128\" height=3D\"128\cribedkground00)" />
|
|
<use in</a><P></code>) from being moved by mype+%7B%0A++++fn+drop(%26m=
|
|
uem> change the fact that a Rust
|
|
comlight-divider { margin: 8px 0px; flex-shrpropagates=E2=80=9D to this field or nox; outlin: 16px; }
|
|
|
|
@media (max-width: 70tom: 0.6em; }
|
|
|
|
ader { font-family: "Source Code bar-toggle > button:focus { ba=
|
|
ckground-c)" />
|
|
<use xlin
|
|
|
|
.more-scraped-examples .scraped-et invalidated or repurposedh2 { paom: 0px; margin: auto 0.5em audius: 4pe: none; cursor: pla=
|
|
y.rust-lang.org/?code=3D%23!%5Bal"fcode>Future<ou will usually fset: 48px; "><code>drop</code></a>,ang.org/std/ops/trait.DerefMut
|
|
=C2=B7 <ngg/std/marker/traitsolid; }
|
|
#copmain-backgrotring());
|
|
// std::mem::-section=3D"data-scispace-plugin-hi.example-wrap pre.rust a { backgroune-extension://c=
|
|
ipccbpjpemcnijhjcdjmkjhmhniiickprintable
|
|
Content-Location: https://doc.rust-example-list .scrape-help:hover { border 1.25; padding-top: 3px; padding-bottom:mall-section-header > .anca witho=
|
|
ut chin 0=
|
|
px 0px; border-style: solid; border-color:mBarunGothic, sans-serif; }
|
|
|
|
#toggle-allD"item-ts://doc.rust-lang.org/static.files/rust-lo=3D"kw-2">&mut </span>RefCell<T>>n-to havee> and <code><a hre=
|
|
f=3D"https://doc.rust-lang.arg=
|
|
et">Target</a></code>,
|
|
not the pointrait.Drop.html#tymethod.drop" tit strong { font-weightc.rust-lang.org/std/pin/sle=
|
|
alpan>Field {
|
|
<span class=3D"comment">::Pin">Pin</a><<a href=3D"https://doc.rust-l" t: relata><T></code>=
|
|
,
|
|
that opitive.refers we know it's pointing at the stricontainer"] button { dis=
|
|
play: flsplay: none.5 12V8.625v0V5\"/></svg>") left t=
|
|
op no-repeat;n</a><<a href=3D"htng.org/std/ops/tra std::ops::Drop::drop"><codehtml#associatedtype.Tam> h
|
|
|
|
span.attr, a.attr, span.derive, a.derive, spanml"ait std::markepx 20px 20px 17px;=
|
|
}
|
|
|
|
.item-inf; font-dd;%0Aasser(%26=
|
|
still_unmoved.daLocatimage/png" href=3D"https://doooltip .content code { backgroundginom: 1px solid var(--search-result-border-c bool"><code>bool</code></a>, <a href=3D"https:ode>inner_drop</codet(.hideme)::before, #main-conten
|
|
sstatic.files/whw.w3.ors=3D"kw-, =
|
|
rrectness, <code><d { width: initial !important; }
|
|
}
|
|
px 6px -1px var(-- Sans GB", "Microsof/std/pin/struct.Pin.html" tic: url("SourceCoffset-shadow, 0 0 rgba(0, 0, 0, 0)),var(--tw" height=" stroke"blc-0f09=
|
|
457c7a19b7c6.ttf.woff2") formanset: 0px; position: fixed; =
|
|
z-index: 2stdoc .example-wratop:t.Box.html" title=3D"Boitle=3D"cell::RefCellc.files/FiraSans-Medium"data-scispace-plugin-highlight-co =E2=80=9Cinvalhis is catastrophic, it means we can fir"Box">Boxposition: relative;=, 47, 5city: 1; background-color: rgb(255 255 : "Source ; }
|
|
dding-bottom: 6px; }
|
|
r: #999; --settings-button-=
|
|
color: #000; --sett, .-resu=
|
|
lts a, .stab, .resulns::VecDe; position: relativ { font-weight: 500; }
|
|
|
|
table, .item-table { ove, .fn .where, .w>-search-div-filter: tighlight-doc-comment-color: /struct.Box.html" tititle=3D=
|
|
"Box">Box</a>D"kw">let </span>rc_shr:.632 3.746 2z-ind 2; margin-to=
|
|
p: 7prence">&a
|
|
content is n-decoration { appearanone; }
|
|
|
|
::-webkit-file-flex; vertical-align: text-b_*new_u=
|
|
nmoved);%0A%7l forwards running scisp=
|
|
ace-c.
|
|
.scispace-plugin-max=3D"https://doc.ruy { margin-left: 10px; }
|
|
.impl-itemscreated.<ing-is-structural-for-field"><a href=3D"he > div { width: 50%; f dat=
|
|
a-theme-dark-css=3D"da 1.21 0 .669.832 1.555 sD"#cog" transform=3D"rotate(191.25)" />
|
|
href=3D"#cog" tr none; color: var(--stabtf.w; font-style: italic; fofMut.html" title=3D"ops::D3D"self">self</s=
|
|
pan105 1.25-1.636 1.25a.7.7 =
|
|
1-.0940-.3D"https://doc.=
|
|
rust-lang.org/std/pin/struv><nav c></a>.re you get to decide for each ummary::-webkit-details-marker, det086.235a1.958 1.=3D"mutable refe=
|
|
rence">&mut</a> Flang.org/=
|
|
std/pin/Ptransform=3D"rotate(326.25)" />
|
|
<use xlink:; -search-results-grey-color: #ccc; inecap=3hee-wrapper { dode> itself is fine with being moved as w=
|
|
ell, .example-wrap.should_panic:unsafe+%7B+%26mut+self.get_unchecked_muvar(--kbd-box-shadow-color); }
|
|
|
|
ul.all-items > l594ass=3D"self">self</sex-direction: row; justify-D"struct std::pin::Pin">Pin</a>&l=
|
|
t;<a href=m::swap` needs `&mut T`, buline { position: absolute; top: 5p9.766.52.164 1.519 1.718 2.632=
|
|
h1.t+Unpin,+thi=
|
|
s+will+fail+to+compile:%0A-usual+borrowing+rules=
|
|
.%0A//+Instead+raw+pointlang.org/std/option/en}
|
|
|
|
.examper-filove that
|
|
content using theas <code><a href=3D"https://doc.rust-la=
|
|
ng.oroc .docblock >into <code>it</a=
|
|
> Self></code>) has consequencs=3D"46,3 51,0 nd <a href=3D"https://doc.rust-langspace: nowrap; text-overflow: elin/struct.Pin.htmlcode>, we dis"kw">use </span>std::pin::Pin;
|
|
<span class<span class=3D"kw">unsafe </span>{ <spplay: flex; padding: 3px; marb { margi "Segoe UI=
|
|
Emoji", "Segoe UI Symbol"; z-ce-sid=
|
|
ebar-backgeffect ov[dataghlight-container"] .scispace-hi=
|
|
,
|
|
we justhavior of
|
|
d datalling <a h/ops/trait.Drop.ht; }
|
|
|
|
.popover.tooltip .cont var(--border-ign-items: baseline; }
|
|
|
|
#crate-search-div { po
|
|
olute; left: -24px; }
|
|
|
|
de
|
|
an { text-decorationmmary:hover, #sour=
|
|
ce-sidebar div.fiolor); background-color: varg.org/std/marker/trait.U=
|
|
npin.html" title=3D"trabe pef=3D"#cog" transfor/=
|
|
trait.Unpin.html" title=pin<or Struct</=
|
|
coell; }
|
|
|
|
.item-table > li > .item-name { pach-divap"><pre class=3D"rust rust-example-renderes.toggle > sun</a><<a hrehado=
|
|
w(0 1px 0 #fff)id=3D"drop-guarantee"><ax; adow-root=
|
|
=3 could <em>not</em=
|
|
> adata-search-js=3D"search-e077946657036aailmmary { list-styleproblem in safe code becauvar(--bordheight: 0px; overflow: visibler: var(--codeblock-errRun</a>ss=3D"kw">unsafe </span>{
|
|
/code></a> as impre we even started
|
|
</span>slice: NonNkground); }
|
|
|
|
.more-scrapeormal; }
|
|
|
|
progress { vertic}
|
|
|
|
.mor data is restric("world".to_sswobilsummary::before { left: -11px; }
|
|
.impl-items />
|
|
</g>+cannot+swap+the+contents+ofan class=3 <span class=3D"kws/struct.VecDeque=
|
|
.html" titl;<span class=3D"kw=
|
|
-2">c.rust-marker/=
|
|
traitpaotate(202.50)" />
|
|
|
|
pointerate: Thu, 6 Jul 2023 12:25:25 -0000
|
|
M/a><<a href=3D"https://if the s/doc.rust-lang.org/std/pin/ind1" class=3D"grammarly-desktop-integratio=
|
|
n" d></span><input class=3ecauay: none; }
|
|
.item-table, .itenospacext-align: ependent of whether the
|
|
pointh-tabs button { elected-background)not=
|
|
-selected-border-top-x; background-color: rgba(0, 0, : 1rem; flex-grow: =
|
|
hlighted-background- location=
|
|
,
|
|
// so portant; }
|
|
|
|
.scispace-plugin-alertdialog .scisp stroke=3D"black" stroke-width=3D"9" />
|
|
<g non-pinned dataom-style: solid; bor=
|
|
d monospacem; }
|
|
|
|
a { background-colorg/?code=3D%23!%5Ballow(unused)%5D%0Afn+main()+%7By-value,
|
|
andnpin">Unpin</a></code>,
|
|
<code><::Pin::code-block-bac=
|
|
kground-colethod, a.tym
|
|
.example-wrap .tooltip { position: absolute; decide that some field does not haveohref=ef=3D"#cog" transform=3D"rotate(348.75)"
|
|
<g itop: 1em; }
|
|
|
|
* { }
|
|
|
|
.sideba; ents can live on a stack frame that +%7B%0A++++//+To+ensure+the+datt std::pin::Pin">Pin</a><<a href=3D"ht-1.667h5A3.
|
|
e">&Struct></code>
|
|
into <code><a hgo"></a><h2><a wrap: anywhere; }
|
|
nav.sub { fleyle: none; }
|
|
|
|
details.dir-entry { padding-lef
|
|
details.toggle > summary.hideme ; back-bg-ophtsie target=3D"_blank" href=3D"https://pla=
|
|
y.sidebar-elems a, .sidebar > h2 a { display: ng.org/std/mall">RefCell</a><T></h2>
|
|
ymbolis not</em> strmay seem coutd/vec/struct.Vec.html#method.pop" ti=
|
|
tle=3Dary > * { display: inline-block; }
|
|
|
|
.oted-printable
|
|
Cont/spanze-76eba96=
|
|
re pinned, but the pointers themselves=n-left: 24pent
|
|
could be deallocated or otherwiseVec">Vec</a><T></=
|
|
code> ef=3D"https:/hat could lead to data be2 { color: var(-- baseline; }
|
|
|
|
tex3D"sel autocom=
|
|
pl--main-background-color">let </sunmoved mp;edition=3D=
|
|
2021">Run<e; min-width: 5em; }
|
|
|
|
#crate-search { display: block; margix; }
|
|
|
|
mut+T%60+to+the+same+data.%0A%7D%0A%7s
|
|
|
|
@charset "utf-8";
|
|
|
|
html { line-hetab-pinniansform: rotate(-45deg); totem-info { margin-left: 34px; }
|
|
.ing: 8px; --tw-bg-opacity:an object with pointtural-pinning">Projections =
|
|
and Structural Pinnstd/markede> <em>even if</em> the type of <co<use xlink:hr
|
|
|
|
h3 { font-size: 1a selfield points to tt that eref=3D"#cog" transform=3D"rotate(=
|
|
ass=3D"logo-container" href=3D"htment">// we knowarch, h1, h2, h3, h"><link rel=3D"stylesheet" type=3D"text/=
|
|
;T> <a href=3D"htt/std/ops/trait.Drop.html#ethod =.ore { color: var(--togglef-band, span.since=
|
|
, a.srclink, #help-button >nning
|
|
px; }
|
|
|
|
.impl-iten: cente+=3D+rc.as_mut()ed+access+bar .location { display: none;p: 0px; left: 0px; font-size: 1.2s\" stro=
|
|
ke=3D\"black\", .methods > .toggle[open]:not(:last-child), .i5px; }
|
|
|
|
.docblock > h2:first-child, .docblock >inned data you e> on them (like <a href=3D"ht=
|
|
tpsht-radt=
|
|
op-style: solid; border-right-style: -button-border-focus: #ffb900; --siis pinned is entireerflow: hidden; }
|
|
|
|
.mobile-topbar .203-.551-2.516-.5=
|
|
4-.304-.54-1.34#help span.top, #help span.bottom { text-aligr(--un=
|
|
s/rust-logo-151179464ae7ed46.tart: rgba(53,53,
|
|
de-wrapper-background-end: rgba.org/its predecessor and successtruct std::pin::Pin">doubly-nvalidating the memory use1d; --sidebar-link-color=
|
|
: #fd</code></a>
|
|
auto-trait, which cancels tked)]</code> type.</p>
|
|
<h2 id=3D"pro none=
|
|
!important; rust-lang.org/static.files/drs
|
|
er-color: #a=3D"width-limiter" titdoc.rust-lang.org/st: cid:css-46202b4e-490d-4575-add2-82f9f9in-butt.%0A++++//+We+could+use+%60Pin::get_unchecked_mut%.highlField+=3D+i32;%0Astruct+(the <code>e struct must not move structural//doc.rust-lang.org/std/boxed/struct.Boxadi=
|
|
us: 3px; color: var(--kbd-colowith type
|
|
<code>fn(<a href=3D"http::pin::Pi-inf--scrollbar-t"><code>poll</code></a> implementation).=
|
|
</p>
|
|
ld</eave, so this m=
|
|
akes sure that
|
|
you dsize: 32px; borderit.Droh5, h6 { margin: 15px 0px h3:first-child, .dd::ops::Drng-left: 15px; e-sidebar-expanded .source .sidebar { ov
|
|
x 4px; cursor: truct.RefCe=
|
|
ll.html" title=3D"cell::RefCe/cotrack { backgight: 30px;=
|
|
height: 30px; }
|
|
|
|
.super flex-direction: row; poef=3D"https://do=
|
|
ou cannot use
|
|
pinning with a <code>#[repr(ue</a><d/ops/trap.html#tymet=
|
|
hod.drop" title=3e-wrapper .prev { right: 2.25erch-in=
|
|
in the3L20 doc.rust-lang.org/std/vec/struct. =
|
|
font-stut_ref: Pin<&mut </span><span class=3/std/pin/ruct std::pin::Pin">Pinops/tode><a hunmoved, &mut *new_unmo 0 1 .403-.102c.55 0 1.223.=
|
|
47.117l-.594-1.032c-.7-2H4zM15 15v-3l-4e <code><a href=3D"https://doc.rust-lang.orfc7edfont-family: ProximaVa drop-shadow(-1px 0er > .anchor, .variant:hover > .anchor { displaity)); opacity: 0.5; i147483647; }
|
|
|
|
.scispace-pl" titleolor: ; border-bottom-style: ; border-f=3D"https://doc.rusheadings-border-bottom-colorref=3D"https://doc.rusordeolor); in/index.html#macros"ylcess them with =
|
|
a
|
|
mutable reference eveneang.o type=3D"font/woff2" crossorigin=3D"" hr=
|
|
ef=3D"h takes
|
|
<code><a href=3D"https:rape-eocus { background: var=
|
|
(--scrape-example-codst make sure that you uphold ack" stroke-width=3D"6" strnts=3D"-7,-42div id=3D"hel/std/p=
|
|
in/struc" />
|
|
href=3D"#cog" transl("chrom/static/fonts/proxima-vara-roman-black.f9antomPinned,
|
|
};
|
|
ils.toggr; background-colodebar h2 { overflow-wrap: anywhere; paddines, as you need to get pinned ref:href=3D"#cog" transform=3Dble-backgrounn.forget.html" title=3D"td/pin/struct.Pi
|
|
|
|
[type=3D"search"] { appearance: t<code>mem::swa format("woff2"); font-display: swap;-c=
|
|
olor: var(--scrollba>
|
|
<use xlink"rotate(112.ocated without t.Box.html" title=3D"Box">Boxoment =
|
|
it gets pinned until
|
|
when <a href=3not(:last-chi"), url("FiraSans-Medium-8f9a781e4970d388.wof=
|
|
code><a hretural=E2=80=9D,
|
|
because it followggle:not(.top-doc) > summary::before, #main-contenack-background-colod-colo=
|
|
,34,37,.6) #5a:focus, #help-button > a:t std::pin::Pin">Pin</a><<a href=3D"hrm=3D"rotate(123.75)fone of this is allowed for pinneml#tym=
|
|
e}
|
|
|
|
.searcund-color: var(--=
|
|
search-resusult <use xlink:href=3 <use xlink:href=3Dlor: var(--settings-> summar > details.toggle movable, even when pinned, becau hidden; s .result-name spago into more deated. Similarly, <c 1.25rem; }
|
|
|
|
.search-results-title: normal; font-weigh=
|
|
t: 400; src: ur
|
|
<use xlink:href=
|
|
.scispace-plugin-alertdialo
|
|
|
|
.scispace-last-child { margin-bottom: 0px;ta:+String,%0A+--search-tab-title/std/vec/struct.Vec.html" title=3D"
|
|
.scraped-example-title { position:-lang.org/static.files/wheel-7b819b
|
|
<p>The struct must only be <a href=3D"http tricky, as witnessed by <code><axed/strze-adjustss=3D"ayu-61=
|
|
4652228113ac93/primitive.bool.html" title=3D"prim.75567 1.667323 3.323 0 01=
|
|
10 0a3.323 3.323tion: sticky; to=
|
|
5rem; border-bottom: t: auto; }
|
|
|
|
details:not(.toggle) summalertdialog p { mportant; }
|
|
|
|
.scispa4px 6px -1px rgba(0
|
|
|
|
.sourcespan classclass=3D"comment">// `=
|
|
or: #999; --copy-pathD"kw">fn </span>drop(<span clase">&mut</a> T></code> is a lot like <cod-size: 1rem; }
|
|
|
|
.docblock h6 { font-site-space: nowrap; }
|
|
.molang.org/std/pin/struct.Pin.html" ti=
|
|
tle=::pin::scraped-example:not(.expanded) .code-wrapper de { border-radius> pro font-size: 1.1 isgin-bot ur9ab=
|
|
2034eea98d11ef4.woff2"ize: 1amscrape-example-hethe struct it is your responsibilityakground-end)); }
|
|
|
|
.scraped-examplem=3D"rotate(11.25)" />
|
|
<usng: 0px 0px 0p=
|
|
pointer; }
|
|
|
|
detaibottom-color);t, ex: 1; }
|
|
|
|
.sidebaass=3D"}
|
|
|
|
div[data-section=3D"data-href=3D"https://d
|
|
le-filtey: 1; }
|
|
a-section=3D"data-scispace-plugollectioque">VecDeqD"method linked
|
|
list element will patch the pointust-lang.o=
|
|
e></a>.)</p>rg/s=
|
|
td/primitive.reference.html" titleref=3D"#cog" transform=3D"rotate(281.25 sufficiently aligned.At a high level, a <f=3D"https://doc.rustcp" title=
|
|
=3D"method std::op is <a href=3D"https://doail .tool
|
|
<p>You must not offer any other oper=3D"url(#holes)">
|
|
<circle r=3D"43" <a-lang.org/std/marker/trait.Unpin.ht=
|
|
ml"
|
|
tding: 20px; }
|
|
|
|
.rustdoc.source .examp would just ste list. However you on></div></nav>; height: auto=
|
|
; : Ph
|
|
<span classrch:focus { bch=
|
|
-iv::75rAxxEQH8LkhDBOtalQ--"
|
|
|
|
|
|
or-hover: #6background); }
|
|
6cbd1; --filter: drop-shadowa>. <code><a href=3D"h.docblock tariant std::option::Optiodth: 384px; position: fixed;><div c=
|
|
lass=3D"item-name"><a class=3D"struc"; background-repeat: n=
|
|
o-repeaerence.html" title=
|
|
=3D"mutable reference">&y ever to
|
|
return a pointer to pined.slice, NonNull::from(=
|
|
<span c var(--kbd-backgrounfor+moving+things+ a safe trait do492 1.4=
|
|
02.777 2.012.777.242 0 .453-.047.62-. { colorust-lang.=
|
|
org/std/pin/index.html#drop-implementWe say that the
|
|
fntainer"] div { font-f=
|
|
amily: inhen//+let+mut+new_unmoved+=3D+Unmovable:ly:: transparent; }
|
|
|
|
abbr[title] {ust-lang.org/std::pin::Pig.org/std
|
|
<code><a href=3D"https://doc.re-example-help-corection: row; border=
|
|
-radius: 6px; box-shadow//doc.rust-lang.org/std/64tion/enum.Option.ht=
|
|
ml#variant.None" titlsform=36.3=
|
|
--macro-link-c}
|
|
or: vaSegoe UI Emoji\"", =
|
|
"\"e=
|
|
=3D"struct std::pin::Pin">Pin</3D"#cog" transfore xlink:href=3D"#cog" tr=
|
|
eld></code> or <code><a href=3D"httmut_ref:+Pin%3C%26mut+Self%3E+=3D+Pn::gtype uses pinning (stwo examples nt=3;mode":"full&unsafe+f=
|
|
or+a+reason: 0
|
|
details.toggle > sutic.files/normaliaa4d2ans"; font-style: normal; fone > li { display: table-row; } guarantee, becau:pin::Pin">Pin</a><<a href=td/boxed/struc=
|
|
t.linked list</a></h2>
|
|
<p>I3C%-lang.org/sb(255, 255, 2<co=3D"h=
|
|
ttps://doc.rust-lang.org/::mem::swap(%26mut+*sticispace-plugin-alertdialog button {: -0.5em; background:}
|
|
|
|
.anchor.field { left: -5g.orgorder-width=
|
|
: 2px 0px 0px; border-right-styls">Macros</a></li><li><a h=
|
|
ref=DBOtalQHLvXQrJ9wZdrpy8D"ops:m; }
|
|
|
|
.itemo
|
|
.item-info code { font-size: 0.875der { font-weight: 600; data-se=
|
|
ttings-js=3D"sonps://doc.rust-lang.org/stdE html><html lat the compiler can haccidentally break pinning.khDBOtalQHLvXQrJ9wZdrptFy8o--kit-scrollbar-th store the data is rest at-name .primitive > i, . .}
|
|
|
|
span.enum, to add something k" /><l=
|
|
ink rel=3D"stesheet" type=3D"text/css" hass=3D"item-table"><lie-color); }
|
|
|
|
.itine; vertical-ali=
|
|
gn: baseline; }
|
|
|
|
sn"; font-st 700; src: local("Source Serif 4 Bold")%3E)+-%3E+Pin%3C%=
|
|
ent; overflow: initial=
|
|
; tner_drop(<span cl 23,2 19,-2 18,-2 C 33,-10 24,-26 12,-=
|
|
26 H -3m: 0.625edden; widt=
|
|
h: 0px; height:mmary.hideme::after {h-img-filter); }
|
|
|
|
#copy-path:hoh-img-hoverss+=
|
|
it+would+be+through+a+pointer+t+//+%60mem::swap%60+needs+%60%26mut+T%60,+but+=3D"kw-2">&mubox-siit.Drop.h=
|
|
tml" title=3D"trai pinning a.org/std/marker/tr=
|
|
ait.Unpinpan>still_unmoved.data));
|
|
|
|
<s3D" inherit; text-align: center; bordp;mut</=
|
|
a> Struct>st-lang.org/std/boxed/struc">RefCell</a>&l flex; height: 4he memory gets
|
|
dnge=
|
|
: U+AC00-D7AF, U+11use xlink:href=3D"#cog" trans.084 7.084 0 0 0-7.083 7.08=
|
|
5 7.08sometimes useful to have objects th3D"mutable referennd-ct-Type: text/css
|
|
Content-Tra, .e) .sidebar:ption.html" tit;T><
|
|
<ol>
|
|
<li>s://doc.ru.04 2.325Zm0 0"/><patdth:=
|
|
100%; padding: 0px; white-spacin=
|
|
ned,n maer wil=
|
|
l automatica =E2=80=9C<code>P
|
|
<span class=3Dor { padding-right: 6px; }
|
|
|
|
ir-entry a { display: ble xlink:href=3D"#mount" triner" href=3D"http=
|
|
ibility: visible; }
|
|
|
|
#all-types { margin-}
|
|
has a stable locationappe
|
|
.scran+the+function+returns,%0A=================rack\" str33T&gode><a href=3D"https://doc.rust-lang.orme= fill=3D"wc=3D"https://doetails.toggle > summary::after { content: "Eat pin
|
|
<p>I> canle:not(. t-lang.org/std/fect-fit: contain;=
|
|
}
|
|
|
|
.rust-logo-docntent: "t; background-size: 20px; background?version=3D1.37-3.18-2.117-.379 0-.75./doc.rusutitle=3D"none; opacit
|
|
.s > summarydiv > d=
|
|
etails.toggle > summpx; }
|
|
#src-sory.
|
|
To mde>, and er-right: no=
|
|
ne; padding: 0px 8px; }
|
|
arch-form { positionive; nfocus-within { left: 0==================================gt;</code>: the destructor of
|
|
<code><a href=3D"ht>&p;mut </s// This is okay becautainer > img { height: 35px; width: 35px; margexample-help-color); }
|
|
|
|
.scrout of
|
|
the structura(255, 25in-alertdialog button.buttonPrimary { boral pinninglb=============717 1.717 0 0 1 .00<code>Unpinhe effect of <code><a href=3D"httpsn>swap_pins<T>(x: Pin&l class=3D"str=
|
|
ing">"hello"ertsveiv aria-lnsform=3D"rotate(213.75)" />
|
|
<unherit !importan=
|
|
t; font-weight: !important; paddinte-space:ed-e%0A//+We+cannot+ine_ftip, .example-wrap.shoulE9CFE593DD4A25@mhtml.blink>
|
|
Content-Traat contains the
|
|
ot over-border-color); mentation of aers of or to e=
|
|
move itself
|
|
s > a > div.desc { whitey: "Fira Sans", Arial, Nanu-docs, a.anchor,g thif moving data out o 5.333te; top: 100%; right: 0px; x; rap; text-overf>. A <code><a href=3D"https://doc.rust-Pioad" as=3D"font" type=3D"font/=
|
|
woff2" crossoridered pinned.
|
|
</span><span class=3D"kw;) -> <a href=3D"https://d-lang.or.rust-lang.org/std/vec/1,40.5L64,87.499L17td/ops/trait.Drop.html#tymethod.drop" ti--src-line-numb=
|
|
ers-span-color: #3b91e2; --src-td/vec/struct.Vec.htmls actually the easiettings: "kern", "lass=3D"bl94-1.031c
|
|
.117Zm-2.04
|
|
|
|
.sub-logo-containPin.html" title=3D"struct std: 3 H 34 V 5 C 34,13.=
|
|
reference.html" titl
|
|
p { margin: 0px 0"https://doc.rust-lr=
|
|
g/std/ops/traithout
|
|
@keyfra12c.617.14a.79.79 06 1.652 1.23l.59 1.032c.54n:hover { opacity: 0.; align-itcolols.dock; }
|
|
c.ng.org/std/marker/trait.Unpin.hcribed with the usual/ We could use `Pin::get_unchecked_mut`, but t a.currentrflowg/std/index.htm <span class=3D"kw">let </span>s { font-famil .small-section-headero-container { line-height: 0; display: block; }
|
|
0.3125em; }
|
|
|
|
.s: 0px 2px; font-size: 0.ebar-togg 23px 0px 4px; max-width: 100=
|
|
%; text-e-topbar .logo-container > img {
|
|
94a2.019 2.019 0 0 1-.832.403 2.51Pin">=
|
|
Pin
|
|
display: inlinf>) -tps://=
|
|
d0 0 27.4340 0 27.434 29.5"><path=
|
|
d=3D"M2ace-plugin-a></template=
|
|
></scispace-div><grammarly-desktop-ay funky things
|
|
he values they contain: you can
|
|
|
|
.modal-open { overflow: as=
|
|
olid var(--codeblock-err>
|
|
"#cog" transform=3D"r
|
|
|
|
.source nav.sub { margin: 0px 0px 1.101-1d =E2=80=9Cstrucs the structure of the type.
|
|
Inin-highlight-container"] div .scispac=
|
|
e-plugin-h;=
|
|
</code>. (Notice that adding a82f1c.png"><link rel=3D-opa255/var(--tw-bg-opacity)=
|
|
)c5741a7b69.css" id=3D"mainThemeStyle">backdrop, div[id^=3D"reader-helper"] { di=
|
|
splay }
|
|
boxed
|
|
}
|
|
}
|
|
|
|
<sn class=3"https://doc.rust=
|
|
-lang.org/std/pin/round-"><a href=3-hover: #444; --table-alt-row-bac=
|
|
kground-col: 16px; height: 16px; disp=
|
|
lay inline-block; verset); border-panded .source .sidebar { max-width: 100vw; widans-Regular-018c141bf0843ffray: Pin<<</a></h2><ul class=3abl.rust .lifetime { color: vart-fode-wrapper .exampl 2em; marial; }
|
|
m=3D"rotate(180.argin: 0px; list-style: nonex=
|
|
; alsition: relativ { min-widuct std::pin::Pin">Pin</a><<a href=3D"https: img { filter: var(--copex; bortant; }
|
|
|
|
div[datin-highlight-coter; display: flex; font-size:=
|
|
13k-color: #d2991d; --function-l=
|
|
ink-co); colors-toggle .hide-more</code> has no =
|
|
pinning project
|
|
|
|
.d .tooltl#tymethod.drop" title=3D"method std::ops:::marker::Unpin"><code>Unpin</coispace-plugin-maxi, var(--tw--in-out 50ms 1 normaopilot-fade-in; }
|
|
|
|
dirc.into_ref().get_ref();=
|
|
%0 initial; bo=
|
|
rder-top-style: solid; flex: len" title=3D"Vec::set_len"><code>Vec::set_len</coave to be able to rely on https://github.com/ru=
|
|
stinderem; height: 45px; width: 100%; lef your type is <code>#[rpr(packed)]</-line-highlight-focus: rgb(124,75,15); --.scmize
|
|
------Multi!important; }
|
|
#search-tabs .count { displa-integratinD"rotate.50)/pin/struct.Pin.html" title=3D"struct std::p
|
|
|
|
details.dir-entry > summary { m }
|
|
|
|
.scispace-pding: quoted-printable
|
|
Content-34.css"><link rel=3D"styt std:de></a> is a safe trait, so=3D"comment">// `new_unchecked` is okays never ue.fmt-newline { dii=
|
|
ghlight-literar(--nav-sub-mobile-padding); }
|
|
}
|
|
|
|
@media (mi1px solid var(--border-color);=
|
|
}
|
|
|
|
.side-by 0.375rdisplay=e > butto/struct.Pin.htmf=3D""woff2-extension://cip{ borde5.911-.793 1.666-1.7t;, met we canno=
|
|
t get it.
|
|
// We auct.Box.html" =
|
|
title=3D</a><T></cod --scrape-example-helpighlight-ex; flcontent: centcispace-plugiml" tection</a>: <a href=
|
|
=3D"https://doc.rust-lang.ans-seri\"Segoe UI Emoji\"", "\"Segoe doc=
|
|
.rust-langpx; font-fa/doc.rust-la=
|
|
ng.org/std/primitive.reference.h column; }
|
|
.search-form { align-sel.html" title=3D"mutable refeol.blinref=3D"cid:css-6d90d595-da0f-4eb1=
|
|
-bchref=3D"https=
|
|
:
|
|
|
|
sup { toield">Pinning <e=
|
|
Struc=
|
|
t></code> <a hret-lanl" title=3D"trait std::ops::Drop"><itial; }
|
|
|
|
.an absolute; leftpx; }
|
|
ak-word; }
|
|
|
|
.logo-container > img { height"kw">impl <bottom: 0px; }
|
|
|
|
.sub-variant { margin-left:ang.org/std/pin/struct.Pin.htm=
|
|
example-code-wrapper-background-st=
|
|
art),es, for the same reason:
|
|
de>value: T</code> locally.</div></lil" titl=
|
|
e color: var(--00%; }
|
|
|
|
body { dth=3D"1" stroke-linn `self`var(--sSelf=
|
|
</span>&gdoc.ang.org/std/pin/inde=
|
|
x.html#drop-g some operation on
|
|
<code><a href=3D"h//doc.rust-lang.org/std/=
|
|
pin/index.html#str; }
|
|
|
|
over { border=
|
|
-left:=
|
|
he elements
|
|
aroc"><meta name=description" D"-ata-contequot;,"isActive":=
|
|
ps://doc.rust-lang.org/std/pin/struct.p
|
|
let+pto+th=
|
|
e+%60T%60.%his guts are never pinned
|
|
and the <code><a href=3>this</code> in a way /le=3D"me=hod std::ops::Drop::drop">https://do.
|
|
title=3D"mutable reference">&mut<tainer"] .scispace-hi=
|
|
gh-example:ice:+NonNpinned then so is the field.</p>
|
|
<p>Thi{ collor); }
|
|
|
|
pre.rus=
|
|
ight-prelude-=
|
|
color
|
|
low: hidden; n::</a><<a href=3D"https://doc.rust teallocode><aAimpl+Unmmorml,<svgxmlns=3D\"http://www.0/svg\" viewBox=3D); border-r=
|
|
apointer; appearance: none; text-inb { backgroundr-thumb-background-col==========g { co../../.files/" data-current-crate=3D"======================================
|
|
px !impo 0.75em; }
|
|
|
|
.variants > .docblock, .impng ar-thumor); }
|
|
|
|
.hidden { display: none ndary--ZqvR75rAxxEQH8LkhDBOtalQHLvXQrJ9wZdrptFyn.html#method.get_unchece=3D"l; fonily: "Source Code Pro"; font-style: normal; fontable { margin: 0.5em 0px; border-cb================================================st-lang.org/s" ti=
|
|
tl><T>D"http
|
|
ct<T>>g/std/option/enum=
|
|
.Option.html" class=3D"mac//doc.rust- with <code><a oc.r</h1><span class=3D"out-of-band"><span class=3D"sef=3D"https:=
|
|
// border-radius: 2mily: -appl 0p=
|
|
x; section id=3D"main-content" class=00=
|
|
%; overflow-ain the invariant
|
|
t 0px; }
|
|
ttf.woff2"><link roLocation: httpgo-151179464ae7ed46.would invalidate the poinder: 2px solid rgb(69, 149, 213D"https://doed)%5D%0Afn+main()+%7B%0Aus=
|
|
e+stx 0px 6px; border-bottom: 1px solid vpon { height: auto; }extfield; outline-offsetl#tymethod.drop" title=3D"method std&mut</a> T</code>.</p>
|
|
<p>Note that.htm{ dislock { margin
|
|
main r: #earch-tabs button.selected { background-coloorm=3D"rotate(c.rust-lang.org/std/pin/index.htmOtalQHLvXrape-example-code-wrped-example .ce-wrap {not) make
|
|
sense. A <code><st-lang.org/stackgrou=
|
|
nd: rgb(127, 87, 17); border-radius:ght-qu=
|
|
estion-mark-color); }
|
|
|
|
pre.rust .commenD"Box">Box</a><T>&tenters span { color: var(--src-line-numbers=
|
|
lor)ox-s=
|
|
halexiLvXQrJ-plugin-alertdialog p > span08-346-=
|
|
1.304-1+alre }
|
|
|
|
b,: bolder; }
|
|
|
|
codeuct+%7B+field:+F0)" />
|
|
<form=3D"rotate(3idth: f=
|
|
it-content; { color: rgb(88, 102108) !important; font-77-.343.829-.859.997-1.472.257-.957 <button ipre { padls { padding: 20px 0px 20px=
|
|
ps:/ex.html#structs">Structmples .scraped-example: nox; align-items: centd in
|
|
<code><a href=3D"httP=
|
|
nsi">unsafe </span>{ <span clkw-ound-codow: 0 0 4px var(--main-ba font-family: NanumBarunGothic; src: url("Na-search-tab-button-not-selected-background: #25252shr.borrow_mut();
|
|
s-menu" t=
|
|
aspanntent: "=C2=A0"; }
|
|
|
|
.popover.tooltip .conten !important; }
|
|
|
|
ce-plung: 0px 4px; curs 24, 26, 0.25) );%0A%0A++++++++let=
|
|
+slice+=3D+NonNull::from(%r(--co-color); }
|
|
|
|
pre.rust .pen"> <div c3D"_bl}
|
|
|
|
[hidden] { display: none; }
|
|
------Multip(--popover-ar=
|
|
row-offtop-color: ; border-top- class==
|
|
shorft: =
|
|
23px; }
|
|
|
|
detai
|
|
|
|
drefemp;mut</a> Self&=
|
|
gt;</code>.#ee6868; =
|
|
--code-highlight-s.org/std/ops/trait.Drop.ps::Dlass=3D"kw-2">mut </span>boxed=
|
|
=3D Box::pinTher=
|
|
e are some
|
|
|
|
the be<code><a href=3D"httpstitle=3D"Box">=ct.Pin.htmlle=3D"struct std::pin::Pin">Pinont-family: itle=3D"trai: 0.5rem; }
|
|
|
|
n: center; dsplay: block; fonthod
|
|
<codincalc(100% - 2px) 56%;=
|
|
background-imageR75rAxxEQH8LkhDBOtalQHLvXQrJ9hrehttps: all=
|
|
ocate
|
|
the memory for the elea-Roman, -asis: 3=
|
|
00px; }
|
|
|
|
.source-sidebflow-wrap: bre: 100px;lang.org/std/pin/struct.Pin.html=
|
|
d::pin::Pin">Pindebar::-webktoggle > > .isource nav.sun a way th</p>
|
|
ryAxxEQH8L--
|
|
Content-Tyon</a></ht: 1.5; }
|
|
|
|
pre.2,0);=
|
|
--codM13.68 4.722 0+we+only+create+the+pointer+onceer { margin-riight: 60pwidth: 60px; obj { fiog"ow: 0; font-s 0.25rem; margi=
|
|
n-left: -0.or); }
|
|
|
|
h1 { font-s.5rem; }
|
|
|
|
h2 { font-siusPin.html" title=
|
|
=3D"str//dnit std::marker::Unpin">Unpin</a> fo
|
|
for either choice.</p>
|
|
<ext-align: center; margin-top: 20dth: ; border-imag <use xlink:href=3Dg.org/std/primitive.reference.=3Doc.rust-lang.or=
|
|
g/static.files/favicon-16x16-8b5r(--code-highlight-==
|
|
>ince" title=3D"Stable quoted--lang.org/g/2000/svg" width=3ef=3D"#cog" transform=3D"rotate(45.00)" D"styleset"min-width: fit-context-align: right; user-set; lin=
|
|
el</a><T></code> l.html" trder-radius: 3pxe UI Symbol\"" !important because moving tound ters. Moreover, th; }
|
|
|
|
:target { padding-right: 3px; }
|
|
|
|
.rustdoc.source d: var(--codeblock-link=
|
|
;%0Afn+swap_pins%3CT%3E(x:+Pic.rusttd/boxed/struc<=
|
|
/a><T&grder-top-colo=
|
|
r: #252525; -5;-border-tooun=
|
|
d: #c5c5c5; --scrape-example-cod" traack 0px -1px 0px; }wof=
|
|
f2"); font-display: swap; thods > se=
|
|
ction,.782-1.4=
|
|
34.551-2.504V14.8c0-1.09.02-1.18.02-1. solid var(--codeblock-ig//www.w3\"M5 2.5H <code>T</code>.
|
|
For coa hrefActual+drop+code+goes+here.%0A=
|
|
++++++-height: 9px; }
|
|
|
|
h3.wrap.comild_panic .tooltip { =
|
|
orcolor); plctural=E2=8</a>).</p>
|
|
ng.oris at are eir placement in me inner { 0vh; top: 0px; left: 0p=
|
|
x; }
|
|
|
|
ghboring elements would.rust-lang.org/std/pin/struct.Pi.368h d=3D"M13.6lor); }
|
|
|
|
.example-wrap.ignore:"ar-background-=
|
|
color: #505050; --si > summaryde-wrapper pre pad=
|
|
ding-bottom: 0px;n be <em>either</emjected to 2"><link rel=3D"preload" as=3D 100v=
|
|
w; }
|
|
details.togglnospace;</button><a cltps://doc.rust-lang.orl of some da=
|
|
ta in memake this wxtension-app=
|
|
-root"><div class=3D"box-bmemory thwritten or deallcalling the contw-link-color: #d2991d; --link-color: #d299bf35; few extra requi/p>
|
|
st-lacted: #333; --source-sidebar-backgroundor: #2A2A2ations ting mo=
|
|
ved l fields when your type ip dt { float: left; clear: left; margin-right=
|
|
-color: rgntainer"] button:hov// and the only way to access 5\" \9 fill=3D\"none\" stroke=3D\"=
|
|
blike-l.rust-lang.org/s=
|
|
td/primitive.refec.html"=
|
|
ground-color: var(--sidebar-background-coloruse+std::pin= std::pin::Pin">Pin</a><<.html" title=3D"mem::swap">, Arial, splay: flexalQHLvXQrJ9wZdrptFy8pe: text/css
|
|
st-arrow"itial; border-image:fry divfolders, details.dir-entry div.files { padnowraps.tot > div > d=
|
|
etails.b { margin: 0px; paddie)ait.Un=
|
|
pin.html" title=3D"trait std::marde-ty { color: vaprelude-coloc.4=
|
|
.074-2.094-.5.965-2.11078-: #e0e0e0; --button-bac.Pin.html" title=3D"struct std::pin::Pin">Pin</tent-Locatiang=3D"en"><head><meta ht nt-weight: 600; ip" title=3D"This example d); }
|
|
|
|
.scrle-wrap .rust span.highlighn:f: examples-toggle .hide-ms-he d=
|
|
ata structure.</p>
|
|
<p>Therefore, ng als><href=3D"Unpin.l =
|
|
pinning,
|
|
and thus they do not offer pi(<span class=>: Pin<
|
|
ef"https://doc.rust-lang0deg); }
|
|
}
|
|
|
|
#settings-menu.rotate > ighlight-container"] { background=
|
|
set=
|
|
tings-button-color); font-sizelly obtain a <code><a href=3D"https:.032L23 15z"/></svg>=0A
|
|
------Multipa.25em; }p: -0.5em; }
|
|
|
|
nk-colob7eference.html" title=3D"shared referencer"><div id=3D"scispace-eorder h-full w-full"><//+A=
|
|
nd+here+we+have+%60%262=80=9Ct. Pinning that propagates =
|
|
ioltip:hover::afterive.reference.htm=
|
|
l" round-color-hover); }
|
|
|
|
idebar > :7e583a03bb@mhtml.blink
|
|
|
|
@charset "utf-8";
|
|
inge=
|
|
t_unchecked_mut"><code>Pin::get_unchecked_-c-s-check-loaded=3D"14.11=3D"https://d
|
|
rust-langrop"><code=
|
|
>Drop</code><D"self">self</s=
|
|
pan>: Pin<<spance=
|
|
s60,+but+that+is+%0A++++//coe#cog" transform=3D" />
|
|
<use xlink:href=3D"#holens= <code>T</coa
|
|
hraginot YaHei", "He=
|
|
lop: 0px;=
|
|
}
|
|
.sidebar-menu-toggle { width: 45
|
|
you must treat <a href=3Dapcraped-example:not=
|
|
(.expan struct
|
|
</span>rust-lang.org/std/ops/trait.Der=3D"o: #fafbfc; --kbd-box-shadow=
|
|
-color: #c(1px mary { display: list-item; cause undefined
|
|
behaviortructural pinning comes with ang.org/std/marker/=gn-self: stretch; background: rbefore { top: 0px; backgroun=y-path, details.toggle=nce: whiteow(unusd::pin::Pinn%3C%26mut+T%3E,+y:+Pin%3C8-2.008-2.293l.59-1.03c.437-.766.255 1.636-1.255a.to eleme 0px 5px 20px; }
|
|
n-header"><a href=3D=
|
|
"https://doc.rug.orde></a>=
|
|
as follows:</p H 40
|
|
V 25,12 24,7 C5
|
|
(94docbloca>, which might reallocate and thuse.rust .prelur); }
|
|
adius: 3px; border=
|
|
eft;T></code>. (This qu, pointer types generallnning project) .code-wrapperuse <a h=
|
|
ref=3D"https://ditle=3D"struct stdn">Pin</a><<a href=3D"+Box::pin(res26boxed.de-example { margin-left: 25px; cuml" title=3D"t also by
|
|
res://do/option/e border-color: in1 1 0%; line-height:d)%5D%0Afn+main()+%7B%0Afn=
|
|
+exploit:=
|
|
pin::Pin;%0Atype+Strield+%7D%0Aimpl=
|
|
+S
|
|
field doesn't move the whole<span cla din%3C=
|
|
Box%3CSelf%3E%3Ee+%7B%0A++++++++++++datng is <em>not</em> struding: 0see below</a>
|
|
for more detan</eration can be used to move a <code>T</code> on/strcolor); }
|
|
.macro, a.macro { %); --codeblock-error-hovef", "\"Ac.rllow calling
|
|
<a href=3D"https://doc.rus=3D"struct std::pin::">xEQH8LkhDBOtalQH9wZdrptFy8o----
|
|
Content-Type: teoc.rust-lang.org/std/p
|
|
.scxpand { color: var(--main-color); posr: var(--soa href=3D"https://doc.rust-lang.org/stdop::drop"><code>drop</code></a>///de>firap .rust spanight { background: var(--scr=-line-hover-bacd.popover { position: absoluborder-r: 1pxommon sm21"alternate i=
|
|
conlock; padding: 3px 5px; font: 15px /hede></pre><a c>P::<a href=3D"scispace-copilot-fadeh; z-index: 10; }
|
|
|
|
#sourc"k.docblock > h5:firsD"" href=3D"https://doc.lute; top: =
|
|
24px; righpx; z-index: 1000; ggle[open],0,.5); --codeblock-ignore-hover-colrrow" target=3D"_blank" href=3Dy: 1; }
|
|
|
|
. projection for a particular field turns <code><afont-face { font-family: "Source Cod0-side-color); }
|
|
|
|
pre.rust { tab-size: 4; }
|
|
|
|
propaci-w.tog=
|
|
gle[gin-left: 24pxbackground-color:osition: : url("data:image/svgot relevant
|
|
when no <code><a href=3D"https://doc.============================
|
|
==============202b4e-490d-4575-add2-82f9f93fc7ed@mhtmab-537ecss" daos7; border=
|
|
-radius: 6px::drop the pointers into it
|
|
from its nei become nd hence freely ac when you just n">://doc.rust-l=
|
|
ang.2; --assoc-item-</li>uct.Box.html" title=3D std::pin::Pin">Pin</a><<a hrexml" h=
|
|
ref=3D"https://do14l.53 2.247-.59 1.0: rgb(255,14eblock-ignore-color: rgbaly.</p>
|
|
<p>Notice that tckgrounder=
|
|
{ background-color: rgb:href=3D"#cog" transform=3D"rotate(168.75)" />
|
|
lang.=
|
|
org/std/pin/index.html#drop-guarantee" <use xlink:href=3D"#cog" tra" />
|
|
<use xliy: block; }
|
|
|
|
sum}
|
|
|
|
template { display: ration s://doc.rust-lang.org/std/p the s
|
|
olor: e+wuse xlink:href=3D"#me> or <code><a%0Ause+std::=
|
|
pin::Pin;%0Ast64-2.31cauthor of the dts, the question at">A pinned pointer.</div></ul>dy><scispace-divences here for illuposition: relative; }
|
|
|
|
.docb 1.066-.134.074-.117.0=
|
|
8 2bkitstd::ptr::NonNull;%0A%0A//+T=
|
|
his+i a <code><a href=3; }
|
|
|
|
.example-ile">=E2red">=
|
|
<codap.htmlt.VeVec</a><sly, this means that you=
|
|
r struct
|
|
must <em "\"Helvetica Neue\"", Arial,=
|
|
"sUI S=
|
|
\"" !ioit_ref_cell<T>(rc:idth: 2pdoc.rocerence.html" titch-tab-button-selected-backgpin/str=
|
|
uct.Pin.html" t st=lor:"logo"></a><h2 class=3D"location"><=
|
|
a href=3D0.875rerem; }
|
|
|
|
#main-content > .item-ine=3D"mutable reference">&am;</code> into a reh-select48 0 1.14=
|
|
8.016 1.261l.008.07ighlight-number-color); }
|
|
|
|
pgles-color: #999; --toow wrap; width: 100%; }
|
|
|
|
.{ max-height: calc(7ass=3D"comment">// And here we have `&e=oesn't implement Unpin, this wil=org/std/ops/trait.Drop.html#tymethod.drop" title=3doc.rust-laear 0s infinite
|
|
elsewhere
|
|
and its memory cannot bay:-filter=
|
|
: invert(65r-color: rgb(2gba(255,0or(255ill
|
|
call <a href=3D:not(.expanded) .code-wrapper:ll;n: https://doc.et "utf-8";
|
|
|
|
:root { : #3535h2>
|
|
<p>Beore we tails to explain the guh <code><a hrefrection: row; justify-content: std/mem/fn.swap<code>mem=
|
|
::swap</code>
|
|
<p><or); }
|
|
|
|
.search-results .rn { paddipadding-top: 0px; }
|
|
.mai-shadow-colored: 0 4t=
|
|
wut</code></a=
|
|
n">Pin</a><P>: verflow:n.nedno=
|
|
t be pinned,
|
|
but that iestioas png: auto;,
|
|
"https://doc.rust-l/code></a> and
|
|
<a href=3D"https://doc.rust-l.htmlvar(--rust-logo-flex: 0 0 200px; overflow-y:in=
|
|
s callablet-chmovable::new(<span</sl-for-field"><a href=3D"https://doc.rust-=
|
|
-s-nove i32"><codcus { b
|
|
ore-=
|
|
hover-color); }
|
|
|
|
.example-16161; --search-result-border-ht: 20px;=
|
|
}
|
|
|
|
.s fldius:rust-lang.org/std/pin/struct.Pin.html" titlcode>in-alhere; }
|
|
|
|
.docblck nher=
|
|
it !importantnce">&mut</arwise it wi\" xl pinning could
|
|
<codeang.org/std/marker/trai=3D"https://doc.rust-lang.org/std/ocation: https://s/clipboard-7571ion: relative; }
|
|
|
|
.small-section-heade=
|
|
; border-right-sty.scrape-help { margin-left: 10px; paype%3E)+%7B%0A+++++++ -border-color=
|
|
kground-o-con: center; }
|
|
|
|
.version { ov }
|
|
main-headinghecked_mut(mut_ref)ref=3D"https://doireat <tarea { overflow: auto; }
|
|
|
|
[type=3D"checkbox"] #8d8d8b; --code-hi#8ca3ypd; border-boef=3D"https://doc.rust-lang.org/st 7h14c0-.911-.7gle mpl-items > .toggle:not(:last-child), #blankeispl("Fira Sans Medium
|
|
f2") format("wo===========
|
|
==============================-type-link-color: #2dbfb8; =
|
|
--trait-li8cflinloll::dangling(),%0A+++11; --search-error-code-baltsr); back++let+b+=3D+rc_shr.borrow_mut();%0A++++let+corap.compile_fail .tooltip, (--headings-border- }
|
|
|
|
h1, h2 { linecode-header st <span class=3D"kw">let </span>sliceR===========================================earch-failed { tpx; display: none; ://doc.rust-lang.org/std/ops/trait.Deref.-in-out 0s 1 normal forwards running fa=
|
|
dfer-Encoding: quoted-printable
|
|
Ce, .ite
|
|
_pin: PhantomPinned,
|
|
}
|
|
|
|
<span cla; paddined-example:first-child { margierence have? Is it <code><a href=3D"https:x">Box</a><T></codorgtle=3D"soD"hion,%0A9; --stab("woff2"); fon-lakit-scrollbar-roun typ-color); border-radius: 2px; color: va=
|
|
=3D"structa href=3D"https://doc.rust
|
|
acity: 0; animation: 130ms easevfocus::before, details.
|
|
und-
|
|
le:not(.expanded) .code-wrapper, .more=
|
|
-scrapedxmlns=3D\"http:2.5v12H5m71" height=3D"106" width=3r .prev,=
|
|
.426-1.8996 1.tle=3D"Box">Box</a><T>>< dding: 0px 4pang.org/sta
|
|
tic-lang.org/std/pin/struct.}94c.152.0843.125.566.125.594 0 1.3l" titles://do/primitive.reference.html" 00; margin-top: 0px; margi=
|
|
n- 24px; marg }
|
|
|
|
.width-limiter { max-width: 960px: flex; flex-di: rhe++++//+we+place+it+in+the+the+lifetime+of+thess=3D"self">Self=
|
|
<is <em>consistency</e=
|
|
m>:
|
|
every field caa pinnroot"><template shackground-color); w align-i: center; whhe contents of these references.
|
|
/&mut</a> T</code> allow
|
|
r=3D"https://doc.rust-format("woff2"); font-displa/a>::<wbr><a class=3
|
|
=3D"struct std::pin::Pin">Pin</a><7Cs%7C+%26=ru-75710=
|
|
35ce49a181d.svg" width=3D"19" he4-.047.=
|
|
101-.063 1.9832-.39od .wherehersplay: block; white-sD"mem::swap"><cl" ti=
|
|
tle=3D"mutable reference">e following subsections, we depe=3D"varianttd::option::Oprder: 1px solid =
|
|
var(--border-drop"><code>drop</code></a> on al=
|
|
l ele:target { background-color: transparent;href=3D"https://doc.rust-lr example, if the struct =
|
|
contax; }
|
|
|
|
body { foe whecalle thscribe the consideraticeCodp;mut</a>
|
|
nce
|
|
.more-rop</code=
|
|
></a></em>.</p thus
|
|
witnessing that thedeses > a.selected { background-colourround-or oa ohtml" title=3D"stemFont, "\"Se { visibility:macro3D"htts</a></l=
|
|
o0px !=
|
|
important; ba(242, 243, 243) ant; }
|
|
|
|
196f3; --sourc3D"is =E2=80=9Cubtd-border-top-color); }
|
|
|
|
x; --tw-ta> Field></code> is never created,
|
|
28, 230, 232); border: noneg: 0px !important; }
|
|
p ion=3Dntlight-tooltip { font-size: 14pxped-example .code-wrapper .next {</span>pin=3D <span class=3D"kw-2">&mrm></nav><3D"content"><or: #000; --kd0 0px #fff) drop-e>Drop</code> guaranteee">V=
|
|
ecDeque</a><T&tps://doc.rue.=
|
|
html" tE+Pa=
|
|
,%0A++++++++++++//+the+data+iscode></a> on a pinne=====================================as=
|
|
t(91%); --crate-s
|
|
ateinvert%) sepia(0%) saturate(721%ldinf a pinned t
|
|
ima std::option::Option::take"><code>taode=
|
|
><span class=3D/span>Struct {
|
|
<span cltoparantee"><cod</a></h2>
|
|
<p>Tive.reference.html" t=
|
|
i
|
|
cod href=3D"https://doc.rust-langss=3D"rustferen/+we+are+not+allowed+toable > li > div.desc { padding-lef=
|
|
tle=3D"mutable </p>
|
|
<p>For examplol
|
|
Subject: std::pin - Rust
|
|
DIME-Version: d=
|
|
></-lang.org/st
|
|
titural-for-f
|
|
m>nt;<a href=3tton { margin-left: 4pxkground:-code-color);=
|
|
}
|
|
|
|
.stab <>)});
|
|
<span </sp3D"group" t pre, .rustdoc.source .example-wrap { =
|
|
ba.</p>
|
|
<h2 href=3D18F, U+A960-A97F, U+D7B0-D7FF; }
|
|
|
|
* ont-Encsvg
|
|
|
|
|
|
a { color: var(--link-color); tes that you cannot use operations such
|
|
as <a hr .sidebar >cause modifying a= ight=
|
|
: 400; src: local(Source Serif 4"), url(" g from the d-color: #494a3d;std=
|
|
:Box.html"/code>,
|
|
whether text-decoratios
|
|
Content-Transontent-Location: cid:css-6d90d595-stab-bite-space: pre-wrap; border-radius:n is to decide that pinning is =E2=8om { clear: both; border-top: -s==========tBouner-top-co D"
|
|
-9,-15 H 4 C 12,-15 12,-7 4,-7 H -9e-self-referential-struct">Example: self-refe=
|
|
reted -lang.org/code><a hrc.rust-lang.orgdesc docblock-shor id=3Dtruct.Pin.html" title=
|
|
=3D"sPif=3c.rust-lf you struc=
|
|
tur,
|
|
all you to ensure is thu may alspvar(--tw-shadow-color); box-shadow: var(- type <code>P</code>, anooltip):hover, .docblock-t a;mut</a>=
|
|
Field></code> is ever tt h=====================tructurat-structter-intuitive example-wrap: }
|
|
|
|
.rustdoc .example-wrap phange setps://doc.rust6101059cd0.svg"div=
|
|
>rop"><co=
|
|
de>drop</codeions. Tis is why <code><a hr
|
|
#_copy { alig(68, 148, 213);d,sideolor: var(--sidebar-backgnot(#src-sig: 5px.Pin.hts-.379.035-.515.114a.648.648 0 0 lt-namm-name > a, .out-o a, summary.ld }
|
|
}
|
|
}</code></pre><a class=3D"tes-table > li >gle-line-
|
|
.toggle-line:hover .toggle-line-ba45%;=
|
|
baca-section=3D"d:get_putton-color); background: var"#cog" hr337.50)" />
|
|
ine-numb-lock; positr:hover > .anchor, .impl:hover > .ao+it.%0A++++fn+ne_pin=3D"kw">let </span><span c(re/html
|
|
Content-ID: <frame- std::pin::Pin">Pin<=
|
|
/a><P></code> wrcode> reference">l" titlttps://doc.rust-lang.or=
|
|
g/std/ops/trait.Drol" title=3D"mutable refee
|
|
139,202,t;T&g%3CT%3E(rcPin%3C%26mut+RefCell%3CT%3E%3E)+%7B%0ang.org/std/title=3D"structf=3D"https://=
|
|
doc.e <a href/a> implm-style: y-path, #help-button { displm-amily: inheripin::Pin">Pin</a><P><de>ped.
|
|
</span>inass=3D"kw">unsafe <tretch; }
|
|
.subng.org/std/ops/trait.Drop.html" titode-top<img src=d-color: var(--main] { scroll-m?=E2=80=99 fosidebar h2ebar h3 a, .mobil-topb%7D%0A%7D%0A%0Alet+unmoved+=3D+Unmoe target=ank" href=3D"hound-color)he projection. If both are done forde>D-string-color: #83aid er-ode>Drop</ well: if an eleme=
|
|
nt of your type 3D"h2") f be<spae::Future::poll"><codains any other dtd/ut </span><span class=3D"self">t;) -> Pin&moved w moving
|
|
the pinned ne-hee"=
|
|
>&amorg/std/ops/trait.Deref.html"> aps://doce-sidebar-exth:e:noe-scraped-examples { margin-left: 2=3D"rotate(216)" />
|
|
<usansflmple-wrap { border-left: 2poransform=3D"rotate(236e>Deref<" title=3D"=
|
|
ops::DerefMut"marker/=3D" bordermall-secough a poi
|
|
<div class=3D"example-wrap"><NonNu+++++++++_pin:+PhantomPin(data:+String)+-%3+in+plright-radius: unset; borderor: =
|
|
#e6e1cf;
|
|
</li>
|
|
<li>
|
|
s pinnn"><code>Drop</code> implementati2>
|
|
<p>If yous://d0 5v8.333h-2V9H2v1=
|
|
4h1he colle3 H 1 C 12,3 6,22 15,22
|
|
implem:neorl=
|
|
d%22.to_string()low: hi content: ""; }
|
|
|
|
details.toggle nNu
|
|
|
|
<span class=3D"comho=
|
|
veructuraly: ProximaVara-Roman,=
|
|
-apple-system, Bttom:lementors-toggle > .docblock, .impl-items > oker=
|
|
::Unpiorg/std/pin/stru<or)=
|
|
; }
|
|
|
|
.example-wry--Zqv====================f&ggnample-e-wrap.iea+doesn%27t+mdoc.rust-lang.org/stcode>ptdoc.rust-lang.org/std/boxed/sr-left: 2px or-coxnore-colap.compile_fail:hov-2.414.8=.032c-x; height: 24px; w/code></a>=
|
|
if alltrust-lBox">Box<e.html" title=3D"mutable refe { display: noly
|
|
move fields around to be able <circle id=3D"hol>>so this
|
|
does n.)<me"
|
|
details.togg//d06e7a7" type=3 // we placea hrd/=
|
|
ops/trait.npin.html" title=3D"trait s"><code>Unpin<he str<pre class=3D"rustreinters to its predecessor annn-bottom: 40px;none; =
|
|
border-radius: 6p bordut this
|
|
is called <em5rem; }
|
|
|
|
.top-doc .docblock h4, .top-doc .docr+to+the+correct+l=
|
|
ocat//+ss+the+struct+hasn%27twicity: 0.4 !important; }
|
|
|
|
.scisp=rgb(71 85 90Box</a><T></ct-lang.org/std/borc/core/lib.=
|
|
rs.html#366">source</a> =Ccalc(7.5em + 10px); }
|
|
examp-ee;%0A++ght-side-color: grey; --=
|
|
coon: relative; margin-bottomoc .r
|
|
Content-Type: multipart/resize: 12px; colo255); -he_copce+our+type+doeen implementing <a href=3D"https://doc.ruse-scrollb!impo
|
|
#searo-Semibold-d899c5a5c4aeb14a.el=3D"s=
|
|
tylesgle > summary:focus-visible::before mutable reference">&ss=3D"inned access to the `T`.
|
|
</span>ererenco0=9Cstru0=
|
|
=9D for <code>field< color: var(--scxample-help-hovelang.org/std/pr title=3D"mu transparent; margin: 0px; padding: 0px; font-siD";mut</a> Field</code>. constraints though, an
|
|
|
|
.siit-scrollbar-trackces to th the struct hasn't ference">5rAxxt/cs-da0f-4eb1-bcab-53
|
|
|
|
border-ra=
|
|
a><P></code> can be used to wrap any =
|
|
d a</code>/<codnctio=
|
|
ns much liound!</p>
|
|
<p>As the city: 0.9; one !important; }
|
|
uto !important; }
|
|
|
|
._sf_adjut 4px;table referen=
|
|
ce><a hre5CodePro-Regular-=
|
|
562d16)" />
|
|
<use xlink:href=3D"
|
|
</mase,+>impl </span>Drop <span class=3D"k>S=
|
|
truct<T></code> =E2=80title=3D"metml"
|
|
Box</a><T&g var(--togg=
|
|
r); }
|
|
|
|
details.toggor:omment-color); -background); }
|
|
|
|
.example-wra-Contentnion, span.primiti=
|
|
ve, a.primitive, ; widthtical-align: middle; opacity:tyle: initial; 1.5; colouhideme, (%
|
|
mut+s.field)+%7D%0A++++%7Dent-c=
|
|
olor:75; line-nushadow-color), e>get_ 1; c/var(--tw-text--5.325-5.325 5.33 5.33 0 0 1 5.324-5.32 5.327 5put { appeara none; outline: nder-color); border-rStrucapper pre { max-h=
|
|
eight; font-size: fo { margin-left: 0px; }
|
|
|
|
var(--scrollbar-track-backgro=
|
|
und-colorH13.957 2 10 2s-1.75.75 1=size=
|
|
: 100%; line-height=3ble > li > div, .search=
|
|
-results > a, .s title=3D"struct std::pin::Pin">d{ zing: content-box; ; }
|
|
|
|
pre { fo>
|
|
|
|
<div class=3D/doc.rrg/std/pin/index.0" h
|
|
<a href=3D"https://doc.rust-lang..e> is not. In faclang=
|
|
.org/std/pin/struc.html" titl</a>.</p=
|
|
>
|
|
<p>This is exactly the kind of guarasection=3D"data-scispadialog button.></span> =a; padding: 0px; margin: 0px; }
|
|
tions-list .it-i=
|
|
mplementations-list .ierf=
|
|
z-inder, .mo: inherit; margin-right: 15px; position: reler::bef=
|
|
ore { opacity: 1; }
|
|
|
|
deta b; padding:}
|
|
|
|
[type=3D"number"]::-webkidir-entding-leetails.togggle > summaunction-link-color:intetem, BlinkMacSystem=ref=3D"https://doc.rusclass;) {
|
|
overi; }
|
|
|
|
@fonace { font-familySerif 4"; font-style: /code> does not let clien=
|
|
tps://doc.rust-langs=
|
|
td/rc/struct.R-selected-bop-color: #0089ff; --search-tab-butttipartBoundary--ZqvR75rAxxEQH8LkhDBOtalQHLvula><link r=
|
|
el=3D"preload" as=3D"font" type=erence">eplacing and moving t move oucoding: quothref=3D"https://doc.rust-lang.o"item-na><a lang.org/std/pin/macro.pio comes with a <a href=3D">&m+Pin::new_unchecked(self)%7D);%0A+++t: 36px; disn-left:875rem; font-weight:><a class=3D"tttp=
|
|
s://play.rust-lang.oer-Encoding: quoted-printable
|
|
Co: rgb(91,59,1); --scrape-ex=
|
|
n>p =3D rc.as_mut().get_pin_muof the
|
|
.rust-lang.org/std/cell/struct.RefCion: underline; }
|
|
|
|
.crate.blon/st=
|
|
ruct.Pin.html" title=3D"struct transform=3D"rotate(90.00kbutton-background-colr">&</a>Self></=.org/std/pin/strge-repeat: ; bo=
|
|
rder-width: 1px 1px 0px 0px; { font-size===========================ine: non=
|
|
e; flex: 1 1 0%; appearance: noer, <code><a href=3th=3D\"17\" height=3D\"17\" shape-ren=================================================://d/pin/index.html#un=
|
|
pin"><code>Unpionin-bottom: var=
|
|
(--nav-sub-mples for how it might be used.
|
|
adow: inset 0 -1px 0 i { list-st. Foins an
|
|
<code><ag" aria-label=3D"Cigb(255, 255,89060.png"><link rel=3D"icon" type=3D"image/scraped-exow-background-color: rgba(78,=
|
|
0.2); --test-hode>, the compilalelds that
|
|
px 0.75em; }
|
|
|
|
p:last-child {std/index.htm=
|
|
l">std<D"mod" hre> summary.hideme::before { position: reeludeolor: #ee6868; --code-highlig=- 1; }
|
|
|
|
#settings-m_unchecked_mut().fiet-arrow" target=3D"_blank}
|
|
|
|
@media print {
|
|
nav.sidebar, nav.sub, .o) contents! Nor could it alf=3D"htdata-scispace-plugin-highlight-containablembers { padding: 14px 0px; }
|
|
|
|
.src-line-numbbefoull::dangling(),
|
|
s);
|
|
|
|
25rem; }
|
|
|
|
.top-doc . fontize: ore-examples-togjmkjhmhniii+is+safe flex-wrap: wrap; pade=3D"struct std::pinaclink, #cop
|
|
[open] > summary::befor }solid v
|
|
.sn-alertdd undrmalize-76eba96aa4d2e634.csi
|
|
pre class=3D"A++++//+We+are+st" href=field%60+is+neclpan>) {
|
|
<span classsed
|
|
// again
|
|
as moving e
|
|
ld1.0"conm><title>std::pin - olor); }
|
|
|
|
#search .errargin: 10par(--borde=
|
|
r-coltraDBQrJ9wget" title=3D"ops::Deref::Tter ty.rust-lang.org/std/bouct.Box.htm=
|
|
by pinning a <co></ul><h2low: ellipsisonstanh-results > a { display: flex; m
|
|
angml#projections-and-strucing</a></h2>
|
|
<p>oc > summaryn well as types consisting solely of the.reference.htm=
|
|
l" title=3D"ma2c9cd1067=
|
|
f8b3eading"><h1>Module <a ht-lang.org/f=3D"https: 1.25rem; margin-right: 0.3nherit; }
|
|
|
|
detils { displanone; artBoution-settings: normal; fontps:.org/std/pin/structtruct std::pin:f=3D"http=
|
|
s://doc.rust-lang.orgttribute-color: #999;itrust-lang.org/stassociatedtype, span.search-ta=
|
|
b-tit #888; - none;er: x; -webkit-font-smoothing
|
|
.search-er { display: none; padding: 14box-sht: 4px; }way+to+accewace%0A+=ny pointer type
|
|
<code>P</coorigin=
|
|
=3rust-lang.org/static.files/Sourcend-color: #444;: block; }
|
|
failed > ul { text-align: lefct.Pimethod std::pmut</code</p>
|
|
<p>This can neve ht-in</a><P></c=
|
|
ode> does <em>px; background: none; %0Ause+std::marker::PhantomPing.org/s=
|
|
tatic.files/rustdoc-ba5701</het pC01E52nsfer-Encoding: quoted-printable
|
|
Converef=
|
|
=3D"https:n claser-bont-style:-highl: #769acb; --code-orderr(--: 20px; width: 33px; }
|
|
|
|
#setter, #sett
|
|
.out-of-band { flex-groizents ed by the clients=
|
|
,
|
|
and elemlives shorter tfecttitle=3etails.dir-entry st-lang.or%0Ausetton > a:focus { border-cobutton-border-foearch-tab-bc { di none; wid3D"https://doc.rust-lrust-table referencpw: rgbund-color: v Italic"), url(b1.ttf.woom,var(--e-code-wrappeghligin { posfn _get_field(<span class>) a
|
|
can be data. For bot=3D"https:rapednot(.expanded) .code-w-tw-shadow: 0 ,open]:not(:last-t63 0 1.15.015=================== move ou parametust-lang.orgcked)]</code>.
|
|
See that groun=
|
|
d-color); }
|
|
|
|
a.test-arrow:hover { color:ng in your type (fogin: 8px </span>expl Pin< initial; border-bottorow, .item-tabletton.buttonClose fail to cwap(&mut *still_veowing:</phtml#" class=3D"tooltelc=
|
|
.html#method.slang.onpin"><a href=3D"httpsn</code></a><
|
|
<p>Many type
|
|
Pin//do: 1.375rem; }
|
|
.25rem; }
|
|
|
|
h1, h2, h3, fsub-mobile-padding: 8px; }
|
|
|
|
@font-ftle=
|
|
=3D"color);=
|
|
}
|
|
|
|
.ample { position: relative; }
|
|
|
|
: 0px; }
|
|
|
|
.iteml; font-kerning: auto; font-oe .example-w
|
|
ape-example-code-linean class=f">selfan>inner_drop(this: Pin&8dml#i></ul></secti<main><div , 0, 0.1); --tw-0 2px 4px -2px -t=
|
|
w-ring-o-ron-rotion: row; outline: none; p=
|
|
add 1; bordetitle=3D"trait std::3D"muf=3D"https://doc.-scrape-example-toggle-l</h3>
|
|
<p>The othuse xlink:hrrm=3D"rotate(67.50)" />
|
|
|
|
|
|
div[datata-scispace-plusition: f/>
|
|
"#mount" tractify-content: center; align-items: cende=93 which meandisplay: ou>not</em> be <code>#g { display: flex;ding-bottom: Qted;, kbd, samp { fonteft-style: ; boern+cannotpx; line-heighitem-decl { ovflow-x: auto; }
|
|
|
|
=3D"round" d=3 Z
|
|
M -40,22 H 0nmoved =3D title=3D"macro std::pin::=
|
|
pin">pin<</p>
|
|
<p>To make this work, every elemetooltip { font-weight: bold; font-szarheight: 12px; display: blod.active { displayt;et3D"https://doc.rust-lang.st-lang.org/?code=3D%23!%5Ballow(unuse_ref_cele: 1.1gw to write <Drop.html#tymet5; text-si: 1marginlertdialog h2 > span, .scispace-pluginpr
|
|
|
|
pre.rocal("Fira Sans"htt46,-3" />
|
|
.724 0 0 0 4.71 7.676a2.954 ang.org/sprimitive.reference.html=
|
|
" tiuot(.tooltip):hover,/span details.dir-entry sules > a:focus/d <cocode-ra00-11FF, U+3130-3{ box-sizing: bord ncode><a href=3Dg.org/std/pin/st-arro2arolor); gap: 1%; }
|
|
|
|
.search-result-lips { white-space: prnt-sizain-content > idebar-toggle { post/blng-color); }
|
|
|
|
pre.: 12px; border: 0px; outline: 0px; marEQH8LkhDBOt
|
|
Content-Tratrack=
|
|
-background-color); }
|
|
|
|
::-webuns/struct.VecDeque.htitle=3D"collct.Pin.html" e> should be
|
|
considered as </code>-style pointe memory may be ocblock-g: 0px; }
|
|
|
|
pre { padding: 14.item-decef=ttps://doc.rust-lang.org/st=
|
|
d/pin/tle=3D"mutable st .prelude-val { color: var(--code-highs0f8c037637f9eb3e.css"rk-1097f8e92a01e3cfx; }
|
|
.docblock code { overflow-x-directios========================================l--code-highlight-kw-color: #ab8ac1; --code-highl+Drop+for+Tt+self"]::-webkit-searche-upload-
|
|
=E2=80=99 to search, =E2=80=98r morex solid var {25itle=3D"Box">Box</a><ed u
|
|
var(--searround); bordvar(--sear=
|
|
ch<![endif]--><nav class=3D"m=
|
|
e-bar">-12h2.5v12H12M5 8.5k; left: }
|
|
|
|
.example-w.example-wrap.should_panicle refere> Fields class=
|
|
border: 1
|
|
|
|
.out-of-band > span.since { font-size:macro-link-color: #09bd00; --key--sidebar-curren]::bexm=
|
|
l,<svg wis::Deref::Target">Target</a></code> =E2=80=93=
|
|
because+%60ver+considered=
|
|
+pinned.%0A++++++++t()793 3 6.09 3 7z"/><path d=3D
|
|
813-2.008-.813-.199 01-.l.11.086.124.07 2.047 1.15e nt-=
|
|
weigh
|
|
order-radius: 5px; ht: -15px; height: 20px; cot { margin: 0.2 }
|
|
|
|
.sidebar-elems .ystem, "\"Helbu; display: flx; }
|
|
|
|
y copied from above
|
|
==n </sppadding-bottom: 4px; }
|
|
|
|
d::ops::: 100%; : 15px; }
|
|
|
|
.content h2, .top-d h3, .top-doc .D"srclink" rg/s2=B7d=3D"toggle-almitive.reference.html" title=3D"mutable refereeor: rgb(373) !importweight: 600 !important; fdiv
|
|
}
|
|
coloourePro-It-1cc31bf4f1f79.ttf.woff2") td::ops::Drop::drop"><c=
|
|
ode>drop</coop: 0.25em; <use xlink:href=3D"#cog" transform=3D"rot=
|
|
68107a.woff") format("woff"); font-weight: 10
|
|
.rustdoc .example-wrap { display: flex; not just moving theted; dealloca></div>
|
|
<p>Tst pin the : 2s lin normal non=
|
|
e runng rotating; }
|
|
kbd index: 1; }
|
|
|
|
.scrtop: 5px; right: 5pget-backgroun --target-border-clse" placeh+%26mut+=
|
|
Field+%7B%0A++++++++//+This+//doc.rust-ll" titd:version=3D"1.D"106/1999/xlink">
|
|
<g id=
|
|
s://play.rulA++++%7B+=
|
|
0Aor: #=
|
|
769acb; --code-highlight-lime-nd: var=
|
|
(--main-backgrckgr; }
|
|
ut-of-band,3D"kw">let </span>b =3D rc_content u(=
|
|
v)</codde>Unpin<> o=
|
|
nly affect theP::<a href=3Dit.Dere-topbarurc=
|
|
e-sidebar { backhe fun=
|
|
ction returns,
|
|
it in the heap
|
|
emes.0" data-rupy-path { color: var(--copy-path-b(--main-b=
|
|
a=
|
|
s
|
|
<code><a href=3D"https://doc.ruot(.logo-container) { ba a <=
|
|
a href=3D"https://doc.rust-lang.org/std/ope-plugin-herems: cent=
|
|
er; gap: 10px; padding: D\"12\"/: var(--crate-sear-filter); f=3D"https://doc.rust-lang.org/std/ops/trait><div cl<<a href=3D"ht=
|
|
tps://doc.rust-lanhtoe UI":RefCe=
|
|
ll">Re
|
|
/index.html#drop-implemenf=3D"htc.html" title=3D"rc::Rc">Rc</s safe+%7B+++++fn+inner_drop(thi+Pin%3C%2-tarol=
|
|
or: #bb7410; --kbd-cols>By default, all types in Ru/fonts/proxima-vara-romat8; }
|
|
|
|
.super_copy_btns_er-l: 1px; top: 100px; width: 30pxr, #src-debar-toggle) { visibility: hidden; }
|
|
rape-examp=
|
|
le-px; bcrape-var(--sc width: 100%; overflow-y: hn: sticky; z-=
|
|
ft: 0px; tpx; font-: none;std/ops<coden takes <code><a hr=
|
|
.orgdoc.rust-lang.org/s=
|
|
td/veree+to+move+the+pointer+around} .self {code-highlight-self-coan that memory does not l=
|
|
ata structure =
|
|
to de<T></c.
|
|
At -codebloa href9 26v-3zM393-1.667-1.75-1.667
|
|
.666H4.75C3 version 1.33.0"><a class=3=3D"struct std::pinang.org/=
|
|
std/pter; outline:: antialiased; font-family: i; m-weight: 500=
|
|
; src: localff2"); fonta-theme-ayu-c.c rel=3 id=3D"themeStyle" h//doc.-e"desc docblock-short">Cons>Unmovable {
|
|
ve-doubly-linked-list">Example:=
|
|
ang.o=3D"mutable reference">&mut</a> g.org/s 2023-05-3elp.popover { marequire
|
|
<code><a href=3D"https://doust-langitionottom: 1px; borde=
|
|
r: 1px solid var(-- impleD%0A++++++++boxed%0A++++=======================;mut</a> T></code>, id=3D"sts that do not care +and+the+only+
|
|
+++++++++++//+ot-content: center: vgcolor); padding-left: 24px;th: unset; border--bottom-right-ce: No//doc.rust-l=
|
|
c=3D"httpsor: var(--code-attributle=3D"trait std::marker::Unpin">e>T</coearch-results { display: none; }
|
|
|
|
bloccode-wraphtml" title=
|
|
}
|
|
}</code></pre><a class=3D"test-i Emoji\"", "\"S=
|
|
n::Pin">Pin</a>&lD"https://doc.hover); }
|
|
|
|
#sour.filselected); }e list.</p>
|
|
<p>Crucialle examFtents T</code//doc.rust-lang.org/stplay:.src-lspan-c.src-line-numbeails.toggle[oprow: 1; flex-flow: rower; }
|
|
|
|
.sedle, we are free to move the pointer aroundas=3D"klass=3D"sid_btns_bbtn:active { opacity: 1; }
|
|
------Mu-togggle-filter: invert(=
|
|
100%); --search-inputw+it%27s+pointing+at+the+string.%0Astruct+ead we use a raw pointer, though one whue"><template shadowmo6a img { ao mainthat <em>its memory will notmD"https://do+++++++slice:+ne=
|
|
%0A++++++++%7D;%0A+tl=
|
|
e=3D"Box">e.=
|
|
top-de; }
|
|
.docbows passing all types=
|
|
b cart-pointer typeerif; margin: 0pxe; over=
|
|
isd { opacity: 0.4gder-width: 0px; colo=
|
|
(r(--mod-link-flex; juster; cursor
|
|
becausen
|
|
.shor { left: -15px; paddin=
|
|
purposing, or
|
|
othede-hre.rt-lps/traons::Veargin-rbil max-width:/prerg/?code=3D%23!%5Ball%26mu=
|
|
t+T%3E)+%7B%0A++%7B%0A++++fn+pin_get_field(3E)+-%3Eis+okay+.fth UI Emoji\"", "\"Segoe UI Symiles/rustdoc-ba5701c57s
|
|
|
|
@charset "utf-8";
|
|
|
|
:r=========y:fobac(--source-sidebar-background-
|
|
|
|
#ock a:not(.test-adoc.rust-lang.org/static.files/noght: 1.1:</code>c.r=
|
|
ust-l.95pover.tooltip .con=
|
|
tart),var(--scrapretely, for phave tc.rusit.Drop.rust-lang.org/de>de>eing
|
|
container/wrapper bck; }
|
|
.117-.063-1.8t</code></a> not toer, and onlned data wh V 11 H -9 V V -1 class=3D=3D"kw">fat;<span cl">&ainer"].fade-in { op=[data-seconed strucrisct.=
|
|
Box.html" d/pin/=
|
|
strur cause a se
|
|
reliemple-line-numbers, .rup pre=
|
|
.src-lileft: =
|
|
-15px; rig5em 0.5em; }
|
|
|
|
.potent prround-color: crollbar-mb, .sidebar::-wr>Type>) {
|
|
<span class=3D"commen gopath-bargi; { flex-direction: use <code>selfeth=
|
|
>uper_copy_btns_div { poixed; width: 154px; leftt-Type: text/css
|
|
Contoding: quotet-Location: htps://doc.ation">previous sorg/std/ops/trait.Droe: ; border-right-color: ; =
|
|
border-thod std::ops::Drop::drop"><code>drop</c-l(--scrape-aped-color: var(--schelp-hover-border-c"><cass=3D"kw"lor); }
|
|
|
|
dxpand"; overf> summ0; c=
|
|
ursor: poro" transform=3D"translate(53, 53)">
|
|
<path id=3(spin/index.html#projections-and-structurxample-rendered"><code=
|
|
> color: var(--seaove the (structurally
|
|
pinnedlow <a href=3D"httplor: rgb(255, 255, 255); cursor: poinp ti0px; }
|
|
|
|
hr nt-fami bordeA++++fn+pin_get_field(self:+Pin%26mut+Self
|
|
26mexamples .sc; }
|
|
|
|
.sidebar .loger width: 100px; }
|
|
|
|
ul.b;=
|
|
vertical-align: middle; bordeth: 570px; margin-l 0px; }
|
|
.sidebar.showpx; }
|
|
.mobile-topbar ); }
|
|
{ backgtantlock, .block li { padpxmeta name=ter: scroll; oversc=
|
|
roll-behavior: contain; posrimittle=3D"mutable reft of aace-plugin-a-alertdialog 3D"ef=3D"#cog" t.25or); }
|
|
|
|
.sidebar-elems .block { martom:ml" 3D"https://doc.rust-lang.org/std/primitiveox; height: 30px;ute; width: 60=
|
|
}
|
|
|
|
#selec/bo=
|
|
xed/struct.Box.html" title=3D"Botruct go" sr://doc.rust-lang.orgere istion/enumnarioUnpi=
|
|
n</code></a ises not break
|
|
th.re=3itial; =
|
|
}
|
|
.out-of-band .since::before { conte right: varstylrightnt-weight: 4i }
|
|
|
|
.sub--tabs button:hover, #sr:=
|
|
-bu .search-results > a > div.desc, .it76.03.953.2 2.004-.011 7.61a75 7.085 0 1 0 14.168-in=
|
|
put, .sdius: un=
|
|
s#ee6868; --c-hig on a pinned element.98-ont-weight: 70; opa}
|
|
|
|
ingFang SC", "Hivetica Neue", He-arrow):iant.Some" title=3D"van::Some">Some</a>ess=3D"kw">lomment">// we only create the porg/static.files/favi=
|
|
con-32x32M11,40#ecode-highlight-macro-color: #3e999f=
|
|
; - thy, we h<a hre freely
|
|
movable (aka titdt.Piidentically, as doust-lang.org<height: 20px; }
|
|
|
|
div[data-sectiheD"#mount" transform=3D"rotate(144)" ansformo:ops::Drop::drop"><code>dropabsot: 24px; display: -maackground-color: inherieight: 1.5;:hovex.html#examplntb39.js" dat-color)=
|
|
; padding: 4px; trp: m-rigsolitter-color: initial; bor is an o=
|
|
wned pointer to a pinnedref=3D"https:not actuallymehan the collecti=
|
|
on does { font-weight: bold; color: var(--code-hig #4e8bca; - 0 #fff) drnt">// This is n cannot be des borrowing rules.
|
|
/%0A%7D&edition=3D2021 id=3D"rustdoc-vank rel=3D"preload" as=
|
|
=3D"font"=
|
|
ex; flex-dass=3D"commsidebar::-webkit-scrolar { width: 8px; } compe><span class=3D"kw">fn ;<sp=
|
|
s=3Dtructs a <code><a =
|
|
href=3D"httpstd/pin/s tt
|
|
|
|
block; padding:25rem; }
|
|
|
|
.si/www.wso, a
|
|
<code><a href=3D"https://ng.org/std/boxed/s=
|
|
tml" title=3D"Boxth; <aic.rust-lang.-42lor: html" title=3D===px); left: calc(50% - 192px); paddingline-r: 1px soidebar-elems, h2 { }
|
|
|
|
.sideba}
|
|
|
|
.s7 0 00 0"/><path d=3D" 0 0 4.72iv { display:search-resuln: 0px; }tton#toggle-l-docs { padding: 0bordetom: -0
|
|
img { ====================================> - 3px;=
|
|
ottom;
|
|
s-li printwrap .rust a:hover, ); bor); fot: 600;e-sys
|
|
Font, "Seg,ive.refeutable referenc3D"width=
|
|
=3Ddevi> sepl-items > .toggle > summary,s=3D"kw">fn </span>pin_get_field<span#cog" tran backgrobottr-background-se.implementmpl, #implementors-l, .impl-items .mefont-weight: 300; colem-spacer { width: e
|
|
Content-on: https://doc.rust-lanles-toggle summary, .mor=
|
|
e-coary:tog> summh { padding: 0.pin/struct.P=
|
|
in.html" title=3D"struct std::pin:r(--border-colordent: =
|
|
0.01sel=
|
|
v
|
|
their condthe content ly inder e+slice+field+points+to+the+data=
|
|
+r: is to=============ds o called <e{ marr+about+that+with+a+normal+referen=
|
|
ble; opacity: 1; }
|
|
td/boxed/struct.Box.html" titlD"Box=
|
|
main()+%7B%0A
|
|
::Pin;nned;%0Aride-a --focused-border
|
|
code></pre><a class=3D"test-arro//play.r=
|
|
ust-popover::before { content: "" <cos
|
|
pinning cannot ween; margin-top: 32px; =spa434" height=3D"29.5" =
|
|
enad=3D"able referenc
|
|
thatom-style: initial; b=
|
|
5Ballow(unused)%5D%0An::Pin;%0Atype+Field+=3l.</div><button class=3D"sid.sk; }
|
|
|
|
.searc=
|
|
is; oalias {rch-rcode></=
|
|
a>s
|
|
eleme) { backgrouolor: var(-a; --<code>T</code> is the pointed-to type).</p>
|
|
<h2 iader { fon.code-heamargin: 0pcrate-se4, h5, h6, struct%0A+++++t+out+of=
|
|
+the+%60Pin%ti
|
|
|
|
@e Pro"; font-styll("SourceCodePro-Regularor: -code-hnned:</p>
|
|
|
|
<div class=3D"example-wr.search-loading { text-aligr; }
|
|
|
|
.ing deallocated without their destructor beind }
|
|
|
|
a.tesn: absolute 10px; b a projectionrem
|
|
.sidebar .current, .sidebar a:hover:nckx</a><able re&am.html" title=3
|
|
ss=3D""scittring,
|
|
slinNull<String&gbtn { display: block; width: 128px; height: 28px
|
|
|
|
.rigde { paddinipboard">3D"https://derenem to cps://doc.r/std/fuof pinning is to be able to rely on the pas no n ://doc.rust-lang.oa hreflang.org/std/boxed/struct.Box.html" tiBo h2 a { display: block;in">P=
|
|
poc.rust-cementork,ating, rerwscraa.ttf.wofforme> with structural pinning copac8pa);"com this is sa create a p var(-count-=
|
|
cor co: 3px; backgroar(--s2em;block li a { whig/s=
|
|
td/primitive.refernce.htD"rotate(33.75)" />
|
|
<use xlink:hr/>
|
|
If an elem invalidated without callireas=
|
|
o--code-highlight-lifetime-co"data:image/svg+xml,<svg=
|
|
width=3D\"17\ack\lt;T>o a pinned=3D"horg/std/pin/streleA; --cod176 176=
|
|
ntent-Transfntent-L035ce49avg
|
|
|
|
<svg width=3=-line: none; lin=
|
|
a { text-decora <use xlink:ansform=3D"rotate(315.00)" />
|
|
.tog{ outline: rgb(0, 0, 0)t: 1px; }
|
|
lainedch: normal; font-size: 1rem; liight+++++inner=
|
|
_drop(un6mut+T++fault, but =
|
|
</mar bun working with pines how one can acco color:=
|
|
va-color); }
|
|
. is never co2">&an>.get" h3D%23!%D+i32;%0Astn-background-5px; }
|
|
|
|
#
|
|
p: 0px; flex-grow: 1; overflow-wreadin6px; margt; }
|
|
|
|
.rightside:not(a),re {ef=3D"https://doc.std/boxed/strutitle=3thedoc.ru;</c--code-highlight-1179464ae7ed46.svg" alt=3titla><P></code> prevents certain { max--um.O/code> and th are eliepon.
|
|
out
|
|
callad b>evennned</em>! It is as if the
|
|
comener, ited) .code-wr: calc(15em + 10px); }
|
|
|
|
<use xlink:href=3D"#cog" transfoorm=3D"rotgre-line-highli
|
|
Snapshot-Location: https://d1.0
|
|
la-search-tab-button-notonoebol\"" !impot cannot be moved =e de 5px; position: relative;
|
|
|
|
nd-color: var(--src-line-numb=
|
|
er-highlld%3E+e: 18px;=
|
|
}
|
|
|
|
.scis0.1), 0 2=
|
|
px 4square\" stroke-miterlimit=3D\"10\" stroke-widnche=4px) {
|
|
.docblock gin-left: ref=3D"cid:css-46583a03bb@mhtml.blinkMacSystgoe UI\"", Roboto, "\"Helvetly-linked list, tction does .nt has po only bxt-shadow: black 1px 0pxapper .example-wrap { overflow-x:=
|
|
6.102.059.043c.363.144.8.371dentallyMoreover, ilink:href=ink:href=cog" transform=3 atop: 0px; padding: 0px; height: =
|
|
100vh; bexample-help-border-color); border-radius: 50p}
|
|
#main-content > details.toggp: ot</piler considers }
|
|
|
|
[type=3D"searchbutton { appearner-s: -2px; ance:tton; font: indary--ZqvR75rAxxE" title=
|
|
=3D"struct std::pin::Pin">Pakie>//do<a hrea>&uct.=
|
|
Pin."struct std::pin::Pd/primitive.reference.htm&mut</a> w-ofef.html#">pin</a><button id=3D"co
|
|
.scraped-exampwrappeitio=
|
|
n: absolute0 0 0-1.4
|
|
idraet; pospx; bordop-style: initialle: initial
|
|
plieef=3D"httptml" title=3D"mem:=
|
|
:swaph .out"><a href=3D"https://doc.rust-lang=
|
|
.org/std: none; n: unoltip, #sfModal, .modal-: n
|
|
=3D"togg<span>Expand cri=
|
|
p D"cog" stroke=3D"black" stroke-width=lt-name span.gre3D"#cog" trase xlink:href=3D"#cog" trans-hover-color: #dedede; --test-arrow-hover-ba: 1.125rem; be: initialrstructa></diva=space-extension-u19.24sets.toggle > sails.toggletor at all.</p>
|
|
<p>In the standard libraryef=
|
|
=3=3D"mem::swap">p</code></a> rema for >&ax.html#pinning-is-structural-for-field"methods > .toggle > summary { mrgin-bopen++++//herwise+it+will+haveady+ed%0=
|
|
A+++++xed+lePin</a><<a href=3D"https://doc.rust-lang.or=ht-cta-wrapper { displaye=3D"ome
|
|
elements ofolid var(-st-example-rendered"><code=
|
|
><spaect:px 8px;-items: center; border-radius: 0.375retml" title=3D"e w=
|
|
he is.
|
|
</span>an class=3D"self">s0A%7D&edition=3D2021">Run</a></div>
|
|
<p>Y wi hrepea=
|
|
t; }
|
|
|
|
details.to > summarywidef-tabs { di; flex-direction: row; grrow-back var(--tes/2000/svg\"><path d=3D\=
|
|
"M5h2.5v12H12M5 8.5=======; scisx; data-root-path=../../" data-=
|
|
static-root-pathust.Optio" titinned references nts. Howevt-lang.org/s"Vec::pop"ace-pc
|
|
.sinceinitial; }g-left: 12px; float: rigt-of-ba t the same fi=
|
|
eld,
|
|
thk"><p>Types tht thus b=
|
|
e rA prime example of>
|
|
|
|
traihover .tooltiphovlor: var(--codeblock-error-ho6=
|
|
c-1.016167-1.852-1.887-
|
|
#settings-menu >ound: none; color:er: none; outlnn=3D"round" point <use xteown+not+to+be+nu=
|
|
ll,%0A//+as+we+knoUnmovtd/primitive.referenc=3D"futurata that does not ne pointer should pointwrap pre.exane-pe: text/css
|
|
Conteitle=3D"stleft-style: il=
|
|
erimiti-color:Celitle=3D"cell:fCell</a>:in_mut</code>) and tn me>
|
|
<li>
|
|
<p>You muthe <a href=3D"https://doon <c> has<a hrdoc.rust-lang.org
|
|
std::ops:Ballow(unused)%5D%0Afn+use+s+aB+%7D%0Aihe <: ""; cursor: pointer 0.5; filter:le > supary:hovi::drop"><code>drop; }
|
|
|
|
le > summary.hidemeurson"ete=3D std::pin::Pin">Pin</a><<a href=3D"https:/s lass=3D"test-a"https://low(unused)%5D%0Af{ left: unset; top: unset; w=; border-nst-lang.=ct.Box.html" title=3s, and ang.org/std/p=
|
|
tm=marker::Unpin">Unpin</a></code>
|
|
holds for all--test-arrow-color: #dedede;the pointee .04-.094.05-1tica Neue\"", Arial, "sans-seripperDisabled":fals/tempsourcrflow-y: auto; flex-baar-exp use the .637-.512-1.426-.=332.085c-.52 0-1.18=ce
|
|
// othell havlor: #fff;-hover-color: #fff; --scrape-e=
|
|
t+rc_shre.rust .attr { color: vamacro, pre.rut+et_unchecked_mut(mut_ref).slice+=3D+nnot swap thaped-exlistx; f=
|
|
ont-weight: normat-size: 12t ofat will likely be unsauthstructufield=3D"sur=
|
|
es that of ade> in mey, meaning iallocapx; padding: 8px; font-siield piap"><pre cla rust-example-repan cocstruct.V
|
|
title=3gt; =3D Pin::as_mut(<s=
|
|
pan cl=3D"https://doc.rust-lang.org/std/pin/struct.Pin.h.3=
|
|
3 0 0 1.32 4.719 4.724 42.954 0 1 1 0-5.91 2e: image/svg+xml
|
|
CoD"24" he://www.w=
|
|
3.org/2olor: #fff---selectever,, dsummarsrc-sidebar-toggle > button nned data, which im="><code>mem:rce-sidebar div.files > a:ho{ font-size: in.reference.3D"muta=
|
|
ble> summary.hideme >:focus-within::after { fil=
|
|
ter: var(--crar.5em + 10=
|
|
px); }
|
|
|
|
le:not(.expanded) . }
|
|
|
|
.scund:=
|
|
rgb(2lugin-alertfont-neutral-600si: 400=
|
|
; src: le that you only haot;: <a hre==dius: 3p=
|
|
x; border-bottoder-image:=======================nce your struct is pin
|
|
#crate-sarch-divtdo=
|
|
cblrrowa n:
|
|
// we are =3D"rotate(292.503.75)" />
|
|
- 42px) !important; }
|
|
gin-h-color: rg55)<span clas class=3D"kw-2"mp;mlx</ang.orgt.Pin.html" break t"hp.htmDrop::dr=
|
|
op"><code>drop<lica Ne=
|
|
ue\"", color: var(--main-color); --popover=
|
|
-arrofset&greiterating that <code><analles movable. <ahrepunsupported =
|
|
and will/span></=lang.org/?code=3D%23!%5+self-refebeelf</span>&ass=3D"kw-2">&mut </spanx</a><T>></code> fuko----
|
|
%0A//+as+this+patt+be+des+th+the+enable+%7B%0=
|
|
A+5rAxxEH8Lk 0 013.3 the `Pin`.
|
|
</span>}</code><++we+cannound-color); }
|
|
|
|
.methpac=
|
|
e: prerouldme.U=
|
|
nnpin">Unpin</a> for <a hreVec">Vec<Unpin"><code>example .peorg/s=
|
|
td/pristructps://doc.-current-liflow-wrap: anywhar
|
|
span.associatedtype, a.ct, a.con.expandkground: rgb(231, 241, 255 "Plveticasans-serif, "tps://.org-radienum, span.struct, a.struct, span.unionop.html#tymethod.drop" ttive//doc.rust-e.i32.html" tteps://doc.rcode></a>er opti/fer-Eng/std/cell/sde> had a mee>fn get_pin_mut</a>. This is =3D<use xlink:hrunt" stroke=3D"bl 0,-35 7,-42" />
|
|
nt-face { font-n class=3D"kw">lex; margin-tabl
|
|
|
|
.item div { disp-lang.org/std/primitivee=3d the most impode> where <code>P: <a href=
|
|
=3D"httpshtmnd-color: var(--test-atw-hover-colorle. Rust "font"ttps:// `field` ipinnelf=
|
|
</span>.mapsection-header"><a href=3D"https:ucts": 0px; margin: 0.7rem
|
|
.sidebar h3 { l-p-code-highlight-commmber-higcolor: #0=
|
|
a04wrap: anyiles/D"faolder=3D"Click or press =Et-link-ba100ms easee-out; }
|
|
|
|
di
|
|
ghink: 0; b would be buil" titl::Pn">=
|
|
Pin</a><<a href=3D"://doc.rust-lang.org/std/pin/struover-filter: invert(=
|
|
69%) sepia(60%) saturi}
|
|
|
|
imized { widthlc(100% ; p; box-shad
|
|
ptical-sizi font-varia-weight:ang.orgeld</code>
|
|
is not <a href=3D"httpsda+++slull%3CString%3n=
|
|
ned,%0A%%0entampl-items m::swap</code></t/std/pin/strutitle=3Ddocblock > h4 { border-bott}
|
|
|
|
pre(lor); }
|
|
|
|
ut .strin
|
|
t calling <a href=3D"https://doc.rus14625)" />
|
|
n; {
|
|
s okay besUslate></grammarly-desktinline-b 10px mor: solid 1px var(--border-color)px; }
|
|
|
|
. after being drop/span>{ Pin::newructurainning"><a href=3D"https:Wheess=
|
|
thet fro=
|
|
+xml
|
|
Content-Tratee does <em>not</em> meeak! It is still
|
|
com ProximaVara-Roman, -appl.org/std/pin/index.html#">Module pin</a></htate(78.75 2.95=
|
|
eferenceuld do e folliberatel=
|
|
r"rotate(72)
|
|
</span><span class=3Dw"transfor00)" /<use xlink:href=form=)" e>always <a hde><a hreftion for hohod.drop" hodtmcode>Drop</n beg called.
|
|
(<code><a hrritle=3D"method stop::d></a> (e.</cod
|
|
</li>
|
|
<ldestructor ofighli
|
|
t-child, t-child, .docblock > h6:rap">ndered>=3 class=3D"kw-2">&mut </spg., you can st"https:mem/f=
|
|
rust-lang.org/s=
|
|
td/boxed/struct.Boxin-botPro", mon=k-short code { badl=E2=80tps://doc.rust-l" maskfill=3D"none" id, .):not(.scrape-help):not(.t:not(.testnot(.scr7D%0A%7D%0A%7D&ial; border-color: in=
|
|
itial; b e pinned,efromef=3D"https://doc.rust-l-color: var(-ehods that e.refeer-arrow-of}
|
|
|
|
#hel
|
|
t-tle=
|
|
=3><ccould have been pinnedang.oedpx;=
|
|
}
|
|
|
|
scraped-examples .scrapn-top subogo-containlition: sticky; hei" fill=3D\"nonemlns=ter; font-size: 1rem; }
|
|
|
|
d > summary:=
|
|
:d::pin::Pin">Pin</a><<a hute; 0px; left:structtps://doc./a><T>>8.39a2.696 2.696 6 1.62 1.62 0 0 1-.016doc.rust-lang.org/help.html">?</a><D"eslic=
|
|
++++++%7vable::n=
|
|
ew(%22hepx, bl
|
|
nd { color: var(--righte.rust .kw { color:e by implementinttps://doctDindeight-coerit !important; }
|
|
|
|
div[data-sect
|
|
dre9cb49a0 1000isplay: snt-face {numBarunGoth32</code></a>, anan_u
|
|
cked(<splt;<checked_mut(|s| <span classt </span>s.field)=arhtml#method.push" title=3D"Vec::push"><cond va); : 11px; }
|
|
|
|
.; xlink:href=3D"#c />
|
|
<use xlistatic.file><link=
|
|
rstruct std::pin::Pin">Pitptd/prrinput:focus {-color: var(--suarantee tode>, because the contenD"https://dD"Vec">Vec</a>tleft top no-::after { content: "Collapse"; }og.org/s=
|
|
td/boxt-question-mark-color: #ff9011anseature-sliga"; backgrund-colo=
|
|
r: var(rc-line-num75rAxxnsfer-Encoding: quent an intrusive doube added when they; color:cD"httpsd-example .code-wrappe//doc.rust-lag/s">Box</a><T></code>,
|
|
ora-sRustD"rse-link" href=3D"-lang/-lang.org/5em; }
|
|
edbe structural for the founest-arrow-ln:hov><=
|
|
a href=3D"https: you can use <a hretps:/t-Transed-printablg.org/static.foot { --nav-ace static.files/favicld "><code>mem::forget</code></a> onD"htt:Pinore. You have to ghate xlink:href
|
|
<oref=3D"http=++++le:+%26RefCell%ros</a></h2><ul cl=
|
|
><div classDn.html"ictural.</p>
|
|
<p>When implementing a ointpinning implement ta href=3D"h://doc.rust-lang=
|
|
.org/st=
|
|
e: ;.anch.main-heading0px 0px 0px -4px; paddils.gle {rusive-doubly-linked-lisx.html#example-i
|
|
8 0 1.996.543 1.996 1.848 1.9 0A7.088 7.1, 8=
|
|
5, 90); -webkit-font-smortant; border: 0.8px solid rgb(198, 20 }
|
|
|
|
ialog beg3D"font/splay: swapnormal; font-weSourceSerif4-D"https://doc.ru/sts n ivedette; left: -=
|
|
24px; to4ms > details.tomode=3D"olass=3D"containediv></div></divintegrationttps:// 0px; }
|
|
|
|
main { block; of that struct in a meth<a href=3D"htocn.structor first. Nthod.drop" title=3D"meode>ntee.117-.144tor. It can be repurposed by using <a href=3=
|
|
reference">&mut</nothing can go referencreftml" ti=
|
|
t
|
|
g/std/primitiimpl:h=
|
|
ovy: ig-right: 8px; }
|
|
|
|
h2.stion-igh normal; color=jection that creates arg/std/pinhttps://doc.ic.filesang.org/std/oraxample-D"Copy item path"></button sin=
|
|
ce ruar Struct<T> projection peed guantee"https://doc.rust-lgrg/std/p <code/doc.rust-lang.org.html" t=
|
|
Conchtml#tymethod.=
|
|
op" title=3D"method stma1.856-1.278 1.856-1.93=088 0 0 0 13.61 7.61Zm0 12. -example-code-wr:after 24px; borderus: 0.375rem;=
|
|
--tw-bg; z-indendex: 10; border-top-right-ra initial; border-lefone; }
|
|
> span { etails.tory::before { n <co types s-bottom: 6pxfaile max-ap: 1px; margin-bottom:=
|
|
4px; }
|
|
|
|
dule pin</a></h2></nalass=3D"side/lang.org/stle=3D"met=
|
|
hod std::o i 600 !impht: 20=
|
|
px !impoutton:dr: rgb(55,lor: ; border-lrder-image-source: color:linked
|
|
lislementmust not free o=
|
|
r reusetoral=
|
|
%7B%0A++++++++++++-MultipartBoundape: textng.org/std/pin=
|
|
/indexpy-path" hreloat: left; padding: 0o .stab { minnc.slice =3D slice;
|
|
c.rust-laarker/trker::Unpin">---361/std/p>Mac/a></div></code> (here, =
|
|
dexample-self-referential-61)" 58.js"ett point pinning just has no ef on the ve://df=3D"allow(unused_mut)%5D%0Alet+mut+sti=
|
|
macro">assert_eq!</span>(still_unmworry about anthis if you oc.rust-lang.org/
|
|
value+is+never+used%0A++or: #f0f0f0; ---colorthe field of a pint choice: if a d/pin/struct.Pin.html"=c.rust-la20
|
|
0%ted, too=
|
|
.
|
|
d:</code></a> is catooltip { colora= std::marhat that type thi=
|
|
hovehttone#search-}
|
|
|
|
#souherit; font-weight: bolde Color Emoji",index: 5000; }
|
|
|
|
-tost_body { padding-right: 0px !important; }
|
|
|
|
1.25rem;=
|
|
font-size: 1.375rem; x; z-index: 1; c=ew_unchecked%60+ie-list, ul.al=
|
|
l-item a, #source-sideban: 0px 0.1=
|
|
25em; }
|
|
|
|
.docblock pre code=
|
|
2 2.258.035.152.063.282-.063 1.5.074c.075.34bly-n aran=
|
|
g.D"metho::Drop=
|
|
</code></a> beingre.rst .question-markhlit { colthheight: 100%;=
|
|
osition: absol 0px; co-p+x\test-arr-arrowckgro=corimitive.reference.ht=3D"Type+%7mpl)+%7B%0A++++++++ontain: layout; position:der-bottordeft-srrit; }
|
|
ch-tabs button:n
|
|
-colesuyr: var(--s
|
|
is+pinned+=
|
|
when+%60cked_mut%0Aup, select, textarea { font-ft; font-: que">VecDeque</a><ions, /p>4ff2") }
|
|
ld.</p>
|
|
<p>Fields without strucuress=3D=
|
|
"kw-2">&a.0 (9=
|
|
0c541tml" ops::Drop"><code>Drop</co>
|
|
rust rust-e< 2-.407 41a5.33 5.95\"Sego; }
|
|
|
|
.sclog h2 span { fofont-sizpace: 1; font-displ swap; }
|
|
|
|
@foit("woff2"); font-disd reference to that =rg/static.tf.woff2"><link rel=3D"preload" as=3fcopy-utton-col-img-filter: i; --or: #2A2A2A; ra5a5::Future::std/maings-css=3D"setti=3D"light-.trust-lang.org/el="3-.55l.118.313.136.6=
|
|
6.21 1.016.21docbl;}
|
|
|
|
.small-section-headbnchor, mp;mut </span>T&gre stuck, help-bord=aa; --scraplor: #eee; --lp--border-co
|
|
xoncollec0 0-1.008-.211c-1.199 0.41.714 2.257-.0043e>id refe=
|
|
rences) ases7D%0A+=
|
|
+++%get p><code>pop<=3D"https:/.r
|
|
y fails to
|
|
an { <spat </sabackgrouhx-width: 600px; --popovsizlp sp=
|
|
-background: #353535; --stab-backggba(0, 0, 0, 0.5)al 255); opacity-4r=3D"3"
|
|
oc.ight=3D"18" alt=3ob/master/REustrtant constraint ed referencDrop.html" title=3D"trmoved+=3D+unmoveta));%0A%0A/-XQrJ9wZdrptFy8o----
|
|
Contennsfer-Encodi2=80=A6" type=3D=
|
|
"searchon: infld>
|
|
std/pin=
|
|
tatior abov, you have to =le-intntrusi
|
|
}
|
|
|
|
: 1.125rem; }
|
|
|
|
.docblx; padding: 0pxoverflowout ttps:=
|
|
//doc.rust-larkernone; appe=
|
|
arance: none; opadoc..html" title=3D"Box">Boe a regular <margir: citrustegoe UI\"", Roboto,mace-plugerput-color: #2196f3; --settings-input-bordD"kw">let </span>mD"self">S>boxed);
|
|
t where it willD), url("FiraSd.woff2") e6lesheet" hc.rustead><bod=
|
|
y class=3D::Pin">Pin</a>mtitle=3D"mute">&mu .html=
|
|
#examples">Exam
|
|
<codehttps://p
|
|
std/pin/sang.og/s=
|
|
td/boxedd1d528svg+c.rust-langcoust .bool-val tlor); }
|
|
|
|
prst .macndex.html#drop-g=
|
|
v clasrc-sidebar-togglunres.scraped-examplra, .ru=
|
|
st a, ..007.797l-1.961 1.15l-2.047-1.16c-
|
|
-.5-1.62364.079-.297 2.004-.793l1.945-=
|
|
1.066c1.c.rustopped.%0A++++++//+++%7D%0" title=3D"because thatarker::Phanhref=3D"htt=
|
|
ps://doc.rust-lang.org/stle > summary::before, details.lie=
|
|
s to bothg.mitive.uct.Pin.htmn chref=3D"https://doc.russs=3D"example-wan><spade }
|
|
.sideb</c.rust/std/pin/struct.Pin.htm=3Ds://doc.russe laise id toriclled=
|
|
</em>. Only once <a hre </g>
|
|
</g>
|
|
<mask id=3D"holes">
|
|
3D"120: calc(100% =
|
|
+ 10px); paddior: mitie
|
|
types. Typeab/tDorg/stng=
|
|
.org/std/prince">&psd/pin/inde>Pin=3D"heidated=E2=80=9D by deallocation, bunum.O3D"cong.org/std/ops/trait.apx; justify-conten=
|
|
t:rgb(7over-border: #2e-sidebar-background-s=
|
|
: 0px t r: 0.6; width:=
|
|
1px !important cursor: we+know+this+=++++++//+again+after+bei.953 2.957 2.95tant; }
|
|
|
|
div[data-c.rust-</a><P><ts actua//doc.rust-lanblock summdod .tohttps://dont-f--main-backgrod-color); color: var(--main-nt { loclic border-image-we-outset: ; bordlds out of its =
|
|
that was raised in the <a h3D"rotate(101.25)" /50)" />
|
|
ate(k
|
|
ositionmarker::Unpin" are called on a pinned pointer.</=
|
|
p>
|
|
<h2 to ke those fields not strucoxele=3D"strut;<a hr=3D"httpc.ruinails.toggle[openddering=3D\"crispEdgevar(--code-hiht-strirust .number { color: -background-color)wrap:hover .test-arroa href=3D"https://doc.rust-lang.org/se.html" tr); }
|
|
|
|
#searctabsn: cent
|
|
{ fo7 1.2 0 2.4t impossible to callhttpt-lang.=
|
|
orprimite">&mutde=3D"open"><dabe3D"grammarl-30 -20
|
|
\"><path d=3D\".D\"th=
|
|
=3}
|
|
|
|
htlo/static.files/rust-l=
|
|
ogo-15D"lohref=3D"https:ve reference">&mut0; src: local("Source "><a class=3D"logo-contas://doc.x.=s=3D"rust-log use it for moving thingsackground-color); }
|
|
|
|
ock-short { overfar(--ro-nonterminal { color:
|
|
p id=3D"exag/std/pin/indexplesground-col76767 #d2d2d2; -col: #008df8o----
|
|
Cdo<code>Unpin</code></a> themis pinned, meaning ght
|
|
ample-codescrapexample-amplckground-color:
|
|
#main-contek tle td, .doc ve.reference.html" title=3D"mutable refere-doc):no=
|
|
tr> by <a hc, sere; fcolzeh4, h5, h6 { font-weight: 500he intrusive linked lismss=3D");%0A//</a> /doc.rust-trucT></code>, <code><a hrest3a1.7-.8051.958 0 0 1-.85=
|
|
cispace-plugin-p > spe-height: 28pext-opacight=
|
|
: 40Serif
|
|
@font-face { fo, url("Sourcebkground-s(53,53,53,ou8Content-Type: image/svg+d=3D"macros" class=3D"small-sectiog><deanwhilwe+2k>
|
|
/g>
|
|
<p0, 0) thin 1x:
|
|
di isplay: flex;sitisidebar-or play: none y>, but the struct (and f you do uct.Vec.de>push</codeow-w:not(pre) > code, .docblock-short codologrou); backgrhoverw { v
|
|
er, .log#msition: fixed; l://doc-.391l-.102-.082-.55-1.07-.094-.055043 0-3.61 ata.
|
|
</span>}</code></prhite"/>
|
|
ng a prorust-lang.org/std/primit//+%60ns+okay+bse+ng+drA++++%ampde>Drop</ normal; font-diRegular-46f98efa-Rwoff2" crossorigin=de>field</coretch; e when sqvgnsfer-Encoding:D"27.new 7.316 1-.762l.0=
|
|
31rem; color:earch-er=
|
|
ror-code-b=
|
|
=3D"sub"><form class=3D"search-form"><spanD"ize; borot(.selected-sut=
|
|
ton-not-scolo .joipx, black 0px 1px =
|
|
|
|
.scr h=
|
|
idden; }
|
|
|
|
.ped-exampl-hi; border-right: 3px s-tar/doc.rust-latit3:firsildpx 5px; }p;edition=3D2021">Run</a></div>
|
|
<h2 i; alignm; backgroze: 16px !important; de> d97f26; --codehighlightd-28.ttf.woff2") y: swap; ass=3D"rust runt what type should
|
|
that ref/le=3D"struct s0px 3px 4px;; line-on=3D"data-scisplugin-to clatist-lale=3D"trai
|
|
Drop"><corop</code></a>
|
|
implemen.0</a class=3l-docstton></span></div { flex-gisplay: flex; height: 34px; ns:::forn.method, a.method, span.tymethod { pin/inclass"><nav classsea documenttd/future/trai=
|
|
t.Fut.htmiv cebar-elems"><section><ul cock"><r pointer typehttps://truct.Box.html" title=
|
|
=ty)); font-amilArial, "saap</code></a>:</p>
|
|
|
|
<div claexam { paddi ol{ margin-bottom; }
|
|
dosplay: fla> Stru=
|
|
title=3"enum std::option::Optrusive dou called. ng <a 3D"ht=
|
|
tps://doc.rust-p: table-cdding-right:e { margin-top: 0px;-spacerflow: visible; }
|
|
|
|
buttkw">impl </spat, span.stat=
|
|
ic, a.static item-linti reference">&ruct=
|
|
<use xlink:hry--ZqvR75rAxxEQH8Lkho----x-height: xanot(.expand.scraped-r .next, .scraped-" e" cy=https:/ion app mutable and shacispace-pluar text-overf;e they do =
|
|
tegr=
|
|
, ocblock > h4:firs=first-cs://do
|
|
1.25rem; }nt-size: 1rem; ecr-rius:
|
|
: : poinr.ru relies on =
|
|
the implementations of <a hrnot accicd" datalor: var(--ar(--codeb><detail=tion</span></summary><div cladocbloc suchlps/trait.Drop.h=
|
|
tm::or panvar(kw-color); }sidebar-toggle itr-image: > li, .rm <usunt" transform=3D" />
|
|
ef=3rm=3D"roural ahavhrnter to it.
|
|
</spann>new(data: String) la -2ry--ZqvwZdrptFyontent-Typemutable reference we i top: calc(50%=in-highlion=3D"datgighliggba(18, 24, 26, 0.2sn't movtaysmmon case</p>
|
|
|
|
<div clan cla/span>> ty: 0; animation: order-widthpoinT;</code>). In the example of the ge
|
|
<--table-alt-row-ba=
|
|
ckgm> (pointed to by pointers wrappein.html=.91133 3.33span class=t=
|
|
*</span>b; <span cl
|
|
same de><a71-.82 3.1-.437.766-1.567-.129c-.593 0-1.f=3D"hg=
|
|
/std/marker/trait.Unpin.htr::e p, BlinkMacSystemt-of-band { text#6colvariant > .sub-varias in plae already moved =3D No-info tck-wrap: break-word; }
|
|
|
|
.itin.htmleng: quoted-printable
|
|
Content-Locatio35; --main-.074-.0073.73=
|
|
0 0 1 .033 0 0 1vR7
|
|
3px
|
|
h1 { font-size:gin: 0.67em r-bottomdest-arrow" target=3D"_blank" h3CT%3Eax-width: 100%; }
|
|
|
|
.ght: 10
|
|
.rustd moc.source .sidebder-right:thod.dros::Drdoc.rust-lang.org/sttle=3D"trait std::/struct.Pin.ht.refmut</a> Selt;</co(such as in yoe>Unvt.Uuctural ; }
|
|
|
|
#src-sidebar-togge
|
|
|
|
.anded .source .0px; top: Appl
|
|
.super_copy_btns_logtle-lanl=
|
|
" tD"Box">xed/stre bn.htmlihrefhttpl=3D\"none\" h7\"/></vg>") coltip { margin-top0pgt;</cuss=
|
|
someelfree to <a href=3Dttpt.Drop.hefcollectiticDe
|
|
ed href=3D"ptruct.Pinu-toggle">=E2=d::marker::Unpin"=======ld { r var(-- 0 1-2o{ bottom: 0id=
|
|
den; margin-bottom: 0pyle: ; border-bottom-c=
|
|
left-co; border-ihttps://doc.rust-langrait.Drop.hcDerefMuen theyid=3D"umiD2021">Run</a>h f=3"heightlf=
|
|
ormat("wofont-family: "Fira Sone; }
|
|
|
|
ol, ulex; flex-flowf-grow: 1; padding: 10px 15px 40per { display: nbackground: url(t border-r=
|
|
); }
|
|
|
|
esults-alias=earch-results;T>code>, both possibiur type d
|
|
ld);<causust-lan<a //doc.rust-lan=
|
|
g.org/std/rimitive.referens most likely dispebar-me98=B0"><i=
|
|
mre/trait.Futureedte <code><a hrefttpbdebar-backd%0A+itle=3D"mutable referenceut</a> Fthe field, butd:rdary--Zq; ct.s-la>
|
|
be careful
|
|
wh
|
|
.toggle-line-inner { min-wx; htrait.Drop.html=
|
|
" title=3D"trait std::ops::Drop"r, .example-.a75)" />3D"rotate(270.xlink:h)" highlight300; --code-hl-m-table { display: table; paddinl].fade-in.hiyle:afac=
|
|
5295.ttf.woff2") formatont-style: -plug5) highlight-contn=3D"er"-button" title=3D"help" tabindex=3D"-1"><a href=3(0.5, 0h-results .ar h2 a, h1 a., a.uspan.typeg/stati-8f9a781e4970d3=
|
|
88.woff"f/doc.ruststd/trait
|
|
nks 0.75em 0.625em-inius: 2ze
|
|
: calcthing the de thDropinvalid, which would/code></a>-rel"comment">// Since oe+thfieldreig] span { s nodocust-le.reference.html"=
|
|
/a> T<em; bocolor);=======================out oft+ge=
|
|
t+it.%0uck,+we+these+re+use+iont;></e=3D"primi
|
|
s" class=3p.html#tymeself</cat
|
|
combine pinnedref=3D"https://doc.rust-ter)td/vec/stlities (stru=
|
|
ctural pinniott sde>hrg/stpan>std::vaballs such" /><3D"viewpc.rust-latitle=3D"Copy it+++++++//+we+know+thih =LEASES.md3.0">quitle= te-space: nowlv-hate(6613%) hontrearch-hoeblock-link-bps:/future:poll
|
|
</dg(indial struct</a></arantees d+doesn%27t+move+thhole++++unsade-; t z-index: 1; padding: 0px; bacve; x =
|
|
width: 0px; } main e ope=
|
|
in/sn.html" titve.refer" data-th=stdoc-versio=3D"1.7080ick_fail:ver-cohp { color: var(-ck-i }
|
|
dis======================egend {; display: table; max-wie: nall pifor the-syste=
|
|
mFont, "\"Sion">Optit <code><=caclugina><<><em>withoutt-lang.; un}em-t: 2em; }
|
|
.sourct(.top DerefM</col" title=3D"ops::Deref=
|
|
">D======================================ly onav.rust-lang.org/sin::get_u D"kw">let </span>ut is unsafe for not allowed to =3tttp:/3.orgh7M8 contentls
|
|
deta; }
|
|
|
|
detale limitivutablence">&mut</a> Fips://doc.re, <em>ell.htmlef got later.</00% { transform: rotate(3nimatitps://e, you cnt <a ); --copy-path-img-r,142,0,.6); -r: #2bias-cdround-colo#31455-code-coight-kw-2-ata-gr-=
|
|
ext-instalthorhm=
|
|
> str t=3DUTF-8css" hiwn not to be null,
|
|
/ to b=
|
|
e madeh3 id=3D; }
|
|
.source main, .rustdls.toggle[open] > suetenne; }
|
|
|
|
detas=3Ddoc.ront-weSerif4-Bol}
|
|
-5put-fotps::pin::Pin">Pin</a><<a href=3D"https:
|
|
ttom: 1px solidcolor); margin; ; backg=
|
|
re; oparate-lang.or(selfmore co of mutable referstrav>
|
|
<p>The functi:Drop::drop"op</code></lay: flispace-betce-plugirgin: 0rtan [id column; }
|
|
tml" titlD"small->Structse"><lit" hado=
|
|
52-3.75 27l-.102.94.518 0 .36Pitd:: 200pxoc.source .bar { order:to low: hidden;truct s:pin::Pin">Pin</s suchtiv=
|
|
e.reference.h
|
|
wn data-gramma i
|
|
</lic.rust->}
|
|
|
|
.scrapx; poss(18,0px 3px 4px; f=
|
|
ProximaVarpplnter; border-bo=
|
|
city:enu, #help a, #help-button >idebar >.html" title=
|
|
=3D";</code> and <co=
|
|
de><a ; opacity: 0; }
|
|
15px;; mighry { mawser ig class=3D"rust-//doc.ru#">Moba=
|
|
ro"
|
|
ntent=3D"text }
|
|
|
|
#copy-> guantet
|
|
fields ructd::pin::Plt</a> Stustur=
|
|
ce Serif 4", NanumBarunGothi
|
|
.docbindex: 11; height=
|
|
(100vh - 45px); width fonsvref=3D"#cog" transform=<++++//+This+is+okay+because+%60field%60vg>=0A
|
|
------MultipartBounda:-topbar {: block; lry::-serif", "\"A4px; line-heigex-dtode>.
|
|
The usual approach writ-items a:hoverape-help):n .itemeg: 0playe: tf.woffl=3D"prelgin=3D"" href=3D"httust-lang.oont"{ displ
|
|
section needs to function correctaranpess(90%)t;</ce helper ); =
|
|
argin: c relver: poinmark3D\"htatggddd; --settings-in=
|
|
er-coloingsdolcolor: #-prcolor: hlight-attribute-colo</h3>
|
|
<-cobile-pading); }
|
|
}
|
|
|
|
.variant, .]:not(:lpirust-lang.org/s=
|
|
td/</ahref=3D"sfotate(288)" />
|
|
3D"3Pro-Semibold-d899c5a5c4aeb14a ved-blee: 1.375rem; }
|
|
opped. pintee ln discussin
|
|
meaning that truct is s alle to do this fo3s:.htt;></code>ing: rgo; padding, .dl .tyourcebject,not <co
|
|
tive; }
|
|
|
|
a.to { position: absolute;struc/pin/and choices
|
|
le=3D"prirhtml" tivisibility: hidden; }
|
|
pa:
|
|
margin: 5px .mobilebef initial; padding: istd::ops::Drop::meThis violat p>
|
|
</li>
|
|
</ol>
|
|
<h; srdea=
|
|
t("woff2")play:D"https://doc.rust-l.fSourceCodePrheorg/color: va=
|
|
r(--f varcoor); }8 1.362.937-.187.168.039.492.156.813.41856c2.r); }
|
|
|
|
solcolor); backgrou=
|
|
positiongrounimoved.
|
|
// Meanwhiw{ 1px solid; ovbile)s :not(#etr"Box">BoT&gcodin">Pi: auto hidden; }
|
|
|
|
.rustdoc .examp options=E"><pD"=
|
|
https:///div><div id3Dnt+moved.%0A//+Mare+=
|
|
f.%0A%23%5f=3D"https://doc.r{ mavensafe have"pinning-is-not-sthat.:pin::PiPin</=
|
|
a><9wZdrptFy8o----
|
|
Cone-ele Coloregrede=
|
|
{argin: 0px !imporode-attribute { 100
|
|
>&nt-sizle width: auto; ock code, .docblock-shoef=;mut</a> Sel> <a s://doc.r/primitipat()palso
|
|
move ode> without structurat/at;,ss=3D"kw">impl </span <span class=3D"conned =
|
|
/sn</a>P></cywore"><code>ref=3pinning requires unsafe code, butf ng=
|
|
<codehttiv></details><h2 iiv clasle=3D"struct =
|
|
strht: 3a hr.html#varef=3boupanded #src-it thttpsru=t-lang.org/std/pm>.
|
|
HowevD"ocg.org/">Bo
|
|
overlay { --tw-bg-opacitition: ft-ize: 24px; }
|
|
.mobile-filter); #aaa3; -=
|
|
-search- #1-alcr:=
|
|
f=3D"https://doc.. For example,
|
|
whetherpan>boxed.datfen class=3 ref=3D"https://doc.rutation. Ior a type likg/sr d/vec/structoduld have =
|
|
<::mar/ahtml" timarker::Uuc the lifetime of the o=
|
|
|
|
it would be t
|
|
#help-bucus)=
|
|
; }
|
|
|
|
#cockd
|
|
<code>impl<pt;an/rker/trait.Unpin.html" d/piuccrape-exampttps
|
|
er pinning
|
|
=Es also ons that 0 0 rgba(=
|
|
0, 0, 0, 0))e the data doe for <spalaointer once the =
|
|
data font-stitalic; f62dcc5011">&</s PUnpane>P</t wrape or de><a hrD"Box"<T>.Pistdngs-298e1ea74db45a-setthttps:D"2f7.orbirust-lration
|
|
requa rincipve to3D"#cog" transform=3D"ro)/cod://do"s it interacts w=
|
|
d/ops/tD"red referencestio=
|
|
n.)</cide whe href=3D"rust-lang.org/=
|
|
stn.sw"nt" type=3D"fontcompile_fail, .ewrap.should_pck; }font-fietarget-bac-col=
|
|
or)get}
|
|
|
|
.code-h0=9D to ::befoap; }
|
|
|
|
maition: relati{ padd .conten }
|
|
|
|
l" title=
|
|
=3D"iof cD"https://=
|
|
r::wr=
|
|
ite<.html would ms://cstr></=
|
|
a><T&g=
|
|
ize: 80%; }
|
|
|
|
sub, sup s</e
|
|
main(ormal;re: 1.5; font-family: "Solok ot
|
|
retd=
|
|
iittle=3D"trait stdt.Pindetails.toggtoggl{ pD=
|
|
eref.html" title=3:te
|
|
|
|
.top .docblize: 1.2bt&gmethom>projections</e=
|
|
m>)
|
|
tiD"struct std::> T>=
|
|
<ref=3sta"rustdoc mo-new-gr14.0" dled=3Dogs">
|
|
|
|
i(56.25)" />
|
|
<ef=" />
|
|
ef=n.html"iruct3D"htoden particular, as exp previ[repr(pas12 11H4v2h8zM4 =
|
|
17h4v1v-3l8.027-rtBou-lang.orml" title=3D"mutD"m
|
|
oned, the ent=E2=80=
|
|
:href=3/>
|
|
idle { posi1px s0 stalign-items: stretce-sidebatom=
|
|
om: 1premh4.code-he.sidebar, .mobile- ) { vis
|
|
.
|
|
|
|
::-webd-color:; m=3s=3D"kw-2">&mut <>=
|
|
<sightt.fe--2>.to_string());
|
|
<span class=m; }
|
|
|
|
owr
|
|
img; }
|
|
gfonltip { color: var(--coild) { margin-bottom:=
|
|
1em; crape-xgle:ld), #synthe=
|
|
tic-implem> .tog3Data);%0A+s+=
|
|
+modifying+a+fi:Pin">n</a><P&"https/std/pin/iort" content=ce-width, init7t+);%0A//+st0.953 2.97hZdrmitive.=
|
|
reference.html" tie{ 1o { width: 100%; background: rgb(;</code> function doc.rutablee=3.046-1.47
|
|
51.1 1.758 1.014.0
|
|
#help span.bottid-he
|
|
var(--main-=
|
|
dli><ef=3=
|
|
tang.org/std/atio"off" spellcheck=y tr:nth-child(2idt=
|
|
h: 80px; heigh--
|
|
Content-Typ000/svopy to cl2 2H2c=
|
|
olo: abstlong as=3D unmoved;
|
|
<span class=de><a href=3D"hct.Pl" /codref=3D"https:d-color)#src-sr { wple .codisplay: flex; flex-fl/p>
|
|
<p>Memory cflex-grow: =
|
|
1; } 15px.trait-header > a:hn: n: row nt-size: 1Struct {;mut </span>Fie>cause_unrow"ru+std:truct.rust-lang.org/std/b/=
|
|
struct.Pin.html"x</a>iat you neveri
|
|
ent is randoml==============================H -40 Z" />
|
|
<g id=3D"geeld:+Field+%7D%0Aimpx) {
|
|
.ou-align: left; mpe=3h""><divrs"=3D"g/o.125ground-color=
|
|
: var(--sidbrightn contrast(90%); --crate-search-diackgroundw; f.super_copyltipartBoundar
|
|
Conte}
|
|
|
|
rline3D"Content-Te" co=/html; charse a { day: flex; aliypx init
|
|
.source-sidebar-exem-taearch-resultucs://doc.rust-la.Unpin.htm"#hole" transf/s imat-family: monospace, mo font-size: 1e>/std/primiti</a> self</code>,mpiler automaticallyaped-exam=
|
|
eld`ruct+t+%7B+f2.242l.59 1.027c.75035 0 3.598-1.1gh{uighlock h5 { fort code,block table ; font-family: 255bg-opacity)=
|
|
);lugin-aledialog { w
|
|
- 100: x: 2147483647; - 0, 0, ations.im .toggle:not(:last-ch; =
|
|
colsispace-extensiot 69, 149,-ics, threusd.<an bptiZR--7827B7B71tp-equiv=nkial-scale=3DRust</title><lt-lang.ning <em>is</efor <codeions-nav.subovell; displayp: fleth: 115p: elliispace-plugin-highlight-container"ng.org/std/on::None".logo-container, .siar { postopb overow: =
|
|
hidden; wh 35px; max-heig5px;=::pin::Pin; </smtomPinned;
|
|
ptr::Nome/ Insti">// To ensur inNull::from(<span
|
|
=3D"kwt">// /std/p" tistruct/code><a href=3D"https://doccode
|
|
<a href=3D"httpl" t std::><codpin</code>em;raper { right: 0.2
|
|
.scrded) .code-wrapper::afem ; }
|
|
|
|
l-align:%7B%0ut+Fie%7B++++%7D">Run</a></dm-weigh=
|
|
wien5 H -25 V 11 ar=3D"c3D"#cog":hus </span>T
|
|
<span classpspan cl/ Here we g<sp-2">&=
|
|
</span>Reh=
|
|
eg) : #333; --sle=-ine-hovoc.rust-lang.o
|
|
itle=3ode>me"struct<a hrespan clas2"se `fiil=
|
|
+Structield+%7Dspt; }
|
|
|
|
.sity:opacinsir; wt: 36g: antialiasedr{ font-size: 75%; lub { botborder-style: none; }
|
|
httpc.rust-lang.org/sl" tde><a hr/doc.rust: <a hr=
|
|
to not ever call <a href=3Dstatic.filesvg" atructors.
|
|
This can be href=3D"g/ background-color:dle] button:disab=
|
|
led { opal-lang.org/std/pistd:: entntil it gets drg=amplstPi std::pin::Pin">Pin</a><cee=ce": var(roapsis; bordelid v3D"https://do<%0A%7D%os://doc.ru//doc. titleany <code>T</code>. Instead,
|
|
incused--=ec sde></a><cocodee</a>:=99s desstd/coll 20 4.0."M4 19h6v2H4zMndar=
|
|
Folloing con><code>s are always freelys
|
|
nhreat-}
|
|
|
|
mes rotating {=-se.238-1 2.953 27 ptFy8o---.1-ale> and=
|
|
<code><a href=3D"httpst-arrow-cisibility: visible; }
|
|
|
|
.c%: vp.anic ; c(c.emoji {a nested futurtus://doc.rust=
|
|
-span.foreigntypoad" ust-lang.oro/wof2" crossccde7d.t=
|
|
tybrosrctT&gecoratiebarggle-rap:px; color: #.15; on, select { text-tra0.35, ent: center}
|
|
|
|
@media {100% { visibility: viscode>T</code>. It 0518998 0-2-1-2-2V5c0-3h5C5 3.3t==nt-y_btns_;
|
|
izeausrc: url("Sformat("}
|
|
|
|
@fow(0 -1px 0 #fff); --ckgrou or: elf-colgh; -2f; -- solid vlock-error-hover-color);ar(--codeblol" title=
|
|
=3D"rust-laned/struct.Bok-background-colow: ellipsis; =
|
|
ov{ dlfe+=lllo%22.to_strin)+The+;edition=3D2021">< odpio /=
|
|
do-lang.org/std/vec/struct.Vect;</chath/a><Tt;</codes://dust-lang.org><a href=3D"htop-shad--cr=
|
|
) hue-ssocia --nvert(50%ab63; lor:rotate(255der-backe-codpinning k0
|
|
0
|
|
|
|
pre.rust .kw-code-highlight-kw-2-c
|
|
------Multipradio"] {t-inQH8LkhDBOtalQHLvXQrJtent-Tyn{ fonexample .cokrandr, #crate-seaafter { poie-to=
|
|
e;e-wrapptors-toggle[or: varo+obj=3ct.Pin.html" <em>valu=
|
|
engcount { font-size: ackgrounidth:solid var(-ig
|
|
<em>not</em>likes://std/pror<em> have
|
|
removed ar-.59-12-.3=ar, .searchearc, a.type, e, a.:=
|
|
ze: 1.25rem; whi p=
|
|
re-"e .toodebloplay: bloc .tooltp, .ec3D"ovlass=3D"kw-2;</span class=3D.form+the+compi.k h4hild { margi=
|
|
in=
|
|
-bottopbfontype { c font-s
|
|
button, input, gro1[type .codm; }
|
|
r; f3Dneed structurlang.org/std/pinur own
|
|
<a href=ous
|
|
let; font-size: 0px; -numbers { flex-grow: 0; l -color); }
|
|
|
|
span.fn, a.fn, spa
|
|
ord-link-color);ang.org/stdi-lang.org wheth=
|
|
<iwronguo happen to e As a consequence, ypacjectand-srtud+poiBll_un/nt;l[data-section=3D"data-scert</spa-.003-1.278-47.238 1.52.648 33 3.74anslate.5)" stroke=3D"black" stroke-=enk <use a scel
|
|
ts, .<//docl" <T>D"trait st>ec=
|
|
-line-numbers-span-or); }
|
|
writ
|
|
/doc.rust-l! So, nne
|
|
fietural pinnix; }
|
|
ghlline-hig>stdch is kno/ re.src-line-nuers a, eld hogine if <con clent">3ra-/std/ssc r: 1.25ter { content: " "t: 5px; wans";b6de7d.tnt-weigh=
|
|
t: 400cttps://do=
|
|
trait std:: <makes sens and
|
|
<co//p
|
|
td/al-pinning">ils.</p>
|
|
<pst =-color); he0px; width: 33px;path >y-p20
|
|
0% { ly taki><a hps://doc.rust=
|
|
onD"https://doc.rust-la><code>.html" t
|
|
atedust-lang.orgs=3D"exampe=3D"=
|
|
trai ast std::ops::Drop"rg/std/ops/><code>Drop<licitrefe: craped-example
|
|
|
|
.=
|
|
u of
|
|
/doc.std/keu
|
|
><spanass=3D"kw
|
|
.s thlang.org/s=
|
|
are mo g/std/boxedtle=3rn <cref=3D"ht/tansform=3D"trxlink:D"#hole4)" />
|
|
<use xlink:a=
|
|
nh3, a.italiasf=3D"httNone</co=
|
|
de></a>, or calling <a href= mor) font-size:rem; }
|
|
|
|
.emoji { f=3D"https:<cof.rpe <codn.htmxle-wrap"><p#searctecenteont-s-bings-menu > hoveded::
|
|
d: linear-gradient(th mar=
|
|
rer,> to overwrite it wiat t the previ3D"methodke</code></a>-likencreode> to pi:swple-wrd"><code==
|
|
7-21-1.273, ,var(--tw-shadow)ly:etdialog-cta { ditdialog dth: 4612p-logovar(--sr
|
|
|
|
.rus 0ing-shaampler-xml
|
|
C
|
|
<svg 3D"logD"r" trhref=3Dge/sv5-.1>eref</a></cokay"htt
|
|
memget">Pin<=
|
|
/org/std/ops/trat sarch1; bing is nrus>,ows ititle=3D"mn" role=andex=3
|
|
tadeg); }
|
|
1onay: ; boritle=3D"efDuld_panic:h 2pxck-</aely otd::ops::Drop" ca33/p>
|
|
<p>
|
|
typeD"Bh-grey-colute;-stmage-ser-iman.top {te 0px, blacolt=c.rg232=80=98S="settingbindex=3D"-1"><a tD"C</fogckground: var(--scrape-ex76v-1.191c0-1.2466-2.67gr-al=
|
|
iger; foto do{=3D"t-family: "Fira St-; ce">&mut</tout of a pinnab></code>, flass=3D"n>+class=3D"krust-lai=
|
|
=3D"hthef=3D"t2.402-.394.38l=======:///c
|
|
-2">&awe caps:
|
|
<ru i met">&mux rgba(0,dowbun.htmleef=3Ds://doc.rle=ni/
|
|
< cl=
|
|
*b;+/D&a/conten3</"kw"w">foramp;mut nen+)+%7Bruct+/da> <e vaecor); lo .example-wbackgrou axample-+ovablo=
|
|
ve+wect,%0A=ep(0der > h
|
|
|
|
.s}
|
|
search-
|
|
r,trform: rotate-rtBoundary--i type=3woff2" crossotuhe purpo3Dsor: pointer;.toggle-x; bottomenlor);r-
|
|
.scr
|
|
ow: co manc
|
|
|
|
eBoundary--ZqvR-LocationRoman; sjpe=
|
|
mcnijhjcdcrap.ignore .e:
|
|
ote; ader a.; top: calcrd
|
|
|
|
.ssf /cont/rigin=3D"" href=3D"https://deSerif43D"" at/Firnutifields are
|
|
the deker/ass=3D"re, addingt-chitrait.Unpin.html" titl the=owlectdoc .exitieidth: 24px; justifE2=80=><lisd</code>:) -> st-l:/at pin
|
|
ath fierefectioecpon></html>
|
|
artrc:) format(ccbpk/staticn-blackt: 600 swapiormal; fo:ape-erm: 0px; n {= iddenoata-y:3https:/=ng may have metho5 }
|
|
|
|
ble tbodn) { backgroundhoignor=
|
|
example-w(100% - 10px); e, .popovers://drimirly-shD"try-in
|
|
atiorue,"a href=d that turnst-lang.org/tio:Vecrle
|
|
ce,++ointer+shoulption { font-sizetp=
|
|
lepoaped-exampexpan
|
|
gin-left: -25morricolor: var(--or); consn%2dllD&amd=3D"examp ins::ahttps://Veet_de></"preltent+=ighlitdetailng: van-width:innir excont
|
|
# 213); textofa
|
|
nt-variant: norm -i rtpx -2p { posy=
|
|
- {as <co<De3D"ctes te to :pinauch hass=3D"te+=3D+A++n3D+%26mut+a55bwap; }
|
|
|
|
@kames color: va
|
|
stank }
|
|
xt-dnp prs bobers .line=3s://doc.lass=3Dm>shoml" titlferenc>p>FinsmmentTh to the cor+Sia> =
|
|
to =9Ck:rap.s.twrpentr);m; }
|
|
|
|
.s:"earch-div-ov; nummary:not(.hideme) p: abs=tai filargin-left:n ust-rg/lodiv cl=
|
|
main-h//doem pat1.ox">Box<tpsE2=a piode>e.Deref"><codre cl w">us</stie rflample-wra-hapx; baour
|
|
<a hrefn<a href=3D""http;io
|
|
z-i-style:s > a > dts > a { padding> sflore, eft=
|
|
: 5px 0px; > 701px) {
|
|
absou-lor olute; z-index: 10; .s: 1wi=panag.>il=9D ode>lledT<rait.DereerefMut"><ca hp>&mues for y=
|
|
.fe9bi; bent}
|
|
|
|
#crD"faSnk rel=3D.rt<ackoasl
|
|
|
|
posickgrounter-ev-search > o: 1resed)mghtper; aved y Blink>
|
|
ted;
|
|
/a> odedom: <Ser ==
|
|
tr<ig}}hF
|