[−][src]Struct oboe_sys::oboe_ResultWithValue
A ResultWithValue can store both the result of an operation (either OK or an error) and a value.
It has been designed for cases where the caller needs to know whether an operation succeeded and, if it did, a value which was obtained during the operation.
For example, when reading from a stream the caller needs to know the result of the read operation and, if it was successful, how many frames were read. Note that ResultWithValue can be evaluated as a boolean so it's simple to check whether the result is OK.
ResultWithValue resultOfRead = myStream.read(&buffer, numFrames, timeoutNanoseconds);
if (resultOfRead) {
LOGD("Frames read: %d", resultOfRead.value());
} else {
LOGD("Error reading from stream: %s", resultOfRead.error());
}
Fields
mValue: T
mError: oboe_Result
_phantom_0: PhantomData<UnsafeCell<T>>
Trait Implementations
impl<T: Clone> Clone for oboe_ResultWithValue<T>
[src]
fn clone(&self) -> oboe_ResultWithValue<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Copy> Copy for oboe_ResultWithValue<T>
[src]
impl<T: Debug> Debug for oboe_ResultWithValue<T>
[src]
Auto Trait Implementations
impl<T> !RefUnwindSafe for oboe_ResultWithValue<T>
impl<T> Send for oboe_ResultWithValue<T> where
T: Send,
T: Send,
impl<T> !Sync for oboe_ResultWithValue<T>
impl<T> Unpin for oboe_ResultWithValue<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for oboe_ResultWithValue<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,