Skip to content

Instantly share code, notes, and snippets.

View henryobiaraije's full-sized avatar
🏠
Working from home

Henry Obiaraije henryobiaraije

🏠
Working from home
View GitHub Profile
@henryobiaraije
henryobiaraije / rust.rs
Created May 19, 2023 19:40
How to Create a new Rust Cargo Project
cargo new project_name
// dailydoseofrust.com
@henryobiaraije
henryobiaraije / lib.rs
Created May 19, 2023 20:00
Calculator code in the calculator library crate.
// Full tutorial https://www.youtube.com/watch?v=LJppDNH2CHI
pub struct Calculator {
result: f64,
}
impl Calculator {
/// Creates a new Calculator instance with the initial result set to 0.0.
pub fn new() -> Self {
return Self { result: 0.0 };
@henryobiaraije
henryobiaraije / main.rs
Created May 19, 2023 20:48
How to use the Calculator Crate
// Full video tutorial here https://www.youtube.com/watch?v=LJppDNH2CHI
use calculator::Calculator;
fn main(){
let mut calculator = Calculator::new();
calculator
.add([4.0,10.0,20.0].to_vec())
.subsctract([100.0].to_vec());
@henryobiaraije
henryobiaraije / lib.rs
Created May 19, 2023 20:56
Writing unit test for the Calculator struct.
// Full tutorial here https://youtu.be/LJppDNH2CHI
#[cfg(test)]
mod test{
use crate::Calculator;
#[test]
fn test_addition(){
let mut calculator = Calculator::new();
{
"Position_QB":
{
"lastUpdatedOn": "2025-09-04T16:09:07.763Z",
"playerStatsTotals": [
{
"player": {
"id": 18631,
"firstName": "Justin",
"lastName": "Herbert",