From 9b74acc598182c582323bb85b110765f5951c5ee Mon Sep 17 00:00:00 2001 From: Greg Burri Date: Mon, 5 Jul 2021 10:56:26 +0200 Subject: [PATCH] Beginning of 'ch3-cubsat-ground-station' --- ch3-cubsat-ground-station/Cargo.lock | 7 ++++++ ch3-cubsat-ground-station/Cargo.toml | 8 +++++++ ch3-cubsat-ground-station/src/main.rs | 32 +++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 ch3-cubsat-ground-station/Cargo.lock create mode 100644 ch3-cubsat-ground-station/Cargo.toml create mode 100644 ch3-cubsat-ground-station/src/main.rs diff --git a/ch3-cubsat-ground-station/Cargo.lock b/ch3-cubsat-ground-station/Cargo.lock new file mode 100644 index 0000000..525f21a --- /dev/null +++ b/ch3-cubsat-ground-station/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ch3-cubsat-ground-station" +version = "0.1.0" diff --git a/ch3-cubsat-ground-station/Cargo.toml b/ch3-cubsat-ground-station/Cargo.toml new file mode 100644 index 0000000..55d009f --- /dev/null +++ b/ch3-cubsat-ground-station/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "ch3-cubsat-ground-station" +version = "0.1.0" +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/ch3-cubsat-ground-station/src/main.rs b/ch3-cubsat-ground-station/src/main.rs new file mode 100644 index 0000000..b456ff8 --- /dev/null +++ b/ch3-cubsat-ground-station/src/main.rs @@ -0,0 +1,32 @@ +#![cfg_attr(debug_assertions, allow(unused_variables, dead_code))] + +#[derive(Debug)] +enum StatusMessage { + Ok, +} + +#[derive(Debug)] +struct CubeSat { + id: u64, +} + +fn check_status(sat_id: CubeSat) -> StatusMessage { + StatusMessage::Ok +} + +fn main() { + let sat_a = CubeSat { id: 0 }; + let sat_b = CubeSat { id: 1 }; + let sat_c = CubeSat { id: 2 }; + + let a_status = check_status(sat_a); + let b_status = check_status(sat_b); + let c_status = check_status(sat_c); + println!("a: {:?}, b: {:?}, c: {:?}", a_status, b_status, c_status); + + + let a_status = check_status(sat_a); + let b_status = check_status(sat_b); + let c_status = check_status(sat_c); + println!("a: {:?}, b: {:?}, c: {:?}", a_status, b_status, c_status); +} -- 2.45.2