Struct erupt::utils::VulkanResult [−][src]
Idiomatic wrapper around a Vulkan Result
Fields
raw: Result
The raw result from Vulkan
value: Option<T>
The value this wrapper type may be holding
Implementations
impl<T> VulkanResult<T>
[src]
pub fn new(raw: Result, value: T) -> VulkanResult<T>
[src]
Construct a new VulkanResult
from raw
and value
This will not populate self.value
if the raw result is negative (Error)
pub fn unwrap(self) -> T
[src]
Returns the contained value, consuming self
Panics with the name of self.raw
if self.value
is None
pub fn expect(self, msg: impl Display) -> T
[src]
Returns the contained value, consuming self
Panics with msg
and the name of self.raw
if self.value
is None
pub fn as_ref(&self) -> VulkanResult<&T>
[src]
Converts from &VulkanResult<T>
to VulkanResult<&T>
Clones self.raw
pub fn as_mut(&mut self) -> VulkanResult<&mut T>
[src]
Converts from &mut VulkanResult<T>
to VulkanResult<&mut T>
Clones self.raw
pub fn new_ok(value: T) -> VulkanResult<T>
[src]
Constructs a new VulkanResult
from value
This will always set self.raw
to vk::Result::SUCCESS
pub fn new_err(raw: Result) -> VulkanResult<T>
[src]
Constructs a new VulkanResult
from raw
This will always set self.value
to None
pub fn ok(self) -> Option<T>
[src]
Returns self.value
, consuming self
and dropping self.raw
pub fn result(self) -> Result<T, Result>
[src]
Maps Some(v)
of self.value
to Ok(v)
and None
of self.value
to Err(self.raw)
pub fn map_err<F, O: FnOnce(Result) -> F>(self, op: O) -> Result<T, F>
[src]
Maps Some(v)
of self.value
to Ok(v)
and None
of self.value
to Err(op(self.raw))
pub fn is_ok(&self) -> bool
[src]
Returns true
if self.value
is Some
pub fn raw_is_ok(&self) -> bool
[src]
Returns true
if self.raw
is positive
pub fn is_err(&self) -> bool
[src]
Returns true
if self.value
is None
pub fn raw_is_err(&self) -> bool
[src]
Returns true
if self.raw
is negative
Trait Implementations
impl<T: Clone> Clone for VulkanResult<T>
[src]
fn clone(&self) -> VulkanResult<T>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Copy> Copy for VulkanResult<T>
[src]
impl<T> Debug for VulkanResult<T> where
T: Debug,
[src]
T: Debug,
impl<T: Default> Default for VulkanResult<T>
[src]
fn default() -> VulkanResult<T>
[src]
impl<T> Display for VulkanResult<T> where
T: Display,
[src]
T: Display,
Auto Trait Implementations
impl<T> RefUnwindSafe for VulkanResult<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for VulkanResult<T> where
T: Send,
T: Send,
impl<T> Sync for VulkanResult<T> where
T: Sync,
T: Sync,
impl<T> Unpin for VulkanResult<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for VulkanResult<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,
pub 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.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
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.
pub 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>,