OxL Reference

fn decodeLike

Decodes b as the result type of like (used to decode the value of a durable step when a pipeline resumes on another node). Panics when the bytes do not decode.

Example:

oxl✓ checked in CI
use std.saga
use std.ser { encode }

fn zero() -> i64 => 0

fn main() io {
  let b = encode(&(41 as i64))!
  print("{saga.decodeLike(&b, zero) + 1}")
}
Output
42
pub(api) fn decodeLike<V: Serializable, effect F>(b: &bytes, like: fn() -> V F) -> V

Since. 1.0.0-beta

Parameters

NameType
b&bytes
likefn() -> V F

Returns

V

Effects

none declared (pure unless the body says otherwise)

Defined in: std/saga/saga.oxl:1191

See also