Uart - esp32 Rust. How to you find it data is available()

Hi All,

Probably a simple question but how do you peek a uart/serial interface to
check if there is a data available using esp-hal

E.g.

    // Read characters from serial
    if (Serial.available() > 0) {
      c = Serial.read();
...

Had hoped ReadReady would do this for me. I don't want to block when reading unless there is data.

Thanks.

is ReadReady::read_ready() what you are looking for?

That was what I hoped but it still blocks on the read

      info!("Waiting for input...");
        let read_ready = embedded_io_async::ReadReady::read_ready(&mut rx);
        if read_ready.is_err() {
            info!("We had an errror...");
            continue;
        } else {
            info!("No  errror going to do read... ");
        }

        info!("Ready for read...");

        // Read characters from serial
        let read_result = embedded_io_async::Read::read(&mut rx, &mut read_buffer[0..]).await;

        info!("Finished reading...");

Never see Finished reading...

So once again I am the fool. I assumed that you either get is_err() or good to go. You don't you get a boolean to tell you what to do

        let read_ready = embedded_io_async::ReadReady::read_ready(&mut rx);
        match read_ready {
            Ok(result) => {
                if result == false {
                    // info!("Not Ready for read...");
                    continue;
                }
                info!("Ready for read...");
            }
            Err(e) => {
                info!("Error reading from UART: {:?}", e);
                continue;
            }
        }

        info!("Ready for read...");

I guess this is the benefit of a new day. Thanks for replying