Rustemon is a fun Rust macro library that allows you to use Pokémon names as Rust keywords in your code. This project adds a playful touch to programming by mapping famous Pokémon names to various Rust constructs and keywords.
Rustemon lets you enhance your Rust code with Pokémon names, providing a unique and fun way to work with typical Rust features. By using Pokémon as keywords, you can express Rust concepts in a more playful and memorable way while still leveraging the power and safety of Rust.
This library defines a macro that enables you to invoke Rust keywords using Pokémon names. Whether you're looking to inject some humor into your project or just want a different way to express your code, Rustemon is the way to go.
-
Koffing =>
Err: Just as Koffing can be an explosive and erratic Pokémon,Errrepresents the unexpected or failure in Rust'sResulttype. Sometimes things don't go according to plan, and Koffing embodies that chaotic energy. -
Chansey =>
Ok: Chansey is a nurturing Pokémon, always offering healing. In Rust,Oksignifies success, much like Chansey's role in helping others. It's a symbol of good outcomes and positive results. -
Jigglypuff =>
String: Jigglypuff is a Pokémon that lulls others to sleep with its soothing voice, representing the fluid and flexible nature of theStringtype in Rust, which is dynamically sized and can grow and shrink like a melody. -
Porygon2 =>
HashMap: Porygon2 is a virtual, adaptable Pokémon that can evolve into different forms. Similarly, theHashMapin Rust adapts to store key-value pairs, making it a fitting match for a highly versatile Pokémon. -
Ditto =>
Default: Ditto can transform into any other Pokémon, embodying the concept ofDefaultin Rust—giving you a standard value or fallback that can be easily transformed into something else when needed. -
Gengar =>
Error: Gengar is a ghostly, menacing Pokémon that often brings fear or misfortune, much like how errors can disrupt the flow of your program in Rust. It represents theErrorvariant in theResulttype, which signals something went wrong. -
Abra =>
Option: Abra is a psychic Pokémon that can teleport away in an instant, much like how theOptiontype in Rust can either contain a value (Some) or be absent (None), representing a state of uncertainty or potential. -
Eevee =>
Some: Eevee is a Pokémon with the unique ability to evolve into many different forms, each bringing something new and valuable. TheSomevariant inOptionrepresents a known value, much like how Eevee holds the potential for various outcomes. -
Shedinja =>
None: Shedinja is the empty shell of Ninjask, which represents a void or absence. In Rust,Noneis used to signify the absence of a value in anOption, much like how Shedinja is empty but still has a presence in the Pokémon world. -
Mewtwo =>
Result: Mewtwo is a powerful and evolved Pokémon, representing the duality of success and failure. TheResulttype in Rust is a powerful structure that handles both the potential for success (Ok) and failure (Err). -
Zorua =>
Self: Zorua can change its appearance and mimic others, much like howSelfin Rust refers to the current type or instance, representing identity and the ability to adapt. -
chatot =>
println: Chatot is known for its ability to mimic sounds and communicate. Just asprintln!is used to print messages to the console, Chatot is all about expression and communication. -
snorlax =>
break: Snorlax is a sleepy Pokémon, often blocking paths and forcing others to take breaks. In Rust,breakis used to exit loops, making Snorlax the perfect embodiment of interrupting the flow to take a rest. -
darkrai =>
async: Darkrai, the bringer of nightmares, represents things that happen in the future and are out of our direct control, much like howasyncfunctions handle operations that will complete later. -
slowpoke =>
await: Slowpoke is famously slow, andawaitin Rust is used to pause execution until a result is ready, much like how Slowpoke takes its time, awaiting the next event. -
wobbuffet =>
loop: Wobbuffet is a resilient Pokémon that counteracts attacks, representing the idea of a continuous, unyielding loop. In Rust,looprepresents an indefinite loop, much like Wobbuffet’s ability to persist and counter endlessly. -
machamp =>
move: Machamp is known for its strength and ability to throw powerful punches. Themovekeyword in Rust is used to transfer ownership, just like how Machamp can forcefully move or take control of objects. -
pokéball =>
crate: A Pokéball is where Pokémon are contained and stored, similar to how acratein Rust is a package of code, a container for your project and dependencies. -
palkia =>
unreachable_code: Palkia, the controller of space, manipulates dimensions and realities. Similarly,unreachable_codein Rust represents code that should theoretically never be executed, yet might still exist due to some strange or impossible circumstance. -
zoroark =>
as: Zoroark is a master of illusion and disguise, changing its appearance at will. Theaskeyword in Rust is used for type casting or pattern matching, a perfect match for Zoroark’s shape-shifting abilities. -
regice =>
const: Regice is a legendary Pokémon associated with ice and stability, much like theconstkeyword in Rust, which defines values that are constant and immutable throughout the program. -
arceus =>
trait: Arceus is known as the "Original One" in the Pokémon world, a figure of immense influence and versatility. Thetraitkeyword in Rust represents a collection of methods and behaviors, and like Arceus, it forms the foundation for other types to build upon. -
giratina =>
unsafe: Giratina exists in a twisted, distorted dimension and represents the dangerous, unpredictable aspects of the Pokémon world. In Rust,unsafeblocks are used to bypass safety checks, much like the risks associated with Giratina’s existence. -
diglett =>
in: Diglett is a small Pokémon that often hides underground, representing the idea of something hidden or part of a larger collection. In Rust,inis used in pattern matching to check membership within ranges or collections. -
pidgey =>
from: Pidgey is a bird that often migrates or moves from place to place. In Rust,fromis used for converting between types, a metaphor for Pidgey’s ability to change locations. -
castform =>
dyn: Castform is known for changing its form depending on the weather, much likedynin Rust, which represents dynamic dispatch and allows types to change at runtime. -
kecleon =>
unwrap: Kecleon can change its color to blend in with its surroundings, just asunwrapin Rust forces a value to be extracted from anOptionorResult, but if it’sNoneorErr, it panics, similar to Kecleon’s risky transformation. -
espurr =>
as_ref: Espurr is a psychic Pokémon that can observe things from a distance, much like howas_refin Rust converts a reference to another reference type, allowing you to observe or borrow data without taking ownership. -
magnemite =>
io: Magnemite generates magnetic fields, interacting with the world around it. In Rust,iois a module used to interact with the outside world, like reading from or writing to files, representing Magnemite’s power to influence its surroundings. -
deoxys =>
extern: Deoxys is an extraterrestrial Pokémon, originating from beyond our planet, just likeexternin Rust refers to functions or variables that are defined outside the current program or module, often from foreign code or libraries. -
zubat =>
false: Zubat is a bat-like Pokémon that is often associated with darkness and negativity, fitting the idea offalsein Rust, which represents the opposite oftrue. -
alakazam =>
fn: Alakazam is a highly intelligent, psychic Pokémon, capable of complex thought and problem-solving. Thefnkeyword in Rust defines functions, a core building block of intelligent systems, just like Alakazam’s mental prowess. -
lucario =>
super: Lucario is a Pokémon that senses and acts with immense awareness, often in conjunction with its teammates. In Rust,superrefers to the parent module, embodying Lucario’s connection to its roots and awareness of the broader context. -
togepi =>
insert: Togepi is an innocent and happy Pokémon, often seen bringing new life and joy. Similarly,insertin Rust is used to add elements into collections, bringing new values into the fold. -
meowth =>
get: Meowth is clever and resourceful, often seeking to get what it wants. Thegetmethod in Rust is used to retrieve values from collections, representing Meowth’s ability to find what it’s looking for. -
clefairy =>
allow: Clefairy is a kind and peaceful Pokémon, often allowing others to coexist around it. Theallowattribute in Rust enables certain behaviors or features, much like how Clefairy is permissive and nurturing. -
psyduck =>
panic: Psyduck is often confused and experiences headaches, leading to sudden outbursts. In Rust,panic!triggers a program crash, a moment of unexpected chaos, much like Psyduck’s sudden loss of control. -
metang =>
mod: Metang is a powerful, armored Pokémon, representing structure and organization. In Rust,moddefines a module, which organizes code and functionality in a clear, structured way. -
grimer =>
mut: Grimer is a sludge Pokémon that is ever-changing and adaptable. Similarly,mutin Rust marks a variable as mutable, allowing it to be changed, like Grimer’s shifting and dynamic nature. -
togekiss =>
new: Togekiss is a serene and gentle Pokémon, often symbolizing new beginnings and peace. In Rust,newis used to create new instances of types, much like how Togekiss brings fresh energy and hope. -
unown =>
where: Unown is a mysterious Pokémon that represents hidden meanings and puzzles. Thewherekeyword in Rust places constraints on types, adding an element of mystery and specificity to functions and structs. -
blaziken =>
for: Blaziken is a fiery, powerful Pokémon, constantly pushing forward. Theforloop in Rust is a powerful construct used to iterate over collections, symbolizing Blaziken’s unstoppable drive. -
aipom =>
get_or_insert_with: Aipom is a clever and opportunistic Pokémon, always getting what it needs. In Rust,get_or_insert_withis used to either retrieve or insert a value into a collection, representing Aipom’s ability to get what it wants through clever means. -
pikachu =>
main: Pikachu is the face of the Pokémon franchise, always leading the charge. In Rust,mainis the entry point of the program, the first function to run, just like Pikachu is often the first to take action. -
jirachi =>
pub: Jirachi is a wish-granting Pokémon, always open to granting others' desires. Thepubkeyword in Rust makes items public, allowing access from outside the module, much like Jirachi’s openness to sharing its power. -
celebi =>
let: Celebi is a time-traveling Pokémon that exists between the past and future. In Rust,letis used for variable bindings, representing the moment when something is defined or created in time. -
pidgeot =>
return: Pidgeot is a strong, majestic bird that returns to its nest. Similarly,returnin Rust exits a function and returns a value, symbolizing Pidgeot’s return to its home. -
metagross =>
impl: Metagross is a highly intelligent and strategic Pokémon, representing the implementation of methods and behaviors in Rust’simplblocks. -
espeon =>
ref: Espeon is a psychic Pokémon that observes and interacts with the world around it. Therefkeyword in Rust creates a reference, allowing you to observe a value without taking ownership, similar to how Espeon senses everything from a distance. -
smeargle =>
match: Smeargle is a creative Pokémon that draws and paints based on its experiences. In Rust,matchis used for pattern matching, drawing conclusions based on the shape or structure of data. -
ralts =>
if: Ralts is a Pokémon that reacts to emotions and changes based on surroundings, much like howifstatements control the flow of a program based on conditions. -
kirlia =>
else: Kirlia evolves from Ralts and has a more defined, graceful form, symbolizing the alternative to the initial condition in anifstatement, represented byelse. -
elekid =>
static: Elekid is a baby Pokémon with electrical energy, a constant power source. In Rust,staticis used to define values with a fixed memory location, representing stability and reliability. -
bronzong =>
struct: Bronzong is a bell-shaped, structured Pokémon that represents stability and organization.structin Rust is used to define custom data types, bringing order and structure to your code. -
mimikyu =>
expect: Mimikyu disguises itself to appear like Pikachu, representing the expectation that things will be as they appear. Similarly,expectin Rust retrieves values fromOptionorResult, but with the expectation that it will succeed, or it panics with a custom message. -
durant =>
while: Durant is a hardworking, diligent ant, always moving and working. Thewhileloop in Rust is a continuous action, much like Durant’s tireless nature. -
bidoof =>
use: Bidoof is an industrious, resourceful Pokémon, much like howuseis used in Rust to bring external code or libraries into your project. -
kadabra =>
into: Kadabra is a psychic Pokémon that can transform or change the state of objects around it, representing theintokeyword in Rust, which consumes a value and converts it into another type. -
bulbasaur =>
true: Bulbasaur is a reliable, grounded Pokémon, andtruein Rust represents a constant value that indicates affirmation, certainty, or correctness. -
rotom =>
enum: Rotom is a versatile, electric-type Pokémon that can inhabit various devices, representing theenumtype in Rust, which can represent multiple possibilities or types within a single structure.
Here’s an example of how you can use the rustemon macro in your Rust code:
rustemon::rustemon! {
alakazam pikachu() {
chatot!("Hello, world!");
}
}