Create Item

Definition of an item struct.
This commit is contained in:
2023-11-19 15:05:47 -05:00
parent 0f539d31ca
commit 6f2517c830
4 changed files with 35 additions and 1 deletions
Generated
+7
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
View File
@@ -0,0 +1,4 @@
pub struct Item {
pub name: String,
pub value: i32,
}
+18
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(())
}
+6 -1
View File
@@ -1,3 +1,8 @@
use std::process;
fn main() {
println!("Hello, world!");
if let Err(e) = steel_saga::run() {
println!("Error: {e}");
process::exit(1);
}
}