Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created March 19, 2026 06:54
Show Gist options
  • Select an option

  • Save rust-play/6ecd50a1ca31ca32960f749e34f519cb to your computer and use it in GitHub Desktop.

Select an option

Save rust-play/6ecd50a1ca31ca32960f749e34f519cb to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
#![crate_type = "cdylib"]
#![allow(unused)]
fn main() {
let x: Result<i32, &str> = Ok(-3);
assert_eq!(x.is_ok(), true);
let x: Result<i32, &str> = Err("Some error message");
assert_eq!(x.is_ok(), false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment