MCPcopy Index your code
hub / github.com/algoscienceacademy/RustUI

github.com/algoscienceacademy/RustUI @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
269 symbols 415 edges 38 files 1 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

RustUI - Cross-Platform UI Framework

A modern, cross-platform UI framework written in Rust that supports desktop, web, iOS, and Android platforms.

Quick Start

Installation

# Install the rust-native development tools
cargo install rust-native

# Add rust-native to your project
cargo add rust-native

Configuration

Create a rust-native.toml in your project root:

name = "my-app"
target_platforms = ["Desktop"]
build_command = "cargo run"  # Optional: custom build command

Development Server

Start the development server:

# From your project directory
rust-native dev

# Or specify a custom path
rust-native dev --path ./src

Server Controls

  • q - Quit the server
  • 1 - Switch to Desktop mode (currently active)
  • r - Manual rebuild (coming soon)
  • s - Restart server (coming soon)

Status Indicators

The server displays build status with color coding: - 🟢 Green: Ready/Success - 🟡 Yellow: Building - 🔴 Red: Error (with details)

Project Structure

your-project/
├── src/
│   └── main.rs           # Your application code
├── rust-native.toml      # Development configuration
└── Cargo.toml           # Project dependencies

Features

  • 🎯 Cross-platform support (Desktop, Web, iOS, Android)
  • 🎨 Flexible styling system
  • 📱 Responsive layouts
  • 🔄 State management
  • 🎭 Animations
  • 📍 Gesture recognition
  • 🧭 Navigation system

Getting Started

Prerequisites

# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Install additional dependencies for different platforms
# For iOS
xcode-select --install
rustup target add aarch64-apple-ios x86_64-apple-ios

# For Android
rustup target add aarch64-linux-android armv7-linux-androideabi
cargo install cargo-ndk

# For Web (WebAssembly)
rustup target add wasm32-unknown-unknown
cargo install wasm-pack

Building and Running

Desktop

# Run desktop example
cargo run --example basic_app

# Build for release
cargo build --release

iOS

# Build for iOS simulator
cargo build --target x86_64-apple-ios
# Build for iOS device
cargo build --target aarch64-apple-ios

# Open Xcode project
open ios/RustUI.xcodeproj

Android

# Build Android libraries
cargo ndk -t armeabi-v7a -t arm64-v8a build --release

# Open Android project in Android Studio
cd android && ./gradlew assembleDebug

Web

# Build WebAssembly package
wasm-pack build --target web

# Serve example
cd www && npm install && npm start

Examples

Basic App

use rust_native::*;

fn main() {
    let rust_native = RustUI::new();
    rust_native.run(|| {
        View::new()
            .child(Text::new("Hello, RustUI!"))
            .child(Button::new("Click Me"))
            .into()
    });
}

Styled Components

View::new()
    .child(
        Text::new("Welcome")
            .style(Style::new()
                .set("font-size", 24.0)
                .set("color", Color::new(0.1, 0.1, 0.1, 1.0)))
    )

Responsive Layout

View::new()
    .with_responsive_layout(&responsive, vec![
        (Breakpoint::Small, Stack::new(Direction::Vertical)),
        (Breakpoint::Large, Stack::new(Direction::Horizontal)),
    ])

Project Structure

RustUI/
├── src/
│   ├── components/     # UI components
│   ├── platform/      # Platform-specific implementations
│   ├── animation/     # Animation system
│   ├── gesture/       # Gesture recognition
│   ├── layout/        # Layout system
│   ├── navigation/    # Navigation system
│   ├── renderer/      # Rendering backend
│   └── style/         # Styling system
├── examples/          # Example applications
├── ios/              # iOS project files
├── android/          # Android project files
└── www/              # Web (WebAssembly) files

Development Configuration Guide

rust-native.toml Configuration

The rust-native.toml file is used to configure your RustUI development environment. Place this file in your project's root directory.

Basic Configuration

# Basic configuration
name = "my-app"
target_platforms = ["Desktop"]
build_command = "cargo run"

Advanced Configuration

