diff --git a/containers/Cargo.lock b/containers/Cargo.lock new file mode 100644 index 0000000..ea82ab9 --- /dev/null +++ b/containers/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "containers" +version = "0.1.0" diff --git a/containers/Cargo.toml b/containers/Cargo.toml new file mode 100644 index 0000000..a1b03d6 --- /dev/null +++ b/containers/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "containers" +version = "0.1.0" +edition = "2024" + +[dependencies] diff --git a/containers/src/main.rs b/containers/src/main.rs new file mode 100644 index 0000000..7661ff4 --- /dev/null +++ b/containers/src/main.rs @@ -0,0 +1,32 @@ +enum Direction +{ + Up, + Down, + Left, + Right +} + +enum Status +{ + Succeeded(String), + Failed(String) +} + +fn main() { + // normal Enum + let direction = Direction::Down; + match direction { + Direction::Up => println!("Going up"), + Direction::Down => println!("Going down"), + Direction::Left => println!("Going left"), + Direction::Right => println!("Going right"), + } + + // enum holding data + let status = Status::Failed(String::from("Authentication Failed")); + match status + { + Status::Succeeded(message) => println!("Succeeded with msg: {}",message), + Status::Failed(message) => println!("Failed with msg: {}",message), + } +}