docs

您正在閱讀 v0.1.2 的文件。Nabi 0.1.2 已停止支援。 最新版本:v0.1.3 →

core::panic

API 參考只有英文版,由標準函式庫原始碼中的英文文件註解產生。

the compiler hooks panic_fn / oom_fn / unreachable_fn: print a message to stderr and exit 101. They never return: -> ! fits any slot.

Functions

panicSource

pub const fn panic(msg: str) -> !

Abort with msg, reporting the first caller outside a #[track_caller] chain.

oomSource

pub const fn oom() -> !

Out of memory (Fatal). The runtime's allocation failures end in the same nabi_oom.

unreachableSource

pub const fn unreachable() -> !

Abort: code the program believed it could never reach ran.

assertSource

pub const fn assert(cond: bool, msg: str = "")

Abort unless cond holds.

assert_eqSource

pub const fn assert_eq<T: PartialEq + Debug>(left: T, right: T, msg: str = "")

Abort unless left == right; the message shows both via Debug.

assert_neSource

pub const fn assert_ne<T: PartialEq + Debug>(left: T, right: T, msg: str = "")

Abort if left == right; the message shows both via Debug.