Skip to content

Instantly share code, notes, and snippets.

@jesselawson
Last active October 22, 2019 00:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jesselawson/9e1579576398bdc183caf5fb16c4ad5e to your computer and use it in GitHub Desktop.
Save jesselawson/9e1579576398bdc183caf5fb16c4ad5e to your computer and use it in GitHub Desktop.
Third Checkpoint, Getting Started with Rust by Building a Tiny Markdown Compiler (https://jesselawson.org/tutorials)
// Code for the Third Checkpoint
// Tutorial: https://jesselawson.org/rust/get-started-with-rust-by-building-a-tiny-markdown-compiler/
//
// The purpose of this checkpoint is to ensure that you have a complete copy
// of the code in the tutorial up to the checkpoint. I want you to tinker and
// explore, but to keep up with the rest of the tutorial, make sure your
// code matches this checkpoint.
fn parse_markdown_file() {
// This will be created in Chapter 4
}
fn get_title() -> String {
let mut the_title = String::from(env!("CARGO_PKG_NAME"));
the_title.push_str(" (v");
the_title.push_str(env!("CARGO_PKG_VERSION"));
the_title.push_str("), ");
the_title.push_str(env!("CARGO_PKG_DESCRIPTION"));
return the_title;
}
fn print_short_banner() {
println!("{}", get_title());
}
fn print_long_banner() {
print_short_banner();
println!("Written by: {}\nHomepage: {}\nUsage: tinymd <somefile>.md\n",
env!("CARGO_PKG_AUTHORS"),
env!("CARGO_PKG_HOMEPAGE")
);
}
fn usage() {
print_long_banner();
}
fn main() {
usage();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment