rust_template 0.1.0

This is individual-assignment 7 in mechatronics 1: Crate up
use rpi_embedded::uart::{Uart,Parity};
//use std::time::Duration;
use std::string::String;

pub enum Settings { 
    Baudgps,
    Baudarduino,
    Data,
    Stopbit,
    
}

impl Settings{
    pub fn get_baud(&self) -> u32{
        let value : u32;
        match self{
            Settings::Baudgps => {value = 9600}
            Settings::Baudarduino => {value = 115_200}
            Settings::Data =>{value = 8}
            Settings::Stopbit =>{value = 1} 

        }
        value
        }

}
struct GPS{
    pub longitude: String, 
    pub latitude: String, 
    pub altitude: String,
    pub time: String,
    pub satellites: String
}

impl GPS{
    pub fn new() -> Self{
        let mut _out = Self{
            longitude: "".to_string(), //string
            latitude: "".to_string(),
            altitude: "".to_string(),
            time:"".to_string(),
            satellites: "".to_string(),
        };
        _out
    
    }

    pub fn spliting(&mut self,string_read:String){
        let reading = string_read.split(',');
        let read_vec: Vec<&str> = reading.collect();
        //println!("{}",read_vec[0]);
        if read_vec[0] == "$GPGGA"{
            self.gps_system(read_vec);
            self.gps_print();
            }

    }
    pub fn  gps_system(&mut self,read_vec: Vec<&str>){ //takes a value from the list and converts it to string for latitude ,longitude ,altidute, satellite and time 
        self.longitude = read_vec[2].to_string() + "" + &read_vec[3].to_string();
        self.latitude = read_vec[4].to_string()+ "" + &read_vec[5].to_string();
        self.altitude = read_vec[9].to_string() + "" + &read_vec[10].to_string();
        self.time = read_vec[1].to_string();
        self.satellites = read_vec[7].to_string();

    }


    pub fn gps_print(&mut self){//function to print
        let print_str=format! (
        "\n
        Time: {}h{}m{}s \n
        Latitude: {} \n
        Longitude: {} \n
        Altitude: {} \n
        Number of Satellites: {} \n",&self.time[0..2],&self.time[2..4],&self.time[4..6],self.latitude,self.longitude,self.altitude,self.satellites);
        println!("Useful data: {}",print_str);
    }
    // pub fn uart_status(&self) -> rpi_embedded::uart::Status {
    //     self.uart.status().expect("Getting uart status does not work")
    // }

}

fn main(){
    let mut tracking = GPS::new();


        let mut uart = Uart::new(9600, Parity::None,8,1).expect("Initializing failed!"); //115_200
        loop{
        //uart.set_read_mode(1, Duration::default()).expect("read mode fail");
        let string_read = uart.read_line().expect("GPS reading failed");
        tracking.spliting(string_read);
        }
    }