pub async fn stats(&self) -> Result<BdevStats, i32> {
        let mut stat: spdk_bdev_io_stat = Default::default();
        let (sender, receiver) = oneshot::channel::<i32>();

        // this will iterate over io channels and call async cb when done
        unsafe {
            spdk_bdev_get_device_stat(
                self.0.as_ptr(),
                &mut stat as *mut _,
                Some(Self::stat_cb),
                cb_arg(sender),
            );
        }

        let errno = receiver.await.expect("Cancellation is not supported");
        if errno != 0 {
            Err(errno)
        } else {
            // stat is populated with the stats by now
            Ok(BdevStats {
                num_read_ops: stat.num_read_ops,
                num_write_ops: stat.num_write_ops,
                bytes_read: stat.bytes_read,
                bytes_written: stat.bytes_written,
            })
        }
    }
/// Get bdev stats or errno value in case of an error.
Get bdev stats or errno value in case of an error.
Get bdev stats or errno value in case of an error .
pub async fn stats(&self) -> Result<BdevStats, i32> {
        let mut stat: spdk_bdev_io_stat = Default::default();
        let (sender, receiver) = oneshot::channel::<i32>();
        // this will iterate over io channels and call async cb when done
        unsafe {
            spdk_bdev_get_device_stat(
                self.0.as_ptr(),
                &mut stat as *mut _,
                Some(Self::stat_cb),
                cb_arg(sender),
            );
        }
        let errno = receiver.await.expect("Cancellation is not supported");
        if errno != 0 {
            Err(errno)
        } else {
            // stat is populated with the stats by now
            Ok(BdevStats {
                num_read_ops: stat.num_read_ops,
                num_write_ops: stat.num_write_ops,
                bytes_read: stat.bytes_read,
                bytes_written: stat.bytes_written,
            })
        }
    }
pub async fn stats ( & self ) -> Result < BdevStats , i32 > { let mut stat : spdk_bdev_io_stat = Default :: default ( ) ; let ( sender , receiver ) = oneshot :: channel :: < i32 > ( ) ; // this will iterate over io channels and call async cb when done unsafe { spdk_bdev_get_device_stat ( self . 0 . as_ptr ( ) , & mut stat as * mut _ , Some ( Self :: stat_cb ) , cb_arg ( sender ) , ) ; } let errno = receiver . await . expect ( " " ) ; if errno != 0 { Err ( errno ) } else { // stat is populated with the stats by now Ok ( BdevStats { num_read_ops : stat . num_read_ops , num_write_ops : stat . num_write_ops , bytes_read : stat . bytes_read , bytes_written : stat . bytes_written , } ) } }
Get bdev stats or errno value in case of an error.
Get bdev stats or errno value in case of an error .
&self