Skip to content

Commit 2b708f6

Browse files
committed
Add a trivial example for rust-script.
1 parent a908d97 commit 2b708f6

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

examples

-1
This file was deleted.

examples/hello.rs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env rust-script
2+
//! This is free and unencumbered software released into the public domain.
3+
//!
4+
//! ```cargo
5+
//! [dependencies]
6+
//! protoflow = "0.2"
7+
//! ```
8+
9+
use protoflow::{blocks::*, BlockResult};
10+
11+
fn main() -> BlockResult {
12+
System::run(|s| {
13+
let greeting = s.const_string("Hello, world!");
14+
15+
let line_encoder = s.encode_lines();
16+
s.connect(&greeting.output, &line_encoder.input);
17+
18+
let stdout = s.write_stdout();
19+
s.connect(&line_encoder.output, &stdout.input);
20+
})
21+
}

0 commit comments

Comments
 (0)