Skip to content

Instantly share code, notes, and snippets.

//src/main.rs
mod rectangle;
mod point;
fn main() {
println!("Hello, world!");
}
//src/point.rs
#[derive(Debug)]
//src/main.rs
mod rectangle;
fn main() {
println!("Hello, world!");
}
//src/point.rs
#[derive(Debug)]
pub struct Point {
//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,
@willmurphyscode
willmurphyscode / scientific_names_regex.rs
Created November 15, 2016 12:31
A regex to tell you whether a string is a "scientific name". (Note: very scientific)
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 {
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();