Skip to content
This repository has been archived by the owner on Oct 26, 2023. It is now read-only.

Commit

Permalink
Update inheritance chain name (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
cwfitzgerald authored Jul 19, 2023
1 parent ed65d78 commit 1ef38ea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/com.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,13 @@ impl<T: Interface> Hash for ComPtr<T> {
/// - the unwrap function (`&self -> ComPtr<actual::ComObject1>` panicing on failure to cast)
///
/// ```rust
/// # pub use d3d12::weak_com_inheritance_chain;
/// # pub use d3d12::com_inheritance_chain;
/// # mod actual {
/// # pub struct ComObject; impl winapi::Interface for ComObject { fn uuidof() -> winapi::shared::guiddef::GUID { todo!() } }
/// # pub struct ComObject1; impl winapi::Interface for ComObject1 { fn uuidof() -> winapi::shared::guiddef::GUID { todo!() } }
/// # pub struct ComObject2; impl winapi::Interface for ComObject2 { fn uuidof() -> winapi::shared::guiddef::GUID { todo!() } }
/// # }
/// weak_com_inheritance_chain! {
/// com_inheritance_chain! {
/// pub enum MyComObject {
/// MyComObject(actual::ComObject), from_my_com_object, as_my_com_object, my_com_object; // First variant doesn't use "unwrap" as it can never fail
/// MyComObject1(actual::ComObject1), from_my_com_object1, as_my_com_object1, unwrap_my_com_object1;
Expand All @@ -186,7 +186,7 @@ impl<T: Interface> Hash for ComPtr<T> {
/// }
/// ```
#[macro_export]
macro_rules! weak_com_inheritance_chain {
macro_rules! com_inheritance_chain {
// We first match a human readable enum style, before going into the recursive section.
//
// Internal calls to the macro have either the prefix
Expand All @@ -207,7 +207,7 @@ macro_rules! weak_com_inheritance_chain {
),+
}
impl $name {
$crate::weak_com_inheritance_chain! {
$crate::com_inheritance_chain! {
@recursion_logic,
$vis,
;
Expand Down Expand Up @@ -235,7 +235,7 @@ macro_rules! weak_com_inheritance_chain {
$($next_variant:ident($next_type:ty), $next_from_name:ident, $next_as_name:ident, $next_unwrap_name:ident);*
) => {
// Actually generate the members for this variant. Needs the previous and future variant names.
$crate::weak_com_inheritance_chain! {
$crate::com_inheritance_chain! {
@render_members,
$vis,
$this_from_name, $this_as_name, $this_unwrap_name;
Expand All @@ -245,7 +245,7 @@ macro_rules! weak_com_inheritance_chain {
}

// Recurse on ourselves. If there is no future variants left, we'll hit the base case as the final expansion returns no tokens.
$crate::weak_com_inheritance_chain! {
$crate::com_inheritance_chain! {
@recursion_logic,
$vis,
$($prev_variant),* , $this_variant;
Expand Down
6 changes: 3 additions & 3 deletions src/dxgi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub type Adapter1 = ComPtr<dxgi::IDXGIAdapter1>;
pub type Adapter2 = ComPtr<dxgi1_2::IDXGIAdapter2>;
pub type Adapter3 = ComPtr<dxgi1_4::IDXGIAdapter3>;
pub type Adapter4 = ComPtr<dxgi1_6::IDXGIAdapter4>;
crate::weak_com_inheritance_chain! {
crate::com_inheritance_chain! {
#[derive(Debug, Clone, PartialEq, Hash)]
pub enum DxgiAdapter {
Adapter1(dxgi::IDXGIAdapter1), from_adapter1, as_adapter1, adapter1;
Expand All @@ -65,7 +65,7 @@ pub type Factory3 = ComPtr<dxgi1_3::IDXGIFactory3>;
pub type Factory4 = ComPtr<dxgi1_4::IDXGIFactory4>;
pub type Factory5 = ComPtr<dxgi1_5::IDXGIFactory5>;
pub type Factory6 = ComPtr<dxgi1_6::IDXGIFactory6>;
crate::weak_com_inheritance_chain! {
crate::com_inheritance_chain! {
#[derive(Debug, Clone, PartialEq, Hash)]
pub enum DxgiFactory {
Factory1(dxgi::IDXGIFactory1), from_factory1, as_factory1, factory1;
Expand All @@ -83,7 +83,7 @@ pub type SwapChain = ComPtr<dxgi::IDXGISwapChain>;
pub type SwapChain1 = ComPtr<dxgi1_2::IDXGISwapChain1>;
pub type SwapChain2 = ComPtr<dxgi1_3::IDXGISwapChain2>;
pub type SwapChain3 = ComPtr<dxgi1_4::IDXGISwapChain3>;
crate::weak_com_inheritance_chain! {
crate::com_inheritance_chain! {
#[derive(Debug, Clone, PartialEq, Hash)]
pub enum DxgiSwapchain {
SwapChain(dxgi::IDXGISwapChain), from_swap_chain, as_swap_chain, swap_chain;
Expand Down

0 comments on commit 1ef38ea

Please sign in to comment.