Struct erupt::utils::VulkanResult

source ·
pub struct VulkanResult<T> {
    pub raw: Result,
    pub value: Option<T>,
}
Expand description

Idiomatic wrapper around a Vulkan Result.

In order to use this type with the ? operator, call the .result() method first. Using the ? operator directly on this type is blocked on rust-lang/rust#84277.

Fields

raw: Result

The raw result from Vulkan.

value: Option<T>

The value this wrapper type may be holding.

Implementations

Construct a new VulkanResult from raw and value.

This will not populate self.value if the raw result is negative (Error).

Returns the contained value, consuming self.

Panics with the name of self.raw if self.value is None.

Returns the contained value, consuming self.

Panics with msg and the name of self.raw if self.value is None.

Converts from &VulkanResult<T> to VulkanResult<&T>.

Clones self.raw.

Converts from &mut VulkanResult<T> to VulkanResult<&mut T>.

Clones self.raw.

Constructs a new VulkanResult from value.

This will always set self.raw to vk::Result::SUCCESS.

Constructs a new VulkanResult from raw.

This will always set self.value to None.

Returns self.value, consuming self and dropping self.raw.

Maps Some(v) of self.value to Ok(v) and None of self.value to Err(self.raw).

Maps Some(v) of self.value to Ok(v) and None of self.value to Err(op(self.raw)).

Returns true if self.value is Some.

Returns true if self.raw is positive.

Returns true if self.value is None.

Returns true if self.raw is negative.

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
Returns the “default value” for a type. 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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. 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.