Hacker Public Radio

HPR3453: Rust 101: Episode 1 - Hello, World!


Listen Later

Talking Points
main.rs
Like main.cpp in C++ or main.c in C
Tells the compiler which file to start with
Can link to other "crates" and "modules"
Cargo.toml
Keeps track of application metadata
This includes dependencies!
Functions
Strictly typed, like everything in Rust
Declared by fn
Argument typed with argument: Type
Return typed with -> Type otherwise assumed to return nothing
The Main Function
Like the main functions in C and C++
Where the program starts within the main.rs file
CLI arguments handled by std::env, rather than argv and argc in C
Can return nothing or a Result<()>
Macros
Metafunctions or functions for functions
More general than functions, having flexibility in the number of arguments, etc, but harder to write
The println! Macro
Can take any number of arguments that implement the display trait
Usually things like strings or character literals
Will format them into a string and display it on the terminal
Similar to printf in C
The Hello World program
Can be automagically generated with cargo new and then the name of your application
Located in Name-Of-Application/src/main.rs
fn main() {
println!("Hello, world!");
}
Show Notes
Important Links:
Git repo for this miniseries
The Rust Standard Library
The format! macro
The println! macro
Wikipedia Articles:
The Rust Programming Language
Contact Me
Email: izzyleibowitz at pm dot me
Mastodon: at blackernel at nixnet dot social
...more
View all episodesView all episodes
Download on the App Store

Hacker Public RadioBy Hacker Public Radio

  • 4.2
  • 4.2
  • 4.2
  • 4.2
  • 4.2

4.2

34 ratings


More shows like Hacker Public Radio

View all
The Changelog: Software Development, Open Source by Changelog Media

The Changelog: Software Development, Open Source

290 Listeners

Defensive Security Podcast - Malware, Hacking, Cyber Security & Infosec by Jerry Bell and Andrew Kalat

Defensive Security Podcast - Malware, Hacking, Cyber Security & Infosec

372 Listeners

LINUX Unplugged by Jupiter Broadcasting

LINUX Unplugged

268 Listeners

SANS Internet Stormcenter Daily Cyber Security Podcast (Stormcast) by Johannes B. Ullrich

SANS Internet Stormcenter Daily Cyber Security Podcast (Stormcast)

651 Listeners

Curious Cases by BBC Radio 4

Curious Cases

822 Listeners

The Strong Towns Podcast by Strong Towns

The Strong Towns Podcast

423 Listeners

Late Night Linux by The Late Night Linux Family

Late Night Linux

164 Listeners

Darknet Diaries by Jack Rhysider

Darknet Diaries

8,061 Listeners

Cybersecurity Today by Jim Love

Cybersecurity Today

179 Listeners

CISO Series Podcast by David Spark, Mike Johnson, and Andy Ellis

CISO Series Podcast

189 Listeners

TechCrunch Daily Crunch by TechCrunch

TechCrunch Daily Crunch

42 Listeners

Strict Scrutiny by Crooked Media

Strict Scrutiny

5,797 Listeners

2.5 Admins by The Late Night Linux Family

2.5 Admins

98 Listeners

Cyber Security Headlines by CISO Series

Cyber Security Headlines

139 Listeners

What the Hack? by DeleteMe

What the Hack?

228 Listeners