This file contains 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
//src/main.rs | |
mod rectangle; | |
mod point; | |
fn main() { | |
println!("Hello, world!"); | |
} | |
//src/point.rs | |
#[derive(Debug)] |
This file contains 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
//src/main.rs | |
mod rectangle; | |
fn main() { | |
println!("Hello, world!"); | |
} | |
//src/point.rs | |
#[derive(Debug)] | |
pub struct Point { |
This file contains 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
//from scientific_names.lalrpop | |
// parse the final noun of a scientific name. | |
// match it to one of the legal final nouns. | |
pub FinalNoun : FinalNoun = { | |
"kablooie" => FinalNoun::Kablooie, | |
"swoosh" => FinalNoun::Swoosh, | |
"frobber" => FinalNoun::Frobber, | |
"atomizer" => FinalNoun::Atomizer, | |
"event" => FinalNoun::Event, | |
"device" => FinalNoun::Device, |
This file contains 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
extern crate regex; | |
use regex::Regex; | |
/* | |
1. At least 1 "cool" adjective ("horrendous", "incredible", "monstrous", "ultimate") | |
2. A science-sounding intermediate noun ("space", "time", "matter", "energy") | |
3. An onomatopoeia that makes a cool sound ("boom", "kablooie", "swoosh") | |
*/ | |
pub fn is_scientific_name(input: &str) -> bool { |
This file contains 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
use std::io; | |
use std::io::Write; | |
fn main() { | |
//println! is a macro that writes a line to stdout and then flushes the | |
//stdout buffer | |
println!("The inredibly annoying Rust echo strikes again!"); | |
//get a reference to stdin | |
let stdin = io::stdin(); |
NewerOlder