From d08e03d6ce619f2e862bb83813e49a1cbfe50e88 Mon Sep 17 00:00:00 2001 From: James Date: Wed, 25 Oct 2023 15:25:53 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Initial=20commit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/rust.yml | 26 +++++ .gitignore | 186 +++++++++++++++++++++++++++++++++++ Cargo.toml | 12 +++ README.md | 1 + s | 44 +++++++++ src/common/mod.rs | 1 + src/common/utils.rs | 0 src/lib.rs | 4 + src/main.rs | 3 + src/server/handler.rs | 0 src/server/image.rs | 0 src/server/mod.rs | 2 + src/types/complex.rs | 0 src/types/messages.rs | 0 src/types/mod.rs | 8 ++ src/types/pixel_data.rs | 0 src/types/pixel_intensity.rs | 0 src/types/point.rs | 0 src/types/range.rs | 0 src/types/resolution.rs | 0 src/types/u8data.rs | 0 src/worker/calculations.rs | 0 src/worker/client.rs | 0 src/worker/mod.rs | 2 + 24 files changed, 289 insertions(+) create mode 100644 .github/workflows/rust.yml create mode 100644 .gitignore create mode 100644 Cargo.toml create mode 100644 README.md create mode 100755 s create mode 100644 src/common/mod.rs create mode 100644 src/common/utils.rs create mode 100644 src/lib.rs create mode 100644 src/main.rs create mode 100644 src/server/handler.rs create mode 100644 src/server/image.rs create mode 100644 src/server/mod.rs create mode 100644 src/types/complex.rs create mode 100644 src/types/messages.rs create mode 100644 src/types/mod.rs create mode 100644 src/types/pixel_data.rs create mode 100644 src/types/pixel_intensity.rs create mode 100644 src/types/point.rs create mode 100644 src/types/range.rs create mode 100644 src/types/resolution.rs create mode 100644 src/types/u8data.rs create mode 100644 src/worker/calculations.rs create mode 100644 src/worker/client.rs create mode 100644 src/worker/mod.rs diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..ac86fa0 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,26 @@ +name: Rust CI + +on: + push: + branches: + - master + - develop + pull_request: + branches: + - master + - develop + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --verbose diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b59520d --- /dev/null +++ b/.gitignore @@ -0,0 +1,186 @@ +# Created by https://www.toptal.com/developers/gitignore/api/rust,windows,macos,visualstudiocode,intellij+all +# Edit at https://www.toptal.com/developers/gitignore?templates=rust,windows,macos,visualstudiocode,intellij+all + +### Intellij+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Intellij+all Patch ### +# Ignore everything but code style settings and run configurations +# that are supposed to be shared within teams. + +.idea/* + +!.idea/codeStyles +!.idea/runConfigurations + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### macOS Patch ### +# iCloud generated files +*.icloud + +### Rust ### +# Generated by Cargo +# will have compiled files and executables +debug/ +target/ + +# 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 +Cargo.lock + +# These are backup files generated by rustfmt +**/*.rs.bk + +# MSVC Windows builds of rustc generate these, which store debugging information +*.pdb + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history +.ionide + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# End of https://www.toptal.com/developers/gitignore/api/rust,windows,macos,visualstudiocode,intellij+all diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..750d78b --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "frakt" +authors = ["James ", "Ronan ", "Charles "] +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +serde = { version = "1.0.189", features = ["derive"] } +serde_json = "1.0.107" +image = "0.24.7" diff --git a/README.md b/README.md new file mode 100644 index 0000000..9516cca --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# frakt diff --git a/s b/s new file mode 100755 index 0000000..301b006 --- /dev/null +++ b/s @@ -0,0 +1,44 @@ +#!/bin/bash + +# Fonction pour créer les mod.rs avec des exports basiques +create_mod_rs () { + rm -f "$1/mod.rs" # Supprimer le fichier mod.rs s'il existe + touch "$1/mod.rs" # Créer un nouveau fichier mod.rs vide + + for module_file in $(ls "$1" | grep -E '\.rs$'); do + module=$(basename "$module_file" .rs) + if [ "$module" != "mod" ]; then # On exclut le fichier mod.rs lui-même + echo "pub mod $module;" >> "$1/mod.rs" + fi + done +} + +# Crée les dossiers pour les modules +mkdir -p src/types +mkdir -p src/worker +mkdir -p src/server +mkdir -p src/common + +# Crée les fichiers .rs dans le module 'types' +touch src/types/point.rs +touch src/types/complex.rs +touch src/types/range.rs +touch src/types/resolution.rs +touch src/types/pixel_intensity.rs +touch src/types/messages.rs + +# Crée les autres fichiers .rs dans les modules respectifs +touch src/worker/client.rs +touch src/worker/calculations.rs +touch src/server/handler.rs +touch src/server/image.rs +touch src/common/utils.rs + +# Crée les fichiers mod.rs et ajoute les exports +create_mod_rs "src/types" +create_mod_rs "src/worker" +create_mod_rs "src/server" +create_mod_rs "src/common" + +# Un petit message pour indiquer que tout s'est bien passé +echo "Arborescence de dossiers et de fichiers créée et fichiers mod.rs renseignés avec succès !" diff --git a/src/common/mod.rs b/src/common/mod.rs new file mode 100644 index 0000000..b5614dd --- /dev/null +++ b/src/common/mod.rs @@ -0,0 +1 @@ +pub mod utils; diff --git a/src/common/utils.rs b/src/common/utils.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..fe8ac89 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,4 @@ +mod types; +mod server; +mod common; +mod worker; \ No newline at end of file diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} diff --git a/src/server/handler.rs b/src/server/handler.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/server/image.rs b/src/server/image.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/server/mod.rs b/src/server/mod.rs new file mode 100644 index 0000000..efdff6d --- /dev/null +++ b/src/server/mod.rs @@ -0,0 +1,2 @@ +pub mod handler; +pub mod image; diff --git a/src/types/complex.rs b/src/types/complex.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/types/messages.rs b/src/types/messages.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/types/mod.rs b/src/types/mod.rs new file mode 100644 index 0000000..ac67dab --- /dev/null +++ b/src/types/mod.rs @@ -0,0 +1,8 @@ +pub mod complex; +pub mod messages; +pub mod pixel_intensity; +pub mod pixel_data; +pub mod point; +pub mod range; +pub mod resolution; +pub mod u8data; diff --git a/src/types/pixel_data.rs b/src/types/pixel_data.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/types/pixel_intensity.rs b/src/types/pixel_intensity.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/types/point.rs b/src/types/point.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/types/range.rs b/src/types/range.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/types/resolution.rs b/src/types/resolution.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/types/u8data.rs b/src/types/u8data.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/worker/calculations.rs b/src/worker/calculations.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/worker/client.rs b/src/worker/client.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/worker/mod.rs b/src/worker/mod.rs new file mode 100644 index 0000000..cd97638 --- /dev/null +++ b/src/worker/mod.rs @@ -0,0 +1,2 @@ +pub mod calculations; +pub mod client;