Skip to content

Commit cec615d

Browse files
authored
update return type (#168)
Return Result in doc example ## Does this introduce a breaking change? <!-- Mark one with an "x". --> ``` [ ] Yes [ ] No ``` ## Pull Request Type What kind of change does this Pull Request introduce? <!-- Please check the one that applies to this PR using "x". --> ``` [ ] Bugfix [ ] Feature [ ] Code style update (formatting, local variables) [ ] Refactoring (no functional changes, no api changes) [ ] Documentation content changes [ ] Other... Please describe: ``` ## How to Test * Get the code ``` git clone [repo-address] cd [repo-name] git checkout [branch-name] npm install ``` * Test the code <!-- Add steps to run the tests suite and/or manually test --> ``` ``` ## What to Check Verify that the following are valid * ... ## Other Information <!-- Add any other helpful information that may be needed here. -->
1 parent 42d5814 commit cec615d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

samples/wasm/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,18 @@ Output lands under `operators/<name>/bin/<arch>/<mode>/`. CI uses the `Makefile`
6565
use wasm_graph_sdk::logger::{self, Level};
6666

6767
#[map_operator]
68-
fn transform_data(timestamp: HybridLogicalClock, input: DataModel) -> DataModel {
68+
fn transform_data(timestamp: HybridLogicalClock, input: DataModel) -> Result<DataModel, Error> {
6969
logger::log(Level::Info, "my-operator", "Processing data");
70-
input
70+
Ok(input)
7171
}
7272
```
7373
- Filter operator pattern:
7474
```rust
7575
use wasm_graph_sdk::macros::filter_operator;
7676

7777
#[filter_operator]
78-
fn temperature_filter(_ts: HybridLogicalClock, input: DataModel) -> bool {
79-
matches!(input, DataModel::Temperature(temp) if temp.value > 0.0)
78+
fn temperature_filter(_ts: HybridLogicalClock, input: DataModel) -> Result<DataModel, bool> {
79+
Ok(matches!(input, DataModel::Temperature(temp) if temp.value > 0.0))
8080
}
8181
```
8282
- More operators live in `operators/` (temperature, humidity, format, snapshot, collection, enrichment, window, viconverter) for fuller examples and configuration patterns.

0 commit comments

Comments
 (0)