Skip to content

Commit 9ca5fa7

Browse files
author
Damion Werner
committed
fix readme code embed
1 parent 4a04533 commit 9ca5fa7

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,40 @@ Data only needs to be serialisable when explicitly send to other processes.
2525

2626
# Code Example
2727

28-
<<< @../../malstrom-core/examples/look_ma_im_streaming.rs
28+
```rust
29+
//! Stream processing can be easy!
30+
use malstrom::operators::*;
31+
use malstrom::runtime::MultiThreadRuntime;
32+
use malstrom::sinks::{StatelessSink, StdOutSink};
33+
use malstrom::snapshot::NoPersistence;
34+
use malstrom::sources::{SingleIteratorSource, StatelessSource};
35+
use malstrom::worker::StreamProvider;
36+
37+
fn main() {
38+
MultiThreadRuntime::builder()
39+
.persistence(NoPersistence)
40+
.parrallelism(1)
41+
.build(build_dataflow)
42+
.execute()
43+
.unwrap();
44+
}
45+
46+
fn build_dataflow(provider: &mut dyn StreamProvider) {
47+
provider
48+
.new_stream()
49+
.source(
50+
"words",
51+
StatelessSource::new(SingleIteratorSource::new([
52+
"Look",
53+
"ma'",
54+
"I'm",
55+
"streaming",
56+
])),
57+
)
58+
.map("upper", |x| x.to_uppercase())
59+
.sink("stdout", StatelessSink::new(StdOutSink));
60+
}
61+
```
2962

3063
This outputs
3164

0 commit comments

Comments
 (0)