ruststream-zeromq 0.7.1

ZeroMQ transport implementation of the RustStream broker contract, for bridging to non-Rust peers.
Documentation
//! Compile-fail snapshots for the mounts this crate rejects at compile time.
//!
//! Each `tests/ui/*.rs` case is a mount a service could write and must not ship, and pins the
//! compile error against a `.stderr` snapshot, so a change that lets the mount compile, or that
//! drops the fix from its message, fails the build.
//!
//! The snapshots are rustc-version-sensitive, and CI builds a floor..stable matrix, so they are
//! pinned to a single toolchain: the stable `cargo test` step sets `RUN_UI_TESTS=1`, and every
//! other run - beta, the floor, a local `cargo test` without the flag - skips. To refresh the
//! snapshots after an intentional message change, run on stable and read the diff:
//!
//! ```text
//! TRYBUILD=overwrite RUN_UI_TESTS=1 cargo test -p ruststream-zeromq --all-features --test ui
//! ```

/// Whether this run skips the snapshots, and whether skipping them is allowed.
///
/// `RUN_UI_TESTS=1` opts in. `REQUIRE_UI_TESTS=1` says a skip is not acceptable in this run: CI
/// and `just test` set it wherever they set the opt-in, so dropping or misspelling the opt-in
/// fails the run instead of leaving a green one that checked nothing.
///
/// # Panics
///
/// Panics when a run that requires the snapshots is not set up to run them.
fn skip_snapshots() -> bool {
    let opted_in = std::env::var("RUN_UI_TESTS").as_deref() == Ok("1");
    let required = std::env::var("REQUIRE_UI_TESTS").as_deref() == Ok("1");
    assert!(
        opted_in || !required,
        "REQUIRE_UI_TESTS=1 but RUN_UI_TESTS is not 1: this run would have skipped the UI \
         snapshots and reported success"
    );
    !opted_in
}

#[test]
fn ui() {
    if skip_snapshots() {
        eprintln!("skipping trybuild UI tests; set RUN_UI_TESTS=1 (stable toolchain) to run them");
        return;
    }
    let cases = trybuild::TestCases::new();
    cases.compile_fail("tests/ui/*.rs");
}