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
82
83
84
85
#![allow(non_camel_case_types, non_snake_case)]
use crate::decl::*;
use crate::dxgi::{iterators::*, vts::*};
use crate::kernel::privs::*;
use crate::macros::*;
use crate::ole::privs::*;
use crate::prelude::*;
com_interface! { IDXGIAdapter: "2411e7e1-12ac-4ccf-bd14-9798e8534dc0";
/// [`IDXGIAdapter`](https://learn.microsoft.com/en-us/windows/win32/api/dxgi/nn-dxgi-idxgiadapter)
/// 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 dxgi_IDXGIObject for IDXGIAdapter {}
impl dxgi_IDXGIAdapter for IDXGIAdapter {}
/// This trait is enabled with the `dxgi` feature, and provides methods for
/// [`IDXGIAdapter`](crate::IDXGIAdapter).
///
/// Prefer importing this trait through the prelude:
///
/// ```no_run
/// use winsafe::prelude::*;
/// ```
pub trait dxgi_IDXGIAdapter: dxgi_IDXGIObject {
/// [`IDXGIAdapter::CheckInterfaceSupport`](https://learn.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiadapter-checkinterfacesupport)
/// method.
#[must_use]
fn CheckInterfaceSupport(&self, interface_name: &GUID) -> HrResult<i64> {
let mut umd_ver = 0i64;
HrRet(unsafe {
(vt::<IDXGIAdapterVT>(self).CheckInterfaceSupport)(
self.ptr(),
pcvoid(interface_name),
&mut umd_ver,
)
})
.to_hrresult()
.map(|_| umd_ver)
}
/// [`IDXGIAdapter::EnumOutputs`](https://learn.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiadapter-enumoutputs)
/// method.
///
/// Returns an iterator over [`IDXGIOutput`](crate::IDXGIOutput) elements.
///
/// # Examples
///
/// ```no_run
/// use winsafe::{self as w, prelude::*};
///
/// let adapter: w::IDXGIAdapter; // initialized somewhere
/// # let adapter = unsafe { w::IDXGIAdapter::null() };
///
/// for output in adapter.EnumOutputs() {
/// let output = output?;
/// // ...
/// }
///
/// // Collecting into a Vec
/// let outputs: Vec<w::IDXGIOutput> =
/// adapter.EnumOutputs()
/// .collect::<w::HrResult<Vec<_>>>()?;
/// # w::HrResult::Ok(())
/// ```
#[must_use]
fn EnumOutputs(&self) -> impl Iterator<Item = HrResult<IDXGIOutput>> + '_ {
IdxgiadapterEnumoutputsIter::new(self)
}
/// [`IDXGIAdapter::GetDesc`](https://learn.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiadapter-getdesc)
/// method.
#[must_use]
fn GetDesc(&self) -> HrResult<DXGI_ADAPTER_DESC> {
let mut desc = DXGI_ADAPTER_DESC::default();
HrRet(unsafe { (vt::<IDXGIAdapterVT>(self).GetDesc)(self.ptr(), pvoid(&mut desc)) })
.to_hrresult()
.map(|_| desc)
}
}