Skip to main content

ResultExt

Trait ResultExt 

Source
pub trait ResultExt<T> {
    // Required methods
    fn unwrap_or_errno<'life0, 'life1, 'async_trait>(
        self,
        caller: &'life0 mut Caller<'life1, Host>,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn unwrap_or_errno_as<'life0, 'life1, 'async_trait>(
        self,
        caller: &'life0 mut Caller<'life1, Host>,
        error_value: T,
    ) -> Pin<Box<dyn Future<Output = T> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}

Required Methods§

Source

fn unwrap_or_errno<'life0, 'life1, 'async_trait>( self, caller: &'life0 mut Caller<'life1, Host>, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

If this result is an error, sets the simulator’s errno to the Err value. Returns true if the result was Ok and false if it was Err.

§Example
let res = lcd.set_line(line, "");
Ok(res.unwrap_or_errno(&mut caller).await.into())
Source

fn unwrap_or_errno_as<'life0, 'life1, 'async_trait>( self, caller: &'life0 mut Caller<'life1, Host>, error_value: T, ) -> Pin<Box<dyn Future<Output = T> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

If this result is an error, sets the simulator’s errno to the Err value. Returns the T value if the result was Ok and the error_value parameter if it was Err.

§Example
let res = controllers.get_analog(pros_sys::E_CONTROLLER_MASTER);
Ok(res.unwrap_or_errno_as(&mut caller, 0).await)

Implementations on Foreign Types§

Source§

impl<T: Send> ResultExt<T> for Result<T, i32>

Source§

fn unwrap_or_errno<'life0, 'life1, 'async_trait>( self, caller: &'life0 mut Caller<'life1, Host>, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn unwrap_or_errno_as<'life0, 'life1, 'async_trait>( self, caller: &'life0 mut Caller<'life1, Host>, error_value: T, ) -> Pin<Box<dyn Future<Output = T> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§