pub struct NONE<T>(/* private fields */);
Expand description
Usable to do [None::<T>; LEN]
when T
is non-Copy
.
As of Rust 1.51.0, [None::<T>; LEN]
is not valid for non-Copy
types,
but [CONST; LEN]
does work, like in the example below.
§Example
use konst::option::NONE;
use std::mem::{self, MaybeUninit};
const TEN: [Option<String>; 10] = [NONE::V; 10];
let ten = [NONE::<String>::V; 10];
// the `vec` macro only needs `Option<String>` to be clonable, not Copy.
assert_eq!(vec![None::<String>; 10], TEN);
assert_eq!(vec![None::<String>; 10], ten);
Implementations§
Auto Trait Implementations§
impl<T> Freeze for NONE<T>
impl<T> RefUnwindSafe for NONE<T>where
T: RefUnwindSafe,
impl<T> Send for NONE<T>where
T: Send,
impl<T> Sync for NONE<T>where
T: Sync,
impl<T> Unpin for NONE<T>where
T: Unpin,
impl<T> UnwindSafe for NONE<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 0 bytes