+/livesplit-wrapper

git clone https://git.julia.blue/+/livesplit-wrapper

P1n3appl3deploy: 9b9f353f3b0e319547cabc5dcadc542d5ab54386b0170e4

gh-pages
8.8 KiB43 linesraw
1<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Marker trait for “plain old data” types that are valid for any bit pattern."><meta name="keywords" content="rust, rustlang, rust-lang, AnyBitPattern"><title>AnyBitPattern in bytemuck - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" href="../normalize.css"><link rel="stylesheet" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" href="../ayu.css" disabled><link rel="stylesheet" href="../dark.css" disabled><link rel="stylesheet" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../bytemuck/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../bytemuck/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">AnyBitPattern</a></h2><div class="sidebar-elems"><section><div class="block"><h3 class="sidebar-title"><a href="#implementors">Implementors</a></h3></div></section><h2 class="location"><a href="index.html">In bytemuck</a></h2></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../bytemuck/index.html"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><button type="button">?</button></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div></div></form></nav></div><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn"><span class="in-band">Trait <a href="index.html">bytemuck</a>::<wbr><a class="trait" href="#">AnyBitPattern</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../src/bytemuck/anybitpattern.rs.html#51-54">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="item-decl"><pre class="rust trait"><code>pub unsafe trait AnyBitPattern: <a class="trait" href="trait.Zeroable.html" title="trait bytemuck::Zeroable">Zeroable</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a> + 'static { }</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Marker trait for “plain old data” types that are valid for any bit pattern.</p>
2<p>The requirements for this is very similar to <a href="trait.Pod.html" title="Pod"><code>Pod</code></a>,
3except that the type can allow uninit (or padding) bytes.
4This limits what you can do with a type of this kind, but also broadens the
5included types to <code>repr(C)</code> <code>struct</code>s that contain padding as well as
6<code>union</code>s. Notably, you can only cast <em>immutable</em> references and <em>owned</em>
7values into <a href="trait.AnyBitPattern.html" title="AnyBitPattern"><code>AnyBitPattern</code></a> types, not <em>mutable</em> references.</p>
8<p><a href="trait.Pod.html" title="Pod"><code>Pod</code></a> is a subset of <a href="trait.AnyBitPattern.html" title="AnyBitPattern"><code>AnyBitPattern</code></a>, meaning that any <code>T: Pod</code> is also
9<a href="trait.AnyBitPattern.html" title="AnyBitPattern"><code>AnyBitPattern</code></a> but any <code>T: AnyBitPattern</code> is not necessarily <a href="trait.Pod.html" title="Pod"><code>Pod</code></a>.</p>
10<p><a href="trait.AnyBitPattern.html" title="AnyBitPattern"><code>AnyBitPattern</code></a> is a subset of <a href="trait.Zeroable.html" title="Zeroable"><code>Zeroable</code></a>, meaning that any <code>T: AnyBitPattern</code> is also <a href="trait.Zeroable.html" title="Zeroable"><code>Zeroable</code></a>, but any <code>T: Zeroable</code> is not
11necessarily <a href="trait.AnyBitPattern.html" title="AnyBitPattern">`AnyBitPattern  </a></p>
12<h2 id="derive"><a href="#derive">Derive</a></h2>
13<p>A <code>#[derive(AnyBitPattern)]</code> macro is provided under the <code>derive</code> feature
14flag which will automatically validate the requirements of this trait and
15implement the trait for you for both structs and enums. This is the
16recommended method for implementing the trait, however it’s also possible to
17do manually. If you implement it manually, you <em>must</em> carefully follow the
18below safety rules.</p>
19<ul>
20<li>*NOTE: even <code>C-style</code>, fieldless enums are intentionally <strong>excluded</strong> from
21this trait, since it is <strong>unsound</strong> for an enum to have a discriminant value
22that is not one of its defined variants.</li>
23</ul>
24<h2 id="safety"><a href="#safety">Safety</a></h2>
25<p>Similar to <a href="trait.Pod.html" title="Pod"><code>Pod</code></a> except we disregard the rule about it must not contain
26uninit bytes. Still, this is a quite strong guarantee about a type, so <em>be
27careful</em> when implementing it manually.</p>
28<ul>
29<li>The type must be inhabited (eg: no
30<a href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html">Infallible</a>).</li>
31<li>The type must be valid for any bit pattern of its backing memory.</li>
32<li>Structs need to have all fields also be <code>AnyBitPattern</code>.</li>
33<li>It is disallowed for types to contain pointer types, <code>Cell</code>, <code>UnsafeCell</code>,
34atomics, and any other forms of interior mutability.</li>
35<li>More precisely: A shared reference to the type must allow reads, and
36<em>only</em> reads. RustBelt’s separation logic is based on the notion that a
37type is allowed to define a sharing predicate, its own invariant that must
38hold for shared references, and this predicate is the reasoning that allow
39it to deal with atomic and cells etc. We require the sharing predicate to
40be trivial and permit only read-only access.</li>
41<li>There’s probably more, don’t mess it up (I mean it).</li>
42</ul>
43</div></details><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"><section id="impl-AnyBitPattern-for-T" class="impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/anybitpattern.rs.html#56">source</a><a href="#impl-AnyBitPattern-for-T" class="anchor"></a><h3 class="code-header in-band">impl&lt;T:&nbsp;<a class="trait" href="trait.Pod.html" title="trait bytemuck::Pod">Pod</a>&gt; <a class="trait" href="trait.AnyBitPattern.html" title="trait bytemuck::AnyBitPattern">AnyBitPattern</a> for T</h3></section></div><script src="../implementors/bytemuck/anybitpattern/trait.AnyBitPattern.js" async></script></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="bytemuck" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (4a1467723 2022-09-23)" ></div></body></html>