Skip to content

Commit d5adb31

Browse files
committed
Update the README
1 parent 28d949e commit d5adb31

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Reducer is available on [crates.io], simply add it as a dependency in your `Carg
1010

1111
```
1212
[dependencies]
13-
reducer = "1.0"
13+
reducer = "1.1"
1414
```
1515

1616
and import it in your `lib.rs`:
@@ -24,15 +24,18 @@ The full API documentation is available on [docs.rs]
2424

2525
## Examples
2626

27-
To see Reducer in action, check out the [examples] directory, which includes a number of
28-
implementations of a simple Todo List app using Reducer to drive various popular GUI frameworks.
27+
To see Reducer in action, check out the [examples] directory.
28+
There you'll find multiple implementations of a simple Todo List app using Reducer to drive popular
29+
GUI frameworks.
2930

30-
To run an example in particular, you can execute
31+
To run an example, execute
3132

3233
```
3334
> cargo run --release --example <NAME>
3435
```
3536

37+
where `<NAME>` can be one of [conrod] or [iui].
38+
3639
> **Note to macOS users:** due to an issue with `ui-sys` you might need to prepend
3740
> `CXXFLAGS+=-stdlib=libc++` to the command above, see
3841
> [brunocodutra/reducer#1](https://github.com/brunocodutra/reducer/issues/1).
@@ -66,5 +69,8 @@ Reducer is distributed under the terms of the MIT license, see [LICENSE] for det
6669
[pulls]: https://github.com/brunocodutra/reducer/pulls
6770
[examples]: https://github.com/brunocodutra/reducer/tree/master/examples
6871

72+
[conrod]: https://crates.io/crates/Conrod
73+
[iui]: https://crates.io/crates/iui
74+
6975
[LICENSE]: https://github.com/brunocodutra/reducer/blob/master/LICENSE
7076
[CONTRIBUTING]: https://github.com/brunocodutra/reducer/blob/master/CONTRIBUTING.md

examples/conrod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! A simple example demonstrating how to implement a Todo app using Reducer & Conrod.
1+
//! A simple example demonstrating how to implement a Todo List app using Reducer & Conrod.
22
33
#[macro_use]
44
extern crate conrod;

examples/libui.rs renamed to examples/iui.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! A simple example demonstrating how to implement a Todo app using Reducer & libui.
1+
//! A simple example demonstrating how to implement a Todo List app using Reducer & iui.
22
33
extern crate iui;
44
extern crate reducer;
@@ -83,7 +83,7 @@ impl State {
8383
}
8484
}
8585

86-
fn run_libui(dispatcher: impl Dispatcher<Action> + Clone + 'static, states: Receiver<Arc<State>>) {
86+
fn run_iui(dispatcher: impl Dispatcher<Action> + Clone + 'static, states: Receiver<Arc<State>>) {
8787
let ui = UI::init().unwrap();
8888

8989
// Layout.
@@ -128,8 +128,8 @@ fn run_libui(dispatcher: impl Dispatcher<Action> + Clone + 'static, states: Rece
128128
let mut event_loop = ui.event_loop();
129129

130130
event_loop.on_tick(&ui, {
131-
// keep track of todos displayed as libui doesn't yet provide a way of introspecting that.
132-
let mut checkboxes: Vec<Checkbox> = vec![];
131+
// keep track of todos displayed as iui doesn't yet provide a way of introspecting that.
132+
let mut checklist: Vec<Checkbox> = vec![];
133133
let mut body = body.clone();
134134
let mut filter = filter.clone();
135135
let dispatcher = dispatcher.clone();
@@ -140,20 +140,20 @@ fn run_libui(dispatcher: impl Dispatcher<Action> + Clone + 'static, states: Rece
140140
if let Some(state) = states.try_iter().last() {
141141
// Add new todos
142142
let todos = state.get_todos();
143-
for (i, (_, todo)) in todos.iter().enumerate().skip(checkboxes.len()) {
143+
for (i, (_, todo)) in todos.iter().enumerate().skip(checklist.len()) {
144144
let mut checkbox = Checkbox::new(&ui, todo);
145145
checkbox.on_toggled(&ui, {
146146
let mut dispatcher = dispatcher.clone();
147147
move |_| {
148148
dispatcher.dispatch(Action::ToggleTodo(i));
149149
}
150150
});
151-
checkboxes.push(checkbox.clone());
151+
checklist.push(checkbox.clone());
152152
body.append(&ui, checkbox, LayoutStrategy::Compact);
153153
}
154154

155-
// Synchronize checkboxes with the state.
156-
for (&(done, _), checkbox) in todos.iter().zip(checkboxes.iter_mut()) {
155+
// Synchronize checklist with the state.
156+
for (&(done, _), checkbox) in todos.iter().zip(checklist.iter_mut()) {
157157
checkbox.set_checked(&ui, done);
158158
match state.get_filter() {
159159
View::Done if !done => checkbox.hide(&ui),
@@ -176,7 +176,7 @@ fn run_libui(dispatcher: impl Dispatcher<Action> + Clone + 'static, states: Rece
176176
body.append(&ui, HorizontalSeparator::new(&ui), LayoutStrategy::Compact);
177177

178178
// The window allows all constituent components to be displayed.
179-
let mut window = Window::new(&ui, "Reducer <3 libui", 400, 300, WindowType::NoMenubar);
179+
let mut window = Window::new(&ui, "Reducer <3 iui", 400, 500, WindowType::NoMenubar);
180180
window.set_child(&ui, body);
181181
window.show(&ui);
182182

@@ -199,7 +199,7 @@ fn main() -> Result<(), Box<dyn Error>> {
199199
let dispatcher = store.spawn(&mut executor).unwrap();
200200

201201
// Spin up the rendering thread
202-
executor.run(futures::future::lazy(|_| run_libui(dispatcher, states)));
202+
executor.run(futures::future::lazy(|_| run_iui(dispatcher, states)));
203203

204204
Ok(())
205205
}
@@ -233,7 +233,7 @@ fn main() -> Result<(), Box<dyn Error>> {
233233
}
234234
});
235235

236-
run_libui(dispatcher, states);
236+
run_iui(dispatcher, states);
237237

238238
Ok(())
239239
}

0 commit comments

Comments
 (0)