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

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

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

Implementations

This only ends one way. Sadness.

Safety

This is not safe. It intentionally crashes.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.