#[repr(transparent)]pub struct NonNa<T>(T);Expand description
A value that holds no R NA: a #[miniextendr] parameter refuses an
argument with one (see the module docs). Transparent over T.
Tuple Fields§
§0: TImplementations§
Source§impl<T: MaybeNa> NonNa<T>
impl<T: MaybeNa> NonNa<T>
Sourcepub fn new(value: T) -> Option<Self>
pub fn new(value: T) -> Option<Self>
value as a NonNa, or None when it holds an NA
(MaybeNa::has_na).
Source§impl<T> NonNa<T>
impl<T> NonNa<T>
Sourcepub const unsafe fn new_unchecked(value: T) -> Self
pub const unsafe fn new_unchecked(value: T) -> Self
value as a NonNa, without checking it.
§Safety
value must hold no NA in the sense of anyNA(): code receiving a
NonNa relies on that.
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
The value.
Sourcepub fn unwrap(self) -> T
pub fn unwrap(self) -> T
The value; the same as into_inner. It never
panics: a NonNa always holds one.
Trait Implementations§
impl<T: Copy> Copy for NonNa<T>
Source§impl<T: Eq> Eq for NonNa<T>
impl<T: Eq> Eq for NonNa<T>
Source§#[doc(hidden)]fn assert_fields_are_eq(&self)
#[doc(hidden)]fn assert_fields_are_eq(&self)
🔬This is a nightly-only experimental API. (
derive_eq_internals)1.0.0 (const: unstable) · Source§#[doc(hidden)]fn assert_receiver_is_total_eq(&self)
#[doc(hidden)]fn assert_receiver_is_total_eq(&self)
👎Deprecated since 1.95.0:
implementation detail of #[derive(Eq)]
Source§impl<T: Ord> Ord for NonNa<T>
impl<T: Ord> Ord for NonNa<T>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl<T: PartialOrd> PartialOrd for NonNa<T>
impl<T: PartialOrd> PartialOrd for NonNa<T>
Source§fn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
Source§#[doc(hidden)]fn __chaining_less(&self, other: &Rhs) -> ControlFlow<bool>
#[doc(hidden)]fn __chaining_less(&self, other: &Rhs) -> ControlFlow<bool>
🔬This is a nightly-only experimental API. (
partial_ord_chaining_methods)If
self == other, returns Continue(()).
Otherwise, returns Break(self < other), or equivalently Break(self <= other).
The only difference when chaining < and <= is how an equality result is
interpreted at the end of the chain. Read moreSource§#[doc(hidden)]fn __chaining_greater(&self, other: &Rhs) -> ControlFlow<bool>
#[doc(hidden)]fn __chaining_greater(&self, other: &Rhs) -> ControlFlow<bool>
🔬This is a nightly-only experimental API. (
partial_ord_chaining_methods)Same as
__chaining_less, but for >/>= instead of </<=.impl<T: PartialEq> StructuralPartialEq for NonNa<T>
Auto Trait Implementations§
impl<T> Forget for NonNa<T>
impl<T> Freeze for NonNa<T>where
T: Freeze,
impl<T> RefUnwindSafe for NonNa<T>where
T: RefUnwindSafe,
impl<T> Send for NonNa<T>where
T: Send,
impl<T> Sync for NonNa<T>where
T: Sync,
impl<T> Unpin for NonNa<T>where
T: Unpin,
impl<T> UnsafeUnpin for NonNa<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for NonNa<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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConsumingFallible for Twhere
T: Clone,
impl<T> Printable for T
Source§impl<T> RCopy for Twhere
T: Copy,
impl<T> RCopy for Twhere
T: Copy,
Source§impl<T> RDebug for Twhere
T: Debug,
impl<T> RDebug for Twhere
T: Debug,
Source§impl<T> RPartialOrd for Twhere
T: PartialOrd,
impl<T> RPartialOrd for Twhere
T: PartialOrd,
Source§fn r_partial_cmp(&self, other: &T) -> Option<i32>
fn r_partial_cmp(&self, other: &T) -> Option<i32>
Compare with another value, returning None if incomparable. Read more
Source§impl<T> SizeHint for Twhere
T: ?Sized,
impl<T> SizeHint for Twhere
T: ?Sized,
Source§default fn lower_bound(&self) -> usize
default fn lower_bound(&self) -> usize
🔬This is a nightly-only experimental API. (
core_io_internals)Returns a lower bound on the number of elements this container-like item
contains.
For example, an array
[u8; 12] could return any value between 0 and
12 inclusively as a correct implementation. Read moreSource§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)]const SIZE: usize
#[doc(hidden)]const SIZE: usize
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const ALIGN: usize
#[doc(hidden)]const ALIGN: usize
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const ALIGNMENT: Alignment
#[doc(hidden)]const ALIGNMENT: Alignment
🔬This is a nightly-only experimental API. (
ptr_alignment_type)Source§#[doc(hidden)]const IS_ZST: bool
#[doc(hidden)]const IS_ZST: bool
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const LAYOUT: Layout
#[doc(hidden)]const LAYOUT: Layout
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const MAX_SLICE_LEN: usize
#[doc(hidden)]const MAX_SLICE_LEN: usize
🔬This is a nightly-only experimental API. (
sized_type_properties)The largest safe length for a
[Self]. Read moreLayout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.