+/livesplit-wrapper
git clone https://git.julia.blue/+/livesplit-wrapper
b0170e4
gh-pages
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 with no uninit (or padding) bytes. ">< meta name ="keywords "content ="rust, rustlang, rust-lang, NoUninit ">< title > NoUninit 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 "> ☰</ 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 ="# "> NoUninit</ a ></ h2 >< div class ="sidebar-elems ">< section >< div class ="block ">< h3 class ="sidebar-title ">< a href ="#foreign-impls "> Implementations on Foreign Types</ a ></ h3 >< ul >< li >< a href ="#impl-NoUninit-for-NonZeroI128 "> NonZeroI128</ a ></ li >< li >< a href ="#impl-NoUninit-for-NonZeroI16 "> NonZeroI16</ a ></ li >< li >< a href ="#impl-NoUninit-for-NonZeroI32 "> NonZeroI32</ a ></ li >< li >< a href ="#impl-NoUninit-for-NonZeroI64 "> NonZeroI64</ a ></ li >< li >< a href ="#impl-NoUninit-for-NonZeroI8 "> NonZeroI8</ a ></ li >< li >< a href ="#impl-NoUninit-for-NonZeroIsize "> NonZeroIsize</ a ></ li >< li >< a href ="#impl-NoUninit-for-NonZeroU128 "> NonZeroU128</ a ></ li >< li >< a href ="#impl-NoUninit-for-NonZeroU16 "> NonZeroU16</ a ></ li >< li >< a href ="#impl-NoUninit-for-NonZeroU32 "> NonZeroU32</ a ></ li >< li >< a href ="#impl-NoUninit-for-NonZeroU64 "> NonZeroU64</ a ></ li >< li >< a href ="#impl-NoUninit-for-NonZeroU8 "> NonZeroU8</ a ></ li >< li >< a href ="#impl-NoUninit-for-NonZeroUsize "> NonZeroUsize</ a ></ li >< li >< a href ="#impl-NoUninit-for-bool "> bool</ a ></ li >< li >< a href ="#impl-NoUninit-for-char "> char</ a ></ li ></ ul ></ div >< 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 ="# "> NoUninit</ 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/no_uninit.rs.html#61 "> source</ a > ·< a id ="toggle-all-docs "href ="javascript:void(0) "title ="collapse all docs "> [< span class ="inner "> −</ span > ]</ a ></ span ></ div >< div class ="item-decl ">< pre class ="rust trait ">< code > pub unsafe trait NoUninit:< 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 with no uninit (or padding) bytes.</ p > 2< p > The requirements for this is very similar to< a href ="trait.Pod.html "title ="Pod ">< code > Pod</ code ></ a > , 3except that it doesn’t require that all bit patterns of the type are valid, 4i.e. it does not require the type to be< a href ="trait.Zeroable.html "title ="crate::Zeroable ">< code > Zeroable</ code ></ a > . 5This limits what you can do with a type of this kind, but also broadens the 6included types to things like C-style enums. Notably, you can only cast from 7< em > immutable</ em > references to a< a href ="trait.NoUninit.html "title ="NoUninit ">< code > NoUninit</ code ></ a > type into< em > immutable</ em > references of 8any other type, no casting of mutable references or mutable references to 9slices etc.</ p > 10< p >< a href ="trait.Pod.html "title ="Pod ">< code > Pod</ code ></ a > is a subset of< a href ="trait.NoUninit.html "title ="NoUninit ">< code > NoUninit</ code ></ a > , meaning that any< code > T: Pod</ code > is also 11< a href ="trait.NoUninit.html "title ="NoUninit ">< code > NoUninit</ code ></ a > but any< code > T: NoUninit</ code > is not necessarily< a href ="trait.Pod.html "title ="Pod ">< code > Pod</ code ></ a > . If possible, 12prefer implementing< a href ="trait.Pod.html "title ="Pod ">< code > Pod</ code ></ a > directly. To get more< a href ="trait.Pod.html "title ="Pod ">< code > Pod</ code ></ a > -like functionality 13for a type that is only< a href ="trait.NoUninit.html "title ="NoUninit ">< code > NoUninit</ code ></ a > , consider also implementing 14< a href ="checked/trait.CheckedBitPattern.html "title ="crate::CheckedBitPattern ">< code > CheckedBitPattern</ code ></ a > .</ p > 15< h2 id ="derive ">< a href ="#derive "> Derive</ a ></ h2 > 16< p > A< code > #[derive(NoUninit)]</ code > macro is provided under the< code > derive</ code > feature flag 17which will automatically validate the requirements of this trait and 18implement the trait for you for both enums and structs. This is the 19recommended method for implementing the trait, however it’s also possible to 20do manually. If you implement it manually, you< em > must</ em > carefully follow the 21below safety rules.</ p > 22< h2 id ="safety ">< a href ="#safety "> Safety</ a ></ h2 > 23< p > The same as< a href ="trait.Pod.html "title ="Pod ">< code > Pod</ code ></ a > except we disregard the rule about it must 24allow any bit pattern (i.e. it does not need to be 25< a href ="trait.Zeroable.html "title ="crate::Zeroable ">< code > Zeroable</ code ></ a > ). Still, this is a quite strong guarantee 26about a type, so< em > be careful</ em > whem implementing it manually.</ p > 27< ul > 28< li > The type must be inhabited (eg: no 29< a href ="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html "> Infallible</ a > ).</ li > 30< li > The type must not contain any uninit (or padding) bytes, either in the 31middle or on the end (eg: no< code > #[repr(C)] struct Foo(u8, u16)</ code > , which has 32padding in the middle, and also no< code > #[repr(C)] struct Foo(u16, u8)</ code > , which 33has padding on the end).</ li > 34< li > Structs need to have all fields also be< code > NoUninit</ code > .</ li > 35< li > Structs need to be< code > repr(C)</ code > or< code > repr(transparent)</ code > . In the case of 36< code > repr(C)</ code > , the< code > packed</ code > and< code > align</ code > repr modifiers can be used as long as 37all other rules end up being followed.</ li > 38< li > Enums need to have an explicit< code > #[repr(Int)]</ code ></ li > 39< li > Enums must have only fieldless variants</ li > 40< li > It is disallowed for types to contain pointer types,< code > Cell</ code > ,< code > UnsafeCell</ code > , 41atomics, and any other forms of interior mutability.</ li > 42< li > More precisely: A shared reference to the type must allow reads, and 43< em > only</ em > reads. RustBelt’s separation logic is based on the notion that a 44type is allowed to define a sharing predicate, its own invariant that must 45hold for shared references, and this predicate is the reasoning that allow 46it to deal with atomic and cells etc. We require the sharing predicate to 47be trivial and permit only read-only access.</ li > 48< li > There’s probably more, don’t mess it up (I mean it).</ li > 49</ ul > 50</ div ></ details >< h2 id ="foreign-impls "class ="small-section-header "> Implementations on Foreign Types< a href ="#foreign-impls "class ="anchor "></ a ></ h2 >< section id ="impl-NoUninit-for-char "class ="impl has-srclink ">< a class ="srclink rightside "href ="../src/bytemuck/no_uninit.rs.html#65 "> source</ a >< a href ="#impl-NoUninit-for-char "class ="anchor "></ a >< h3 class ="code-header in-band "> impl< a class ="trait "href ="trait.NoUninit.html "title ="trait bytemuck::NoUninit "> NoUninit</ a > for< a class ="primitive "href ="https://doc.rust-lang.org/nightly/core/primitive.char.html "> char</ a ></ h3 ></ section >< section id ="impl-NoUninit-for-bool "class ="impl has-srclink ">< a class ="srclink rightside "href ="../src/bytemuck/no_uninit.rs.html#67 "> source</ a >< a href ="#impl-NoUninit-for-bool "class ="anchor "></ a >< h3 class ="code-header in-band "> impl< a class ="trait "href ="trait.NoUninit.html "title ="trait bytemuck::NoUninit "> NoUninit</ a > for< a class ="primitive "href ="https://doc.rust-lang.org/nightly/core/primitive.bool.html "> bool</ a ></ h3 ></ section >< section id ="impl-NoUninit-for-NonZeroU8 "class ="impl has-srclink ">< a class ="srclink rightside "href ="../src/bytemuck/no_uninit.rs.html#69 "> source</ a >< a href ="#impl-NoUninit-for-NonZeroU8 "class ="anchor "></ a >< h3 class ="code-header in-band "> impl< a class ="trait "href ="trait.NoUninit.html "title ="trait bytemuck::NoUninit "> NoUninit</ a > for< a class ="struct "href ="https://doc.rust-lang.org/nightly/core/num/nonzero/struct.NonZeroU8.html "title ="struct core::num::nonzero::NonZeroU8 "> NonZeroU8</ a ></ h3 ></ section >< section id ="impl-NoUninit-for-NonZeroI8 "class ="impl has-srclink ">< a class ="srclink rightside "href ="../src/bytemuck/no_uninit.rs.html#70 "> source</ a >< a href ="#impl-NoUninit-for-NonZeroI8 "class ="anchor "></ a >< h3 class ="code-header in-band "> impl< a class ="trait "href ="trait.NoUninit.html "title ="trait bytemuck::NoUninit "> NoUninit</ a > for< a class ="struct "href ="https://doc.rust-lang.org/nightly/core/num/nonzero/struct.NonZeroI8.html "title ="struct core::num::nonzero::NonZeroI8 "> NonZeroI8</ a ></ h3 ></ section >< section id ="impl-NoUninit-for-NonZeroU16 "class ="impl has-srclink ">< a class ="srclink rightside "href ="../src/bytemuck/no_uninit.rs.html#71 "> source</ a >< a href ="#impl-NoUninit-for-NonZeroU16 "class ="anchor "></ a >< h3 class ="code-header in-band "> impl< a class ="trait "href ="trait.NoUninit.html "title ="trait bytemuck::NoUninit "> NoUninit</ a > for< a class ="struct "href ="https://doc.rust-lang.org/nightly/core/num/nonzero/struct.NonZeroU16.html "title ="struct core::num::nonzero::NonZeroU16 "> NonZeroU16</ a ></ h3 ></ section >< section id ="impl-NoUninit-for-NonZeroI16 "class ="impl has-srclink ">< a class ="srclink rightside "href ="../src/bytemuck/no_uninit.rs.html#72 "> source</ a >< a href ="#impl-NoUninit-for-NonZeroI16 "class ="anchor "></ a >< h3 class ="code-header in-band "> impl< a class ="trait "href ="trait.NoUninit.html "title ="trait bytemuck::NoUninit "> NoUninit</ a > for< a class ="struct "href ="https://doc.rust-lang.org/nightly/core/num/nonzero/struct.NonZeroI16.html "title ="struct core::num::nonzero::NonZeroI16 "> NonZeroI16</ a ></ h3 ></ section >< section id ="impl-NoUninit-for-NonZeroU32 "class ="impl has-srclink ">< a class ="srclink rightside "href ="../src/bytemuck/no_uninit.rs.html#73 "> source</ a >< a href ="#impl-NoUninit-for-NonZeroU32 "class ="anchor "></ a >< h3 class ="code-header in-band "> impl< a class ="trait "href ="trait.NoUninit.html "title ="trait bytemuck::NoUninit "> NoUninit</ a > for< a class ="struct "href ="https://doc.rust-lang.org/nightly/core/num/nonzero/struct.NonZeroU32.html "title ="struct core::num::nonzero::NonZeroU32 "> NonZeroU32</ a ></ h3 ></ section >< section id ="impl-NoUninit-for-NonZeroI32 "class ="impl has-srclink ">< a class ="srclink rightside "href ="../src/bytemuck/no_uninit.rs.html#74 "> source</ a >< a href ="#impl-NoUninit-for-NonZeroI32 "class ="anchor "></ a >< h3 class ="code-header in-band "> impl< a class ="trait "href ="trait.NoUninit.html "title ="trait bytemuck::NoUninit "> NoUninit</ a > for< a class ="struct "href ="https://doc.rust-lang.org/nightly/core/num/nonzero/struct.NonZeroI32.html "title ="struct core::num::nonzero::NonZeroI32 "> NonZeroI32</ a ></ h3 ></ section >< section id ="impl-NoUninit-for-NonZeroU64 "class ="impl has-srclink ">< a class ="srclink rightside "href ="../src/bytemuck/no_uninit.rs.html#75 "> source</ a >< a href ="#impl-NoUninit-for-NonZeroU64 "class ="anchor "></ a >< h3 class ="code-header in-band "> impl< a class ="trait "href ="trait.NoUninit.html "title ="trait bytemuck::NoUninit "> NoUninit</ a > for< a class ="struct "href ="https://doc.rust-lang.org/nightly/core/num/nonzero/struct.NonZeroU64.html "title ="struct core::num::nonzero::NonZeroU64 "> NonZeroU64</ a ></ h3 ></ section >< section id ="impl-NoUninit-for-NonZeroI64 "class ="impl has-srclink ">< a class ="srclink rightside "href ="../src/bytemuck/no_uninit.rs.html#76 "> source</ a >< a href ="#impl-NoUninit-for-NonZeroI64 "class ="anchor "></ a >< h3 class ="code-header in-band "> impl< a class ="trait "href ="trait.NoUninit.html "title ="trait bytemuck::NoUninit "> NoUninit</ a > for< a class ="struct "href ="https://doc.rust-lang.org/nightly/core/num/nonzero/struct.NonZeroI64.html "title ="struct core::num::nonzero::NonZeroI64 "> NonZeroI64</ a ></ h3 ></ section >< section id ="impl-NoUninit-for-NonZeroU128 "class ="impl has-srclink ">< a class ="srclink rightside "href ="../src/bytemuck/no_uninit.rs.html#77 "> source</ a >< a href ="#impl-NoUninit-for-NonZeroU128 "class ="anchor "></ a >< h3 class ="code-header in-band "> impl< a class ="trait "href ="trait.NoUninit.html "title ="trait bytemuck::NoUninit "> NoUninit</ a > for< a class ="struct "href ="https://doc.rust-lang.org/nightly/core/num/nonzero/struct.NonZeroU128.html "title ="struct core::num::nonzero::NonZeroU128 "> NonZeroU128</ a ></ h3 ></ section >< section id ="impl-NoUninit-for-NonZeroI128 "class ="impl has-srclink ">< a class ="srclink rightside "href ="../src/bytemuck/no_uninit.rs.html#78 "> source</ a >< a href ="#impl-NoUninit-for-NonZeroI128 "class ="anchor "></ a >< h3 class ="code-header in-band "> impl< a class ="trait "href ="trait.NoUninit.html "title ="trait bytemuck::NoUninit "> NoUninit</ a > for< a class ="struct "href ="https://doc.rust-lang.org/nightly/core/num/nonzero/struct.NonZeroI128.html "title ="struct core::num::nonzero::NonZeroI128 "> NonZeroI128</ a ></ h3 ></ section >< section id ="impl-NoUninit-for-NonZeroUsize "class ="impl has-srclink ">< a class ="srclink rightside "href ="../src/bytemuck/no_uninit.rs.html#79 "> source</ a >< a href ="#impl-NoUninit-for-NonZeroUsize "class ="anchor "></ a >< h3 class ="code-header in-band "> impl< a class ="trait "href ="trait.NoUninit.html "title ="trait bytemuck::NoUninit "> NoUninit</ a > for< a class ="struct "href ="https://doc.rust-lang.org/nightly/core/num/nonzero/struct.NonZeroUsize.html "title ="struct core::num::nonzero::NonZeroUsize "> NonZeroUsize</ a ></ h3 ></ section >< section id ="impl-NoUninit-for-NonZeroIsize "class ="impl has-srclink ">< a class ="srclink rightside "href ="../src/bytemuck/no_uninit.rs.html#80 "> source</ a >< a href ="#impl-NoUninit-for-NonZeroIsize "class ="anchor "></ a >< h3 class ="code-header in-band "> impl< a class ="trait "href ="trait.NoUninit.html "title ="trait bytemuck::NoUninit "> NoUninit</ a > for< a class ="struct "href ="https://doc.rust-lang.org/nightly/core/num/nonzero/struct.NonZeroIsize.html "title ="struct core::num::nonzero::NonZeroIsize "> NonZeroIsize</ a ></ h3 ></ section >< 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-NoUninit-for-T "class ="impl has-srclink ">< a class ="srclink rightside "href ="../src/bytemuck/no_uninit.rs.html#63 "> source</ a >< a href ="#impl-NoUninit-for-T "class ="anchor "></ a >< h3 class ="code-header in-band "> impl<T: < a class ="trait "href ="trait.Pod.html "title ="trait bytemuck::Pod "> Pod</ a > >< a class ="trait "href ="trait.NoUninit.html "title ="trait bytemuck::NoUninit "> NoUninit</ a > for T</ h3 ></ section ></ div >< script src ="../implementors/bytemuck/no_uninit/trait.NoUninit.js "data-ignore-extern-crates ="core "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 >