MCPcopy Index your code
hub / github.com/ZhukMax/efx

github.com/ZhukMax/efx @efx-core-v1.1.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release efx-core-v1.1.1 ↗ · + Follow
343 symbols 607 edges 64 files 18 documented · 5%

Browse by type

Functions 248 Types & classes 95
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

EFX — Rust templating for egui/eframe

EFx

Crates.io Crates.io Version Crates.io Version MSRV Docs.rs License Crates.io Total Downloads

EFx — Rust 🦀 XML Template Engine for egui-based frameworks: eframe, bevy_egui, egui-winit, egui-miniquad. efx! is a proc-macro for writing tiny XML-like UI snippets in eframe/egui. It converts short tags into egui calls.

Simplicity and Convenience — XML, 🚀 Speed and 🔐 Security — Rust

Easy as HTML, Fast as C

You can embed arbitrary Rust expressions inside braces ({...}).


Install & import

Requires egui (the project currently uses egui 0.32). Add to Cargo.toml:

[dependencies]
efx = "0.6"
egui = "0.32" # or egui-based framework

Inside this repo just import the macro:

use efx::efx; // the macro

Documentation

You can see on web page https://docs.rs/efx/latest/efx/ or in files:


Expression interpolation {...}

Inside tag content you can insert any Rust expression that implements Display:

let a = 2;
let b = 3;
efx!(ui, r#"<Label>Sum: {a + b}</Label>"#);

Escaping braces

To print { or }, use double braces (same as format!):

efx!(ui, r#"<Label>Literals: {{ and }}</Label>"#);

Errors & diagnostics

At compile time the macro parses your snippet; at runtime it shows readable diagnostics via ui.Label(...) when input is invalid:

  • Unknown tag Output: Unknown tag: <TagName>

  • Mismatched open/close tags Output: Mismatched tags: <open> and </close>

  • Interpolation count mismatch Happens if the parser found e.g. two {expr} parts but after processing the text there’s a different number of {} placeholders. Make the counts match.


Current limitations

  • Case-sensitive tag names.
  • Interpolated expressions must implement Display.

Roadmap & RFCs

TL;DR. EFx is a minimalist XML DSL on top of egui that compiles to plain ui.* calls. The next three releases focus on expressiveness and first-class examples across popular egui runtimes:

  • 0.7 — Themes & layouts: lightweight style sheets, extended containers (Tabs/Table behind extras), perf & polish.

This plan is incremental and non-breaking; new features are opt-in. Priorities may change based on community feedback.

👉 Full RFC: EFX-0001 — Roadmap 0.5–0.7

👉 RFC index: RFC/README.md


Supported egui runtimes

EFx renders into any runtime that provides &mut egui::Ui. We officially build examples for the following targets:

Tier-1

  • eframe (native + wasm)
  • bevy_egui (native)
  • raw winit+wgpu (via egui-winit + egui-wgpu). Wgpu - a cross-platform, safe, pure-rust graphics API. It runs natively on Vulkan, Metal, D3D12, and OpenGL; and on top of WebGL2 and WebGPU on wasm. Follows WebGPU specification. With async/await API.

Tier-2 (compatible today; examples later / community support)

  • egui-miniquad (for macroquad/miniquad overlays) - Relatively minimalistic API well suited for small to medium graphics projects. Supports multiple backends, including browser target.
  • egui_sdl2_* backends
  • egui_glow / tao (lower-level backends)

Quickstart (pick one)

A) eframe

# Cargo.toml
[dependencies]
efx    = "0.6"
eframe = "0.32"
use eframe::egui;
use efx::efx;

egui::CentralPanel::default().show(ctx, |ui| {
    efx!(ui, r#"<Column><Label>Hello, EFx</Label><Separator/></Column>"#);
});

B) Bevy + bevy_egui

# Cargo.toml
[dependencies]
efx       = "0.6"
bevy      = "0.16"
bevy_egui = "0.36"  # re-exports `egui`
use bevy_egui::{EguiPlugin, EguiContexts};
use efx::efx;

bevy_egui::egui::Window::new("EFx").show(egui_ctx.ctx_mut(), |ui| {
    efx!(ui, r#"<Row><Label>It works</Label></Row>"#);
});

Tip: import egui via use bevy_egui::egui as egui; to avoid version mismatches.

C) Raw winit + wgpu

# Cargo.toml
[dependencies]
efx        = "0.6"
egui       = "0.32"
egui-winit = "0.32"
egui-wgpu  = "0.32"
winit      = "0.30"
wgpu       = "26.0"

Use the example in examples/winit_wgpu_min.rs as a starting point.


Contributing

PRs Welcome

Thanks for considering a contribution! Please follow this lightweight workflow:

1) Pick or propose an issue

  • Claim an issue: comment “I’d like to take this” (optionally add a brief plan/ETA). The maintainer will assign it to you.
  • Propose a new issue: open a ticket with a minimal reproducible example (for bugs) or a short rationale (for features). Start with the roadmap RFC: EFX-0001.

Tip: issues labeled good first issue are designed for first-time contributors.

2) Fork & branch

  • Fork the repository and create a feature branch from main:

bash git checkout main git pull git checkout -b feat/short-topic * Keep your branch focused on one issue.

3) Implement with tests & docs

  • Make the change and add tests/docs where it makes sense.
  • Local checks (examples build-only; no GUI run is required):

bash cargo fmt --all cargo clippy --all-targets -- -D warnings cargo build --workspace --locked cargo build -p efx --example eframe_demo --locked rustup target add wasm32-unknown-unknown cargo build -p efx --example eframe_demo --target wasm32-unknown-unknown --locked

4) Open a Pull Request

  • Target the next release branch (e.g., v0.6, v0.7). If the issue has a milestone, use the branch named after that milestone.
  • Link the issue (e.g., “Closes #123”) and fill the checklist below.

PR checklist

  • [ ] References the related issue / RFC section when behavior changes.
  • [ ] CI is green (workspace build, examples, wasm32 build-only).
  • [ ] Tests/docs updated where applicable.
  • [ ] No unrelated changes.

5) Reviews & merge

  • Address review comments; small, focused PRs get merged faster.
  • If you go silent for 7 days, the issue may be unassigned to keep momentum (you can re-claim it anytime).

Questions? Reach out at mail@zhukmax.com.


Changelog

See in file Changelog.md

Licence

The MIT License. Please see License File for more information.

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Method 177
Class 87
Function 71
Enum 5
Interface 3

Languages

Rust100%

Modules by API surface

efx-core/src/doc_prelude.rs23 symbols
efx-core/src/ast/parser.rs13 symbols
efx/tests/macro_ok.rs11 symbols
efx/src/tags/data_table.rs10 symbols
efx-core/tests/attr_tests.rs10 symbols
efx/tests/ui/unknown_tag.rs9 symbols
efx/tests/ui/separator_with_children.rs9 symbols
efx/src/utils/attr.rs9 symbols
efx/examples/winit_wgpu_min.rs9 symbols
efx/src/tags/tabs.rs8 symbols
efx/src/tags/table.rs8 symbols
efx/src/tags/panel.rs8 symbols

For agents

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

⬇ download graph artifact

Ask about this repo answers extend the page