Skip to main content

turso_assert_all

Macro turso_assert_all 

Source
turso_assert_all!() { /* proc-macro */ }
Expand description

Asserts that all named conditions are true whenever this line is reached (logical AND).

§Behavior

  • Without antithesis feature: panics if any condition is false (like assert!).
  • With antithesis feature: reports the property to Antithesis via assert_always_or_unreachable!. On failure, prints the error to stderr and calls std::process::exit(0) instead of panicking.

§Parameters

  • {name: condition, ...} — named boolean conditions in curly braces.
  • "message" — human-readable description (required).
  • { "key": value, ... } (optional) — structured details for Antithesis.

§Usage

turso_assert_all!(
    {valid_size: page_size > 0, within_bounds: offset < page_size},
    "page header fields must all be valid"
);

// With structured details
turso_assert_all!(
    {has_header: header.is_some(), correct_magic: magic == EXPECTED_MAGIC},
    "database file must be well-formed",
    { "magic": magic }
);

§When to use

Use whenever a condition has a logical AND.