6 releases

Uses old Rust 2015

0.3.1 Jan 3, 2020
0.3.0 Dec 17, 2018
0.2.0 Apr 29, 2017
0.1.2 Apr 25, 2017

#323 in Games

MIT license

26KB
1K SLoC

This simple crate allows you to translate a UUID to a pokémon name. The purpose is to provide simple names to address objects, so you can easily talk with people about the objects.

The function is not injective. This means several UUIDs will give the same name. We don't consider it an issue since context (like owner of object) will help dedup the search.

Examples

extern crate uuid;
extern crate uuid_to_pokemon;

use uuid::Uuid;
use uuid_to_pokemon::uuid_to_pokemon;
use std::fmt::Write; // needed for write!

fn main() {
    let my_uuid = Uuid::nil();
    let result = uuid_to_pokemon(my_uuid);

    // format it:
    let s = format!("`{}` as pokemon: `{}`", my_uuid, result);
    assert_eq!(s, "`00000000-0000-0000-0000-000000000000` as pokemon: `Busy bulbasaur`");

    // write it into an existing String:
    let mut s = "foo bar - ".to_string();
    write!(s, "pokemon: `{}`", result).unwrap();
    assert_eq!(s, "foo bar - pokemon: `Busy bulbasaur`");

    // if you need a simple String, use the to_string function:
    let s = result.to_string();
    assert_eq!(s, "Busy bulbasaur");
}

Dependencies

~240KB