How to use serial instructions to connect with a bluetooth device?

I'm trying to build a program so that i can connect my stm32 card with a bluetooth hc-06 in order to turn on and off a led by using letters. I've found the code i need but it's in arduino. Can anyone help me to translate it so that i can prove it?

This is the code i've found and the one i need to translate:

int led = 7;

int state = 0;

void setup() {
    Serial.begin(9600);
    pinMode(led,OUTPUT);
}

void loop() {
    if (Serial.available() > 0) {
        state = Serial.read();
    }
    if state == 'a' {
            digitalWrite(led,HIGH);
    }
    if state == 'b' {
            digitalWrite(led,LOW);
    }
}

This is what i have done by far. I'm using the crate stm32f4xx-hal:

#![no_main]
#![no_std]

use panic_halt as _;

use cortex_m;
use cortex_m_rt::entry;
use stm32f4xx_hal as hal;

use crate::hal::{prelude::*, serial::config::Config, serial::Serial, stm32};

#[entry]
fn main() -> ! {
    let dp = stm32::Peripherals::take().unwrap();
    let cp = cortex_m::peripheral::Peripherals::take().unwrap();

    let gpioa = dp.GPIOA.split();

    let rcc = dp.RCC.constrain();

    let clocks = rcc.cfgr.use_hse(8.mhz()).freeze();

    let mut delay = hal::delay::Delay::new(cp.SYST, clocks);

    //define pins
    let tx_pin = gpioa.pa9.into_alternate_af7();
    let rx_pin = gpioa.pa10.into_alternate_af7();
    let mut led_pin = gpioa.pa7.into_push_pull_output();

    // configurar serial
    let serial = Serial::usart1(
        dp.USART1,
        (tx_pin, rx_pin),
        Config::default().baudrate(9600.bps()),
        clocks,
    ).unwrap();

    let (mut _tx, mut rx) = serial.split();
}