Created
July 12, 2017 06:45
-
-
Save raffylopez/9759bfc82d1fd3ab422048686c0106c9 to your computer and use it in GitHub Desktop.
A Slice of Rusty Pi!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// no-shebang | |
#![allow(unused_imports)] | |
#![allow(dead_code)] | |
#![allow(unused_variables,unused_must_use)] | |
#![allow(unused_mut)] | |
// -- in rust, a slice of a String is an &str ref | |
fn main() { | |
let pi = "3.14151".to_string(); | |
let slice_of_pi: &str = &pi[0..3]; | |
println!("slice_of_pi -> {}", slice_of_pi); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment