SwiftUI Inspired UI Library written in rust

Related tags

GUI mule
Overview

Mule (Definitely a Work in Progress)

The night I started this project I was on the couch drinking a Moscow Mule. Couldn't think of a better name, so for now its called mule. TLDR; Naming is hard.

Truthfully, not sure if it is worth the work because HTML, CSS and Javascript do this a lot better than rust. This is more of a fun thought experiment to see if there would be any benefits to doing this in rust. So far the only benefit I see is a developer doesnt need to know HTML or CSS to create a static blog site in rust.

Example

Use any rust web framework like actix, rocket, warp or tide and return a text/html string in order. Below is the example of what it looks like to create a simple html page using Mule and Warp as the web framework.

use warp::Filter;

pub mod component;

use core::components::view::View;
use core::components::text::{Text, TextType, TextColor};
use core::components::vstack::VStack;

#[tokio::main]
async fn main() {
    let route =
        warp::any().map(move || warp::reply::html(View::new(
            VStack::new(vec![
                Box::new(Text::new("My Doggie Site").with_text_type(TextType::Heading1)),
                Box::new(Text::new("My Dog is the best dog in the world").with_color(TextColor::Purple))
            ])
        )
        .with_title("My Website Title")
        .render()));

    warp::serve(route).run(([127, 0, 0, 1], 3030)).await;
}

This creates the following HTML and CSS:

>
<html>
    <head>
        <title>My Website Titletitle>
    head>
    <body><div class="mule-vlsqsy"><h1 class="mule-yetcse">My Doggie Siteh1>
<p class="mule-uqsgpz">My Dog is the best dog in the worldp>
div>body>
    <style>
        html {
            margin: 0;
            height: 100vh;
            width: 100vw;
        }

        body {
            height: 100%;
            margin: 0;
        }

        .mule-vlsqsy { height: 100%; } .mule-yetcse {margin:0;font-size: 3rem;font-weight: 800;font-family: Lato, sans-serif;color: black;text-align: left;text-decoration: none;text-decoration: none;}
        .mule-uqsgpz {margin:0;font-size: 1rem;font-weight: 400;font-family: Lato, sans-serif;color: purple;text-align: left;text-decoration: none;text-decoration: none;}
    style>
html>
You might also like...
A floating, tag-based window manager written in Rust
A floating, tag-based window manager written in Rust

worm worm is a floating, tag-based window manager for X11. It is written in the Rust programming language, using the X11RB library. Install cargo buil

D3D9 Window overlay written in Rust

win-overlay (-rs) DirectX overlay written in Rust for various projects, wanted to easily create overlays across projects so decided to write my own im

Highly customizable finder with high performance. Written in Rust and uses GTK
Highly customizable finder with high performance. Written in Rust and uses GTK

Findex Highly customizable finder with high performance. Written in Rust and uses GTK Installation Automatic Binary Clone from https://aur.archlinux.o

GUI based tool to sort and categorize images written in Rust
GUI based tool to sort and categorize images written in Rust

ImageSieve GUI based tool to sort out images based on similarity, categorize them according to their creation date and archive them in a target folder

A simple note taking application written in Rust and GTK4
A simple note taking application written in Rust and GTK4

Rnote A simple note taking application written in Rust and GTK4. Rnote aims to be a simple but functional note taking application for freehand drawing

Cross-platform GUI toolkit written in Rust
Cross-platform GUI toolkit written in Rust

Tuix is a cross-platform GUI toolkit written in Rust. The driving principle behind tuix is to be a self-contained, small-as-possible, but still fast,

Winsafe-examples - Examples of native Windows applications written in Rust with WinSafe.
Winsafe-examples - Examples of native Windows applications written in Rust with WinSafe.

WinSafe examples This repo contains several examples of native Win32 applications written in Rust with WinSafe. All examples follow the same program s

A GUI for NordVPN on Linux that maintains feature parity with the official clients, written with Rust and GTK.

Viking for NordVPN This project aims to provide a fully usable and feature-complete graphical interface for NordVPN on Linux. While it attempts to clo

Neovim GUI written in Rust, using relm4 and gtk4-rs
Neovim GUI written in Rust, using relm4 and gtk4-rs

Reovim Neovim GUI written in Rust, using relm4 and gtk4-rs. Thanks Neovide Configuration To setup font add next line to init.vim set guifont=Cascadia\

Owner
UI Architect @ Arctic Wolf Networks
null
A cross-platform GUI library for Rust, inspired by Elm

Iced A cross-platform GUI library for Rust focused on simplicity and type-safety. Inspired by Elm. Features Simple, easy-to-use, batteries-included AP

Héctor Ramón 17.5k Jan 2, 2023
A react-inspired UI library for building multimedia desktop apps with rust and vulkan.

narui A react-inspired UI library for building multimedia desktop apps with rust and vulkan. declarative UI with Ergonomics similar to React with hook

apertus° - open source cinema 42 Jan 1, 2023
A cross-platform GUI library for Rust, inspired by Elm

Iced A cross-platform GUI library for Rust focused on simplicity and type-safety. Inspired by Elm. Features Simple, easy-to-use, batteries-included AP

null 17.5k Dec 28, 2022
An idiomatic GUI library inspired by Elm and based on gtk4-rs

An idiomatic GUI library inspired by Elm and based on gtk4-rs. Relm4 is a new version of relm that's built from scratch and is compatible with GTK4 an

Aaron Erhardt 722 Dec 31, 2022
Hooks for Yew, inspired by streamich/react-use and alibaba/hooks.

Yew Hooks Hooks for Yew, inspired by streamich/react-use and alibaba/hooks. Hooks State use_toggle - tracks state of counterparts. use_bool_toggle - t

Jet Li 116 Jan 4, 2023
An easy-to-use, 2D GUI library written entirely in Rust.

Conrod An easy-to-use, 2D GUI library written entirely in Rust. Guide What is Conrod? A Brief Summary Screenshots and Videos Feature Overview Availabl

PistonDevelopers 3.3k Jan 1, 2023
An Anime Game Launcher variant written on Rust, GTK4 and libadwaita, using Anime Game Core library

An Anime Game Launcher GTK The launcher variant written on Rust, GTK4 and libadwaita, using Anime Game Core library You could also try the main branch

An Anime Team 77 Jan 9, 2023
Honkers Launcher variant written on Rust, GTK4 and libadwaita, using Anime Game Core library

You could also try the main branch Development Folder Description ui Blueprint UI files ui/.dist UI files compiled by the blueprint src Rust source co

An Anime Team 9 Nov 2, 2022
A fast, zbus-based, permissively licensed AT-SPI library written in pure Rust!

AT-SPI for Rust Higher level, asynchronous Rust bindings to AT-SPI2, using zbus. Part of the Odilia screen reader project. Design Fully documented, wi

Odilia 12 Dec 31, 2022
A chess engine written from scratch in Rust ♞

Walleye Walleye is a chess engine written completely in rust. Walleye is a UCI-compatible engine written using the classical alpha-beta style AI. It s

Mitchel Paulin 95 Dec 24, 2022