From eab2096e3991044d12c24607b81053f7132c13db Mon Sep 17 00:00:00 2001 From: OBJNULL Date: Thu, 20 Jun 2024 13:06:16 -0400 Subject: [PATCH] Base upload --- .gitignore | 1 + Cargo.toml | 6 ++++++ Dockerfile | 8 ++++++++ README.md | 3 +-- src/board.rs | 25 +++++++++++++++++++++++++ src/card.rs | 17 +++++++++++++++++ src/main.rs | 22 ++++++++++++++++++++++ 7 files changed, 80 insertions(+), 2 deletions(-) create mode 100755 Cargo.toml create mode 100755 Dockerfile create mode 100755 src/board.rs create mode 100755 src/card.rs create mode 100755 src/main.rs diff --git a/.gitignore b/.gitignore index 3ca43ae..fabb919 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ # will have compiled files and executables debug/ target/ +build/ # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html diff --git a/Cargo.toml b/Cargo.toml new file mode 100755 index 0000000..1cf0735 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "Tasky" +version = "0.1.0" +edition = "2021" + +[dependencies] diff --git a/Dockerfile b/Dockerfile new file mode 100755 index 0000000..b8e6fd2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +## SETUP ## +FROM rust + +RUN mkdir /src /comp /app +WORKDIR /comp + +## RUNTIME ## +CMD cp -r /src/* . && cargo build && cp ./target/debug/Tasky /app \ No newline at end of file diff --git a/README.md b/README.md index 456f892..e6b5a99 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,2 @@ # Tasky - -A quick and easy task manager \ No newline at end of file +A quick and easy task manager diff --git a/src/board.rs b/src/board.rs new file mode 100755 index 0000000..04dfb87 --- /dev/null +++ b/src/board.rs @@ -0,0 +1,25 @@ +// Libraries +use crate::card; + +// Structures +pub struct TaskBoard { + pub name: String, + pub cards: Vec +} + +// Implementations +impl TaskBoard { + pub fn init(name: String) -> TaskBoard { + // Setting the name + let name: String = name; + + // Init default cards + let mut cards: Vec = Vec::new(); + + // Creating a new default card + cards.push(card::TaskCard::init_empty()); + + // Return the board! + return TaskBoard {name: name, cards: cards}; + } +} \ No newline at end of file diff --git a/src/card.rs b/src/card.rs new file mode 100755 index 0000000..74a1c86 --- /dev/null +++ b/src/card.rs @@ -0,0 +1,17 @@ +// Library + +// Structures +pub struct TaskCard { + pub name: String, + pub desc: String +} + +// Implementations +impl TaskCard { + pub fn init_val(name: String, desc: String) -> TaskCard { + return TaskCard{name: name, desc: desc}; + } + pub fn init_empty() -> TaskCard { + return TaskCard::init_val(String::from("New Card"), String::new()); + } +} \ No newline at end of file diff --git a/src/main.rs b/src/main.rs new file mode 100755 index 0000000..55bb8a6 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,22 @@ +// Libraries +mod card; +mod board; + +// Functions + +// Entry Point +fn main() { + // Create a few new boards + let mut boards: Vec = Vec::new(); + + // Add a board + boards.push(board::TaskBoard::init(String::from("New Board"))); + + // Printing first board + for i in boards { + println!("Board: {}", i.name); + for x in i.cards { + println!("\tCard: {}", x.name); + } + } +} \ No newline at end of file