DebugUnwrapExt

Trait DebugUnwrapExt 

Source
pub trait DebugUnwrapExt {
    type Value;

    // Required methods
    unsafe fn debug_unwrap_unchecked(self) -> Self::Value;
    unsafe fn debug_expect_unchecked(self, msg: &str) -> Self::Value;
}
Expand description

Extension trait providing debug only checking of item validity

Required Associated Types§

Source

type Value

Expected type after performing an unwrap

Required Methods§

Source

unsafe fn debug_unwrap_unchecked(self) -> Self::Value

Returns the contained Some() or Ok() variant without checking the discriminant only in Release mode.

§Panics

When debug assertions are enabled this function will panic if the value is not Some() or Ok().

§Safety

Calling this method on None or Err() is undefined behavior when debug assertions are disabled.

Source

unsafe fn debug_expect_unchecked(self, msg: &str) -> Self::Value

Returns the contained Some() or Ok() variant without checking the discriminant only in Release mode.

§Panics

When debug assertions are enabled this function will panic with the provided msg.

§Safety

Calling this method on None or Err() is undefined behavior when debug assertions are disabled.

Implementations on Foreign Types§

Source§

impl<T> DebugUnwrapExt for Option<T>

Source§

type Value = T

Source§

unsafe fn debug_unwrap_unchecked(self) -> Self::Value

Source§

unsafe fn debug_expect_unchecked(self, msg: &str) -> Self::Value

Source§

impl<T, E> DebugUnwrapExt for Result<T, E>
where E: Debug,

Source§

type Value = T

Source§

unsafe fn debug_unwrap_unchecked(self) -> Self::Value

Source§

unsafe fn debug_expect_unchecked(self, msg: &str) -> Self::Value

Implementors§