#quote #panic #back #own #terrible #disorder #bring

lovecraft

在恐慌中恢复洛夫克拉夫特引言

2 个不稳定版本

0.2.0 2019年4月12日
0.1.0 2019年4月12日

#34 in #back

MIT 许可证

7KB
62

你遇到了可怕的命运,不是吗?

很久以前,每个 Rust 程序都附带一组会在恐慌时显示的洛夫克拉夫特引言。不幸的是,出于许多重要原因,例如使“hello world”程序更小,它们被移除了。

幸运的是,这个包将混乱和恐惧带回到了你的程序中。

以下代码

extern crate lovecraft;

fn main() {
    lovecraft::invoke();

    panic!("Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn");
}

这将打印

$ ./main
Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn

It was from the artists and poets that the pertinent answers came, and I
know that panic would have broken loose had they been able to compare notes.
As it was, lacking their original letters, I half suspected the compiler of
having asked leading questions, or of having edited the correspondence in
corroboration of what he had latently resolved to see.

您也可以使用以下函数选择自己的引言:lovecraft::panic_quotes(quotes: &'static [&'static str], default: &'static str)

无运行时依赖