Coder Social home page Coder Social logo

expecto-patronum's Introduction

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

expecto-patronum's People

Contributors

arjentix avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.