Crates.io | blank-mumu |
lib.rs | blank-mumu |
version | 0.1.4 |
created_at | 2025-09-05 09:58:08.467998+00 |
updated_at | 2025-09-10 23:21:33.189359+00 |
description | blank-mumu is a plugin for the mumu ecosystem |
homepage | https://lava.nu11.uk |
repository | https://gitlab.com/tofo/blank-mumu |
max_upload_size | |
id | 1825315 |
size | 27,134 |
The blank-mumu
project is a foundational or template plugin designed for the Mumu ecosystem. Its purpose is to serve as a starting point for building additional plugins within the Mumu language and environment. The structure and design of the blank-mumu
project are intended to offer developers a quick-start template, demonstrating how to organize the code for reusable, modular plugin development while adhering to best practices like separating concerns and keeping the code DRY (Don’t Repeat Yourself).
blank-mumu
project is structured around a modular design where core functionality is separated into different files, particularly in the register
directory. This directory contains individual files (hello.rs
, bye.rs
) that each handle the registration of different functions (blank:hello
, blank:bye
) in the Mumu language.blank-mumu
aims to demonstrate how to maintain separation of concerns. This approach allows future plugins to extend and modify their functionality with minimal interference, making it easy to scale and maintain code.blank:hello
, blank:bye
) is kept simple but is registered with the interpreter to be used by the Mumu language environment. This modular approach ensures that additional functions can be easily added or modified without disturbing the core structure.register
Directory:
register
directory plays a crucial role in organizing and isolating the functionality that directly interacts with the Mumu environment. Each submodule in this folder (like hello.rs
and bye.rs
) is responsible for registering a specific function that will be exposed to the Mumu interpreter.register
without cluttering the global scope or requiring major changes to other parts of the project.blank:hello
and blank:bye
):
blank:hello
function demonstrates the simplest form of a function that can be executed in the Mumu environment. It simply returns the string "Hello World!!". The implementation of blank:hello
is kept minimal to show how the function is registered with the interpreter and how it can be invoked.blank:bye
function operates similarly by returning the string "Sorry to see you go!!", serving as another example of how to register a function and provide a response in the language.hello.rs
and bye.rs
), allowing for a single responsibility (SRP) within each file. This clean separation makes the codebase more understandable and encourages best practices like modularity and reusability.blank-mumu
design is to emphasize the DRY principle. This principle states that each piece of knowledge or logic should have a single, unambiguous, authoritative representation within the system.blank-mumu
plugin, we see this in the registration process of each function. The logic to register a function (e.g., blank:hello
) is abstracted into the register_blank_hello
function, and similarly for the blank:bye
function. These functions share common registration logic, ensuring that code isn’t duplicated across different areas of the plugin.blank-mumu
, thus adhering to the DRY principle.blank:hello
and blank:bye
, are registered to the Mumu interpreter, which is the core component of the Mumu ecosystem. The interpreter acts as the environment where Mumu code is parsed and executed.Cargo_lock
function, located in lib.rs
, is a special function that registers all necessary functions (in this case, both blank:hello
and blank:bye
) into the Mumu environment when the plugin is loaded.#[no_mangle]
, which ensures that the function's name is not changed during compilation and remains consistent across the plugin and the Mumu interpreter, facilitating proper dynamic linking.blank-mumu
plugin’s structure ensures that adding new functions is straightforward. To add a new function (e.g., blank:greet
), you would simply:
register
directory (e.g., greet.rs
).lib.rs
and register it in the Cargo_lock
function.blank-mumu
can be used as a template for building custom Mumu plugins in various domains. For example, a database plugin could follow the same structure: create separate files for registering functions like db:connect
, db:query
, etc., and then use the same mechanism to register those functions in the Mumu environment.server.rs
that registers functions such as server:start
, server:stop
, and so on.register::hello
, register::bye
), developers can quickly identify where to find specific functionality within the plugin.blank-mumu
is easy to replicate across other plugins, promoting reusable components and reducing redundant code.The blank-mumu
project serves as an essential boilerplate for Mumu plugin development. By emphasizing modularity, separation of concerns, and DRY principles, it ensures that new developers can quickly get started with creating Mumu plugins, while also providing a solid foundation for future feature additions. The clean structure allows for easy maintenance and scalability, making it a powerful template for the Mumu ecosystem.