Skip to main content

Module pattern

Module pattern 

Source
Expand description

Pattern Matching Helpers

Functions for pattern matching on Result (Ok/Err) and Option (Some/None) types.

Functions§

jit_pattern_check_constructor
Check if object matches Ok/Err constructor pattern mode: 0 = Ok (check “Ok” or “value” key), 1 = Err (check “Err” or “error” key) Returns TAG_BOOL_TRUE if matches, TAG_BOOL_FALSE otherwise
jit_pattern_extract_constructor
Extract value from Ok/Err constructor pattern mode: 0 = Ok (try “Ok” then “value”), 1 = Err (try “Err” then “error”) Returns the extracted value or TAG_NULL if not found