expecto-patronum

Crates.ioexpecto-patronum
lib.rsexpecto-patronum
version0.1.0
sourcesrc
created_at2023-01-07 11:36:36.336174
updated_at2023-01-07 11:36:36.336174
descriptionA library to add beatiful animals to your panic outputs
homepage
repositoryhttps://github.com/arjentix/expecto-patronum
max_upload_size
id753002
size21,917
Daniil Polyakov (Arjentix)

documentation

README

Expecto patronum

Disclaimer

I, Daniil Polyakov, hereby waive all rights to the code and resources distributed with this document that use elements from the Harry Potter universe and ASCII art. I understand that this code and resources are not sanctioned by, affiliated with, or endorsed by the Harry Potter rights holders or the creators of the ASCII art and I make no claims to the contrary. I acknowledge that the use of any intellectual property from the Harry Potter universe and ASCII art in my code and resources is for entertainment purposes only and falls under the doctrine of fair use. I make no claim to any rights in the Harry Potter universe or ASCII art and do not imply any endorsement or approval from the Harry Potter rights holders or the creators of the ASCII art. The waiver of rights applies to the Harry Potter elements and ASCII art in my code and resources and does not extend to the code itself. The code is distributed under MIT license.

Description

This crate allows you to replace all expect(…) with expecto_patronum(…) which works in the same way but also prints a beautiful patronus with your panic message. Patronus animal depends on the message you provide.

Examples

Simple usage example:

use expecto_patronum::prelude::*;

let x = Some("Harry Potter");
assert_eq!(x.expecto_patronum("No dementors here"), "Harry Potter");
use expecto_patronum::prelude::*;

let x: Option<&str> = None;
x.expecto_patronum("No dementors here"); // panics with `No dementors here` and casts a patronus

Output of the last example:

thread 'main' panicked at '
 _,
<\ `.
  `. `~'^----.._            _
   `. ,    _,  `.`-.       ' )
   , ),'-~'(   / ` .`-.___,-'
  ( /;      `'\,    `
  _/'       _//       `.
 ' "       ' "       ' `
No dementors here
'

Try this out

You can run

cargo run --example summon

And enter any line you want to get an example of generated animal.

Resources

Commit count: 16

cargo fmt