[][src]Struct wpilib::HalMaybe

#[must_use]
pub struct HalMaybe<T> { /* fields omitted */ }

Represents the result of a function call that could error, but even if it does, the result is still usable. Like HalResult<T>, HalMaybe<T> must be used.

Methods

impl<T> HalMaybe<T>
[src]

pub fn new(ret: T, err: Option<HalError>) -> HalMaybe<T>
[src]

pub fn ok(self) -> T
[src]

Ignore the possible error, and consume the HalMaybe into its return value.

pub fn has_err(&self) -> bool
[src]

Returns true if there is an error

pub fn err(&self) -> Option<HalError>
[src]

Access the potential error.

pub fn into_res(self) -> Result<T, HalError>
[src]

Convert the HalMaybe into a Result, discarding the return value if there is an error. This is useful for accessing the many methods on Result, including ? error raising.

Trait Implementations

impl<T> Copy for HalMaybe<T> where
    T: Copy
[src]

impl<T> Debug for HalMaybe<T> where
    T: Debug
[src]

impl<T> Clone for HalMaybe<T> where
    T: Clone
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl<T> Send for HalMaybe<T> where
    T: Send

impl<T> Sync for HalMaybe<T> where
    T: Sync

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]