Zero-Cost Cross-Platform Native Widget based Component System in Rust
Using proc-macros, gxi compiles the component tree to optimized
n-binary tree without any virtual dom
or diffing algorithm. Making the component system zero-cost
. Therefore,
the components are highly optimized
, ready to meet the needs of every project while maintaining the standard
features of frameworks like React
. Built-in async support
provides zero-cost
abstractions to rust futures.
Since the framework is a compiler, therefore, it allows mixing of platform-dependent and independent components, i.e the
framework provides components like div
, h1
(platform dependent) and React Native like
platform-independent components like Text
and View
. Therefore, making the code portable without losing deep control
of the native system.
wasm32-unknown-unknown
Example For Desktop GTK App
```rust use crate::*;
enum Msg { INC, DEC, }
gxi! { pub Counter { count : u32 = 0 } render { View [ View ( setorientation = gtk::Orientation::Vertical) [ Button ( setlabel = "Inc", connectclicked = || Msg::INC ), Button ( setlabel = "Dec", connectclicked = || Msg::DEC ) ], Text ( setlabel = &state.count.tostring() ) ] } update { let mut state = getstate_mut!(state); match msg { Msg::INC => state.count += 1, _ => { if state.count > 0 { state.count -= 1; } else { return Ok(ShouldRender::No); } } } Ok(ShouldRender::Yes) } }
//extend the abilities
impl Counter {
pub fn count(&mut self, count: Option
Async
Example Using Web App
```rust use crate::*; use serde_json::Value;
enum Msg { Fetch(bool), }
gxi! {
pub async CatFact {
catfact : Option
Full src here
Code of conduct can be found at CODEOFCONDUCT.md
Make sure to read Contribution Guidelines before contributing.
Copyright (C) 2020 Aniket Prajapati
Licensed under the MIT LICENSE