update readme

master
Avril 4 years ago
parent 396a181b35
commit f4e54d40bb
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -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~: 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 #+BEGIN_SRC rust
extern "C" {fn returns_tsuccess() -> GHOST_TSuccess;} 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<T,E>` instead of an integer in Rust, so this is still preferrable. 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<T,E>` instead of an integer in Rust, so this is still preferrable.
{ {
returns_tsuccess()?; unsafe {
eturns_tsuccess()?;
Ok(()) }
}
Ok(())
fn caller() }
{
match try_things_internal() { fn caller()
Ok(_) => println!("Yay!"), {
Err(_) => panic!("Fug"), match try_things_internal() {
} Ok(_) => println!("Yay!"),
} Err(_) => panic!("Fug"),
}
}
#+END_SRC #+END_SRC
Keeping such a style is /usually/ preferred, anyhow. Keeping such a style is /usually/ preferred, anyhow.

Loading…
Cancel
Save