# Advanced configuration
name = "my-complex-app"
target_platforms = ["Desktop", "Web", "iOS", "Android"]
build_command = "cargo run --example custom_app"
watch_paths = ["src/", "examples/"]
exclude_paths = ["target/", "node_modules/"]

[desktop]
window_size = { width = 800, height = 600 }
enable_hot_reload = true

[ios]
simulator = true
device_family = "iphone"

[android]
emulator = "Pixel_4_API_30"
target_sdk = 30

[web]
port = 8080
serve_dir = "public"

Configuration Options

Option Type Default Description
name String Project directory name Your application name
target_platforms Array ["Desktop"] Platforms to build for
build_command String "cargo run" Custom build command
watch_paths Array ["."] Directories to watch for changes
exclude_paths Array ["target"] Directories to ignore

Platform-Specific Options

Desktop Configuration
[desktop]
window_size = { width = 800, height = 600 }
enable_hot_reload = true
custom_args = ["--release", "--features=desktop"]
iOS Configuration
[ios]
simulator = true
device_family = "iphone"
deployment_target = "14.0"
Android Configuration
[android]
emulator = "Pixel_4_API_30"
target_sdk = 30
min_sdk = 21
Web Configuration
[web]
port = 8080
serve_dir = "public"
wasm_features = ["web-sys"]

Example Configurations

  1. Minimal Development Setup
name = "my-app"
target_platforms = ["Desktop"]
  1. Desktop Application with Hot Reload
name = "my-desktop-app"
target_platforms = ["Desktop"]
build_command = "cargo run --example main"

[desktop]
enable_hot_reload = true
window_size = { width = 1024, height = 768 }
  1. Cross-Platform Mobile Development
name = "my-mobile-app"
target_platforms = ["iOS", "Android"]
watch_paths = ["src/", "mobile/"]

[ios]
simulator = true
device_family = "universal"

[android]
emulator = "Pixel_4_API_30"
target_sdk = 30

Usage Tips

  1. Hot Reload Configuration
  2. Enable hot reload for faster development
  3. Specify watch paths for selective reloading toml watch_paths = ["src/components/", "src/styles/"] exclude_paths = ["src/tests/", "target/"]

  4. Custom Build Commands

  5. Use environment variables
  6. Chain multiple commands toml build_command = "RUST_LOG=debug cargo run --example dev"

  7. Platform-Specific Development

  8. Configure each platform separately
  9. Enable only needed platforms toml target_platforms = ["Desktop", "Web"] [desktop] enable_hot_reload = true [web] port = 3000

For more information, visit our Configuration Documentation.

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Support

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Rust community
  • Cross-platform UI frameworks that inspired this project

Extension points exported contracts — how you extend this code

Application (Interface)
(no doc) [7 implementers]
src/lib.rs
Component (Interface)
(no doc) [5 implementers]
src/components/mod.rs
Renderer (Interface)
(no doc) [2 implementers]
src/renderer/mod.rs
Platform (Interface)
(no doc) [2 implementers]
src/platform/mod.rs
Transition (Interface)
(no doc) [1 implementers]
src/navigation/mod.rs

Core symbols most depended-on inside this repo

child
called by 21
src/components/view.rs
update_progress
called by 14
src/dev_server.rs
style_mut
called by 14
src/components/view.rs
push
called by 13
src/navigation/mod.rs
set_platform
called by 8
src/dev_server.rs
run
called by 7
src/lib.rs
modify
called by 6
src/style.rs
with_layout
called by 6
src/components/view.rs

Shape

Method 182
Class 55
Function 14
Enum 13
Interface 5

Languages

Rust100%

Modules by API surface

src/dev_server.rs34 symbols
src/style.rs16 symbols
src/navigation/mod.rs14 symbols
src/window.rs13 symbols
src/renderer/default.rs13 symbols
src/lib.rs11 symbols
src/components/view.rs11 symbols
src/components/button.rs11 symbols
src/components/text.rs9 symbols
src/components/stack.rs9 symbols
src/animation/mod.rs9 symbols
examples/todo_app.rs9 symbols

For agents

$ claude mcp add RustUI \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact