viewbuilder 0.6.1

Cross-platform UI framework
docs.rs failed to build viewbuilder-0.6.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: viewbuilder-0.10.0-alpha.5

A cross-platform user interface framework for Rust.

Viewbuilder is a moduler GUI library that can be used as an entire framework, or with individual parts.

use viewbuilder::{object, Object, Runtime};

#[derive(Default)]
pub struct Counter {
    value: i32,
}

#[object]
impl Counter {
    #[signal]
    fn value_changed(&mut self, value: i32);

    #[slot]
    pub fn set(&mut self, value: i32) {
        self.value = value;
        self.value_changed(value);
    }
}

#[tokio::main]
async fn main() {
    let rt = Runtime::default();
    let _guard = rt.enter();

    let a = Counter::default().spawn();
    let b = Counter::default().spawn();

    a.value_changed().bind(&b, Counter::set);
    a.set(2);

    rt.run().await;

    assert_eq!(a.borrow().value, 2);
    assert_eq!(b.borrow().value, 2);
}

Getting started

Instatllation is simple with:

cargo add viewbuilder --features full