Crate mogwai

Source
Expand description

§Mogwai

Mogwai is library for user interface development using sinks and streams.

Its goals are simple:

  • provide a declarative way to create and manage interface nodes, without a bias towards a specific UI domain (ie web, games, desktop applications, mobile)
  • encapsulate component state and compose components easily
  • explicate mutations and updates
  • feel snappy
  • allow the library user to access the underlying raw views when necessary, ie - you have an “escape hatch”

§UI Domains

Mogwai has domain-specific libraries for certain user interface domains that re-export this core library and specialize it for the domain.

§Javascript/Browser DOM

mogwai-dom is a library for building browser applications using the Javascript API. It is a mogwai wrapper around web_sys.

§Terminal UI

TODO: implement mogwai-tui

§Write your own

Would you like to be able to build mogwai apps in a domain that doesn’t exist yet? You can build it! For the most part the bulk of the work is writing an implementation of TryFrom<ViewBuilder> (or a similar conversion) for your domain-specific view type. See the mogwai-dom source code for an example of prior art.

TODO: change the link for mogwai-dom to main after merging

§Acronyms

If you’re wondering what the acronym “mogwai” stands for, here is a table of options that work well, depending on the domain. It’s fun to mix and match.

MOGWAI
minimalobviousgraphicalwebapplicationinterface
modularoperablegraphablewidget
mostlyguiwork

Modules§

channel
Async mpmc and broadcast channels, plus extensions.
either
Sum type for either a “left” or “right” value.
future
Re-exports of the futures_lite crate, along with extensions and helper types.
model
Values with streams of updates.
patch
Updates to lists and hashmaps encoded as enums.
prelude
Re-exports for convenience
relay
Bundling view updates and events.
sink
Types and extention traits for Sinks.
stream
Types and extention traits for Streams.
time
Wait or sleep or delay future.
view
Domain agnostic view doclaration.

Macros§

builder
Uses an html description to construct a ViewBuilder.
html
Uses an html description to construct a ViewBuilder.
rsx
Uses a function-style description to construct a ViewBuilder.