Mastodon Feed: Post

Mastodon Feed

NfNitLoop ("Cody Casterline 🏳️‍🌈") wrote:

Pop quiz:

Does this #Rust unit test pass or fail?

// A screenshot of a terminal editor containing the following Rust code: use std::sync::LazyLock; use ulid::Ulid; #[test] fn lazies() {     let u1 = *ULID;     let u2 = *ULID;     assert_eq!(u1, u2); } const ULID: LazyLock<!-- raw HTML omitted --> = LazyLock::new(|| {     println!("init");     Ulid::generate() });