-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//! Anything that implements Display can be wrapped in a DisplayModel. | ||
use std::fs::read_dir; | ||
use std::io; | ||
use std::thread::sleep; | ||
use std::time::Duration; | ||
|
||
use nutmeg::models::DisplayModel; | ||
|
||
fn main() -> io::Result<()> { | ||
let options = nutmeg::Options::default(); | ||
let model = DisplayModel::new(String::new()); | ||
let view = nutmeg::View::new(model, options); | ||
for p in read_dir(".")? { | ||
let dir_entry = p?; | ||
view.update(|DisplayModel(message)| *message = dir_entry.path().display().to_string()); | ||
sleep(Duration::from_millis(300)); | ||
} | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters