File: only_print.rs

package info (click to toggle)
rust-nutmeg 0.1.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 352 kB
  • sloc: makefile: 2
file content (19 lines) | stat: -rw-r--r-- 482 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//! Example of the simplest case: just printing message, no actual
//! progress bar.

use std::io::Write;

struct Model {}

impl nutmeg::Model for Model {
    fn render(&mut self, _width: usize) -> String {
        unreachable!("Model::render should never be called, since the progress bar is disabled");
    }
}

fn main() {
    let mut view = nutmeg::View::new(Model {}, nutmeg::Options::default());
    for i in 1..=5 {
        writeln!(view, "write line {i}").unwrap();
    }
}