Compare commits
2 Commits
0f539d31ca
...
cb9f837887
| Author | SHA1 | Date | |
|---|---|---|---|
| cb9f837887 | |||
| 6f2517c830 |
7
Cargo.lock
generated
Normal file
7
Cargo.lock
generated
Normal 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
4
src/item.rs
Normal file
@@ -0,0 +1,4 @@
|
||||
pub struct Item {
|
||||
pub name: String,
|
||||
pub value: i32,
|
||||
}
|
||||
18
src/lib.rs
Normal file
18
src/lib.rs
Normal 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(())
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user