Compare commits

..

2 Commits

Author SHA1 Message Date
cb9f837887 Merge pull request 'Create Item' (#6) from item into main
Reviewed-on: #6
2023-11-19 20:14:24 +00:00
6f2517c830 Create Item
Definition of an item struct.
2023-11-19 15:05:47 -05:00
4 changed files with 35 additions and 1 deletions

7
Cargo.lock generated Normal file
View File

@@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "steel_saga"
version = "0.1.0"

4
src/item.rs Normal file
View File

@@ -0,0 +1,4 @@
pub struct Item {
pub name: String,
pub value: i32,
}

18
src/lib.rs Normal file
View File

@@ -0,0 +1,18 @@
use std::error::Error;
mod item;
use item::Item;
pub fn run() -> Result<(), Box<dyn Error>> {
let item = Item {
name: String::from("Test Item"),
value: 300,
};
println!(
"This item is {} and it's value is {}.",
item.name, item.value
);
Ok(())
}

View File

@@ -1,3 +1,8 @@
use std::process;
fn main() { fn main() {
println!("Hello, world!"); if let Err(e) = steel_saga::run() {
println!("Error: {e}");
process::exit(1);
}
} }