mindustry logic execution, map- and schematic- parsing and rendering
add example to readme
bendn 2023-09-13
parent ff22dfe · commit 7ea2e7d
-rw-r--r--lemu/README.md10
-rw-r--r--lemu/src/lib.rs5
2 files changed, 14 insertions, 1 deletions
diff --git a/lemu/README.md b/lemu/README.md
index 47d4e4d..34044f9 100644
--- a/lemu/README.md
+++ b/lemu/README.md
@@ -1,3 +1,11 @@
# lemu
-mindustry Logic EMUlator. \ No newline at end of file
+mindustry Logic EMUlator.
+
+## Usage
+
+```rust
+use lemu::Executor;
+let mut lex = Executor::with_output(std::io::stdout()).program(r#"print "hello world""#).expect("program ok");
+lex.run();
+``` \ No newline at end of file
diff --git a/lemu/src/lib.rs b/lemu/src/lib.rs
index 3d1fc11..19edb48 100644
--- a/lemu/src/lib.rs
+++ b/lemu/src/lib.rs
@@ -46,6 +46,11 @@ impl<W: Write> Executor<'_, W> {
}
/// Builder for a [`Executor`].
+/// ```
+/// # use lemu::Executor;
+/// let mut lex = Executor::with_output(std::io::stdout()).program(r#"print "hello world""#).expect("program ok");
+/// lex.run();
+/// ```
pub struct ExecutorBuilder<W: Write> {
output: Option<W>,
displays: Vec<Image<Vec<u8>, 4>>,