Enum SadnessFlavor

Source
pub enum SadnessFlavor {
    Abort,
    Segfault,
    DivideByZero,
    Illegal,
    Bus,
    Trap,
    StackOverflow {
        non_rust_thread: bool,
        long_jumps: bool,
    },
}
Expand description

How you would like your sadness.

Variants§

§

Abort

SIGABRT

Note that on Windows, std::process::abort, the canonical way to abort processes in Rust, uses the fastfail intrinsic, which neither raises a SIGABRT signal, nor issue a Windows exception. The method in this library always uses libc::abort

§

Segfault

  • SIGSEGV on Linux
  • EXCEPTION_ACCESS_VIOLATION on Windows
  • EXC_BAD_ACCESS on Macos
§

DivideByZero

  • SIGFPE on Linux
  • EXCEPTION_INT_DIVIDE_BY_ZERO on Windows
  • EXC_ARITHMETIC on Macos
§

Illegal

  • SIGILL on Linux
  • EXCEPTION_ILLEGAL_INSTRUCTION on Windows
  • EXC_BAD_INSTRUCTION on Macos
§

Bus

  • SIGBUS on Linux
  • EXC_BAD_ACCESS on Macos
§

Trap

  • SIGTRAP on Linux
  • EXCEPTION_BREAKPOINT on Windows
  • EXC_BREAKPOINT on Macos
§

StackOverflow

  • SIGSEGV on Linux
  • EXCEPTION_STACK_OVERFLOW on Windows
  • EXC_BAD_ACCESS on Macos

Fields

§non_rust_thread: bool

Raises the signal/exception from a non-std::thread::Thread

§long_jumps: bool

If using a native thread and there is a signal handler that longjumps, we can’t wait on the thread as we would normally as it would deadlock

Implementations§

Source§

impl SadnessFlavor

Source

pub unsafe fn make_sad(self) -> !

This only ends one way. Sadness.

§Safety

This is not safe. It intentionally crashes.

Trait Implementations§

Source§

impl Clone for SadnessFlavor

Source§

fn clone(&self) -> SadnessFlavor

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SadnessFlavor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for SadnessFlavor

Source§

fn eq(&self, other: &SadnessFlavor) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for SadnessFlavor

Source§

impl Eq for SadnessFlavor

Source§

impl StructuralPartialEq for SadnessFlavor

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.