/ruex

Design pattern framework for Rust on top of PureMVC

Primary LanguageRustMozilla Public License 2.0MPL-2.0

Ruex

API Docs Crates.io Code coverage Tests MPL-2.0 licensed Gitter chat loc

Design pattern framework on top of PureMVC.

The PureMVC framework has a very narrow goal. That is to help you separate your application’s coding interests into three discrete tiers: Model, View and Controller.

This separation of interests, and the tightness and direction of the couplings used to make them work together is of paramount importance in the building of scalable and maintainable applications.

In this implementation of the classic MVC Design meta-pattern, these three tiers of the application are governed by three Singletons (a class where only one instance may be created) called simply Model, View and Controller. Together, they are referred to as the ‘Core actors’.

A fourth Singleton, the Facade simplifies development by providing a single interface for communication with the Core actors.

Model & Proxies

The Model simply caches named references to Proxies. Proxy code manipulates the data model, communicating with remote services if need be to persist or retrieve it.

This results in portable Model tier code.

View & Mediators

The View primarily caches named references to Mediators. Mediator code stewards View Components, adding event listeners, sending and receiving notifications to and from the rest of the system on their behalf and directly manipulating their state.

This separates the View definition from the logic that controls it.

Controller & Commands

The Controller maintains named mappings to Command classes, which are stateless, and only created when needed.

Commands may retrieve and interact with Proxies, send Notifications, execute other Commands, and are often used to orchestrate complex or system-wide activities such as application startup and shutdown. They are the home of your application’s Business Logic.

Facade & Core

The Facade, another Singleton, initializes the Core actors (Model, View and Controller), and provides a single place to access all of their public methods.

By extending the Facade, your application gets all the benefits of Core actors without having to import and work with them directly. You will implement a concrete Facade for your application only once and it is simply done.

Proxies, Mediators and Commands may then use your application’s concrete Facade in order to access and communicate with each other.

Observers & Notifications

PureMVC applications may run in environments without access to Event and EventDispatcher classes, so the framework implements an Observer notification scheme for communication between the Core MVC actors and other parts of the system in a loosely-coupled way.

You need not be concerned about the details of the PureMVC Observer/Notification implementation; it is internal to the framework. You will use a simple method to send Notifications from Proxies, Mediators, Commands and the Facade itself that doesn’t even require you to create a Notification instance.

Quick Start

Install Ruex:

cargo add ruex

Learn More

Community

Contributing

We believe the wider community can create better code. The first tool for improving the community is to tell the developers about the project by giving it a star. More stars - more members.

Star a repo

Angular Rust is a community effort and we welcome all kinds of contributions, big or small, from developers of all backgrounds. We want the Angular Rust community to be a fun and friendly place, so please review our Code of Conduct to learn what behavior will not be tolerated.

New to Angular Rust?

Start learning about the framework by helping us improve our documentation. Pull requests which improve test coverage are also very welcome.

Looking for inspiration?

Check out the community curated list of awesome things related to Angular Rust / WebAssembly at awesome-angular-rust.

Confused about something?

Feel free to drop into our Gitter chatroom or open a new "Question" issue to get help from contributors. Often questions lead to improvements to the ergonomics of the framework, better documentation, and even new features!

Ready to dive into the code?

After reviewing the Contributing Code Guidelines, check out the "Good First Issues" (they are eager for attention!). Once you find one that interests you, feel free to assign yourself to an issue and don't hesitate to reach out for guidance, the issues vary in complexity.

Let's help each other!

Come help us on the issues that matter that the most and receive a small cash reward for your troubles. We use Issuehunt to fund issues from our Open Collective funds. If you really care about an issue, you can choose to add funds yourself!

Found a bug?

Please report all bugs! We are happy to help support developers fix the bugs they find if they are interested and have the time.