From: Greg Burri Date: Mon, 5 Jul 2021 08:56:26 +0000 (+0200) Subject: Beginning of 'ch3-cubsat-ground-station' X-Git-Url: http://git.euphorik.ch/index.cgi?a=commitdiff_plain;h=9b74acc598182c582323bb85b110765f5951c5ee;p=rust_in_action.git Beginning of 'ch3-cubsat-ground-station' --- 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); +}