Skip to content

yusufakdenizxd/rustemon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rustemon

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.

Project Description

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.

List of Pokémon Keywords

  • Koffing => Err: Just as Koffing can be an explosive and erratic Pokémon, Err represents the unexpected or failure in Rust's Result type. 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, Ok signifies 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 the String type 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, the HashMap in 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 of Default in 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 the Error variant in the Result type, which signals something went wrong.

  • Abra => Option: Abra is a psychic Pokémon that can teleport away in an instant, much like how the Option type 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. The Some variant in Option represents 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, None is used to signify the absence of a value in an Option, 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. The Result type 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 how Self in 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 as println! 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, break is 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 how async functions handle operations that will complete later.

  • slowpoke => await: Slowpoke is famously slow, and await in 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, loop represents 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. The move keyword 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 a crate in 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_code in 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. The as keyword 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 the const keyword 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. The trait keyword 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, unsafe blocks 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, in is 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, from is 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 like dyn in 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 as unwrap in Rust forces a value to be extracted from an Option or Result, but if it’s None or Err, 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 how as_ref in 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, io is 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 like extern in 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 of false in Rust, which represents the opposite of true.

  • alakazam => fn: Alakazam is a highly intelligent, psychic Pokémon, capable of complex thought and problem-solving. The fn keyword 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, super refers 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, insert in 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. The get method 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. The allow attribute 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, mod defines 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, mut in 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, new is 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. The where keyword 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. The for loop 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_with is 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, main is 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. The pub keyword 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, let is 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, return in 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’s impl blocks.

  • espeon => ref: Espeon is a psychic Pokémon that observes and interacts with the world around it. The ref keyword 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, match is 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 how if statements 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 an if statement, represented by else.

  • elekid => static: Elekid is a baby Pokémon with electrical energy, a constant power source. In Rust, static is 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. struct in 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, expect in Rust retrieves values from Option or Result, 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. The while loop in Rust is a continuous action, much like Durant’s tireless nature.

  • bidoof => use: Bidoof is an industrious, resourceful Pokémon, much like how use is 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 the into keyword in Rust, which consumes a value and converts it into another type.

  • bulbasaur => true: Bulbasaur is a reliable, grounded Pokémon, and true in 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 the enum type in Rust, which can represent multiple possibilities or types within a single structure.

Example Usage

Here’s an example of how you can use the rustemon macro in your Rust code:

rustemon::rustemon! {
    alakazam pikachu() {
        chatot!("Hello, world!");
    }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages