antoyo / relm

Idiomatic, GTK+-based, GUI library, inspired by Elm, written in Rust
MIT License
2.44k stars 78 forks source link

How relm works? #87

Closed amirouche closed 6 years ago

amirouche commented 6 years ago

TIA

antoyo commented 6 years ago

No, it doesn't use virtual-dom. The macro will actually modify the update() method to insert the calls to gtk set_property() whenever a model attribute is assigned (either with = or with an operator like +=). This means that the following code won't trigger a view update:

self.model.string.push_str("test");

while the following will:

self.model.string += "test";

This module is responsible to add these statements.

amirouche commented 6 years ago

Ok. But when the view is called, what happens? Isn't the current scene graph patched with the new view?

antoyo commented 6 years ago

There's a similar code generation for when the view is created so that it gets the initial state.