fn pipeScope
Runs the front of a pipeline. A pipeline with a durable step gets a journal entry first.
Example:
@error data Rejected { why: str }
fn moderate(n: i32) -> i32 | Rejected {
if n % 2 == 1 { fail Rejected{ why: "odd" } }
n
}
pipeline photo(n: i32) -> i32 {
respond it
-> moderate
-> moderate
}
fn main() io, net, time, db {
match photo(4) {
i32 v => print("answer {v}")
NetError e => print("net error")
}
sleep(100ms)
}Вывод
answer 4
pub(api) fn pipeScope<T, effect F>(name: str, args: bytes, durable: bool, body: fn() -> T F) -> T | NetError net, db, time, FС версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
name | str |
args | bytes |
durable | bool |
body | fn() -> T F |
Возвращает
T
Ошибки
Эффекты
не объявлены (чистая, пока тело не говорит иное)
Определено в: std/saga/saga.oxl:1475