From f4e54d40bbad627205e15fa4639b75bc8e884472 Mon Sep 17 00:00:00 2001 From: Avril Date: Thu, 10 Sep 2020 13:48:30 +0100 Subject: [PATCH] update readme --- README.org | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/README.org b/README.org index 74b7755..e75fcfc 100644 --- a/README.org +++ b/README.org @@ -100,22 +100,24 @@ On =nightly= Rust versions, values of type ~GHOST_TSuccess~ can be propagated directly with ~?~, but on stable they must be propagated through ~GhostResult~: #+BEGIN_SRC rust - extern "C" {fn returns_tsuccess() -> GHOST_TSuccess;} - - fn try_things_internal() -> GhostResult // On nightly, we can propagage `GHOST_TSuccess` directly here, but it's still more desireable for us to have a `Result` instead of an integer in Rust, so this is still preferrable. - { - returns_tsuccess()?; - - Ok(()) - } - - fn caller() - { - match try_things_internal() { - Ok(_) => println!("Yay!"), - Err(_) => panic!("Fug"), - } - } + extern "C" {fn returns_tsuccess() -> GHOST_TSuccess;} + + fn try_things_internal() -> GhostResult // On nightly, we can propagage `GHOST_TSuccess` directly here, but it's still more desireable for us to have a `Result` instead of an integer in Rust, so this is still preferrable. + { + unsafe { + eturns_tsuccess()?; + } + + Ok(()) + } + + fn caller() + { + match try_things_internal() { + Ok(_) => println!("Yay!"), + Err(_) => panic!("Fug"), + } + } #+END_SRC Keeping such a style is /usually/ preferred, anyhow.