Mercurial > lbo > hg > myi3stat
changeset 17:3dc0189c4314
Minor README improvements
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Sun, 14 Feb 2016 15:20:11 +0100 |
parents | d40c9e075232 |
children | b50a0aeb059a |
files | README.md |
diffstat | 1 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/README.md Sun Feb 14 15:19:55 2016 +0100 +++ b/README.md Sun Feb 14 15:20:11 2016 +0100 @@ -57,11 +57,13 @@ At the end of your `render()` implementation, you return a `RenderResult`: - RenderResult::new(contents, Color::Red) + // use framework::*; + fn RenderResult::new(text: String, color: Color) -> RenderResult This is the actual output that will appear. -Finally, export a factory function that creates an instance of your metric: +Finally, export a factory function that creates an instance of your metric +(this way, you can keep the rest of your module private): pub fn make_your_metric() -> Box<Metric> { Box::new(MyCustomMetric) } @@ -71,7 +73,8 @@ `register_metrics()` function near the end of the file: use metric::your_metric; - registry.register_metric("your_metric", + registry.register_metric( + "your_metric", // metric name; used as command line flag "A metric that shows how frobnicated your foos are", // Short description "format string", // config parameter description your_metric::make_your_metric()); // An instance of your metric, of type Box<Metric>