1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#![allow(non_camel_case_types, non_snake_case)]
use std::mem::ManuallyDrop;
use crate::co;
use crate::decl::*;
use crate::mf::vts::*;
use crate::ole::privs::*;
use crate::prelude::*;
com_interface! { IMFAsyncResult: "ac6b7889-0740-4d51-8619-905994a55cc6";
/// [`IMFAsyncResult`](https://learn.microsoft.com/en-us/windows/win32/api/mfobjects/nn-mfobjects-imfasyncresult)
/// COM interface.
///
/// Automatically calls
/// [`Release`](https://learn.microsoft.com/en-us/windows/win32/api/unknwn/nf-unknwn-iunknown-release)
/// when the object goes out of scope.
}
impl mf_IMFAsyncResult for IMFAsyncResult {}
/// This trait is enabled with the `mf` feature, and provides methods for
/// [`IMFAsyncResult`](crate::IMFAsyncResult).
///
/// Prefer importing this trait through the prelude:
///
/// ```no_run
/// use winsafe::prelude::*;
/// ```
pub trait mf_IMFAsyncResult: ole_IUnknown {
/// [`IMFAsyncResult::GetObject`](https://learn.microsoft.com/en-us/windows/win32/api/mfobjects/nf-mfobjects-imfasyncresult-getobject)
/// method.
#[must_use]
fn GetObject<T>(&self) -> HrResult<T>
where
T: ole_IUnknown,
{
let mut queried = unsafe { T::null() };
HrRet(unsafe { (vt::<IMFAsyncResultVT>(self).GetObject)(self.ptr(), queried.as_mut()) })
.to_hrresult()
.map(|_| queried)
}
/// [`IMFAsyncResult::GetState`](https://learn.microsoft.com/en-us/windows/win32/api/mfobjects/nf-mfobjects-imfasyncresult-getstate)
/// method.
#[must_use]
fn GetState<T>(&self) -> HrResult<T>
where
T: ole_IUnknown,
{
let mut queried = unsafe { T::null() };
HrRet(unsafe { (vt::<IMFAsyncResultVT>(self).GetState)(self.ptr(), queried.as_mut()) })
.to_hrresult()
.map(|_| queried)
}
/// [`IMFAsyncResult::GetStateNoAddRef`](https://learn.microsoft.com/en-us/windows/win32/api/mfobjects/nf-mfobjects-imfasyncresult-getstatenoaddref)
/// method.
#[must_use]
fn GetStateNoAddRef<T>(&self) -> Option<ManuallyDrop<T>>
where
T: ole_IUnknown,
{
let ptr = unsafe { (vt::<IMFAsyncResultVT>(self).GetStateNoAddRef)(self.ptr()) };
if ptr.is_null() { None } else { Some(ManuallyDrop::new(unsafe { T::from_ptr(ptr) })) }
}
/// [`IMFAsyncResult::GetStatus`](https://learn.microsoft.com/en-us/windows/win32/api/mfobjects/nf-mfobjects-imfasyncresult-getstatus)
/// method.
#[must_use]
fn GetStatus(&self) -> co::HRESULT {
unsafe { co::HRESULT::from_raw((vt::<IMFAsyncResultVT>(self).GetStatus)(self.ptr())) }
}
/// [`IMFAsyncResult::SetStatus`](https://learn.microsoft.com/en-us/windows/win32/api/mfobjects/nf-mfobjects-imfasyncresult-setstatus)
/// method.
fn SetStatus(&self, status: co::HRESULT) -> HrResult<()> {
HrRet(unsafe { (vt::<IMFAsyncResultVT>(self).SetStatus)(self.ptr(), status.raw()) })
.to_hrresult()
}
}