[go: up one dir, main page]

Struct windows::HRESULT[][src]

#[repr(transparent)]
#[must_use]
pub struct HRESULT(pub u32);
Expand description

A primitive error code value returned by most COM functions.

Implementations

impl HRESULT[src]

pub fn is_ok(self) -> bool[src]

Returns true if self is a success code.

pub fn is_err(self) -> bool[src]

Returns true if self is a failure code.

pub fn unwrap(self)[src]

Asserts that self is a success code.

This will invoke the panic! macro if self is a failure code and display the HRESULT value for diagnostics.

pub fn ok(self) -> Result<()>[src]

Converts the HRESULT to Result<()>.

pub fn and_some<T: Interface>(self, some: Option<T>) -> Result<T>[src]

Returns the Option as a Result if the option is a Some value, returning a suitable error if not.

pub fn and_then<F, T>(self, op: F) -> Result<T> where
    F: FnOnce() -> T, 
[src]

Calls op if self is a success code, otherwise returns HRESULT converted to Result<T>.

pub unsafe fn from_abi<T: Abi>(self, abi: T::Abi) -> Result<T>[src]

If the Result is Ok converts the T::Abi into T.

pub fn from_thread() -> Self[src]

Retrieves the error code stored on the calling thread.

pub fn from_win32(error: u32) -> Self[src]

Creates a failure code with the provided win32 error code.

This is equivalent to HRESULT_FROM_WIN32.

pub fn message(&self) -> String[src]

The error message describing the error.

Trait Implementations

impl Abi for HRESULT[src]

type Abi = Self

The abi representation of the implementing type. Read more

fn abi(&self) -> Self::Abi[src]

Casts the Rust object to its ABI type without copying the object.

fn set_abi(&mut self) -> *mut Self::Abi[src]

Returns a pointer for setting the object’s value via an ABI call.

unsafe fn from_abi(abi: Self::Abi) -> Result<Self>[src]

Casts the ABI representation to a Rust object by taking ownership of the bits.

fn drop_param(_: &mut Param<'_, Self>)[src]

impl Clone for HRESULT[src]

fn clone(&self) -> HRESULT[src]

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl Debug for HRESULT[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Default for HRESULT[src]

fn default() -> HRESULT[src]

Returns the “default value” for a type. Read more

impl From<Error> for HRESULT[src]

fn from(error: Error) -> Self[src]

Performs the conversion.

impl From<HRESULT> for Error[src]

fn from(code: HRESULT) -> Self[src]

Performs the conversion.

impl<T> From<Result<T, Error>> for HRESULT[src]

fn from(result: Result<T>) -> Self[src]

Performs the conversion.

impl PartialEq<HRESULT> for HRESULT[src]

fn eq(&self, other: &HRESULT) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &HRESULT) -> bool[src]

This method tests for !=.

impl Copy for HRESULT[src]

impl StructuralPartialEq for HRESULT[src]

Auto Trait Implementations

impl RefUnwindSafe for HRESULT

impl Send for HRESULT

impl Sync for HRESULT

impl Unpin for HRESULT

impl UnwindSafe for HRESULT

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

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

recently added

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

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

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]

Performs the conversion.

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

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

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.