Struct oboe_sys::oboe_ResultWithValue[][src]

#[repr(C)]
pub struct oboe_ResultWithValue<T> { pub mValue: T, pub mError: oboe_Result, pub _phantom_0: PhantomData<UnsafeCell<T>>, }
Expand description

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: TmError: oboe_Result_phantom_0: PhantomData<UnsafeCell<T>>

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

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

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.