Skip to content

Commit fa4c8e8

Browse files
kpreidcwfitzgerald
authored andcommitted
Make links from wgpu-types to wgpu work in docs.rs.
As a bonus, the macro now allows defining such links while writing the item name only once instead of twice.
1 parent 803e48c commit fa4c8e8

File tree

4 files changed

+125
-64
lines changed

4 files changed

+125
-64
lines changed

wgpu-types/src/features.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::VertexFormat;
1+
use crate::{link_to_wgpu_docs, link_to_wgpu_item, VertexFormat};
22
#[cfg(feature = "serde")]
33
use alloc::fmt;
44
use alloc::vec::Vec;
@@ -800,10 +800,10 @@ bitflags_array! {
800800
///
801801
/// This is a native only feature.
802802
///
803-
/// [`RenderPass::multi_draw_indirect`]: ../wgpu/struct.RenderPass.html#method.multi_draw_indirect
804-
/// [`RenderPass::multi_draw_indexed_indirect`]: ../wgpu/struct.RenderPass.html#method.multi_draw_indexed_indirect
805-
/// [`RenderPass::multi_draw_indirect_count`]: ../wgpu/struct.RenderPass.html#method.multi_draw_indirect_count
806-
/// [`RenderPass::multi_draw_indexed_indirect_count`]: ../wgpu/struct.RenderPass.html#method.multi_draw_indexed_indirect_count
803+
#[doc = link_to_wgpu_docs!(["`RenderPass::multi_draw_indirect`"]: "struct.RenderPass.html#method.multi_draw_indirect")]
804+
#[doc = link_to_wgpu_docs!(["`RenderPass::multi_draw_indexed_indirect`"]: "struct.RenderPass.html#method.multi_draw_indexed_indirect")]
805+
#[doc = link_to_wgpu_docs!(["`RenderPass::multi_draw_indirect_count`"]: "struct.RenderPass.html#method.multi_draw_indirect_count")]
806+
#[doc = link_to_wgpu_docs!(["`RenderPass::multi_draw_indexed_indirect_count`"]: "struct.RenderPass.html#method.multi_draw_indexed_indirect_count")]
807807
const MULTI_DRAW_INDIRECT_COUNT = 1 << 15;
808808
/// Allows the use of push constants: small, fast bits of memory that can be updated
809809
/// inside a [`RenderPass`].
@@ -828,9 +828,9 @@ bitflags_array! {
828828
///
829829
/// This is a native only feature.
830830
///
831-
/// [`RenderPass`]: ../wgpu/struct.RenderPass.html
832-
/// [`PipelineLayoutDescriptor`]: ../wgpu/struct.PipelineLayoutDescriptor.html
833-
/// [`RenderPass::set_push_constants`]: ../wgpu/struct.RenderPass.html#method.set_push_constants
831+
#[doc = link_to_wgpu_item!(struct RenderPass)]
832+
#[doc = link_to_wgpu_item!(struct PipelineLayoutDescriptor)]
833+
#[doc = link_to_wgpu_docs!(["`RenderPass::set_push_constants`"]: "struct.RenderPass.html#method.set_push_constants")]
834834
/// [`Limits::max_push_constant_size`]: super::Limits
835835
const PUSH_CONSTANTS = 1 << 16;
836836
/// Allows the use of [`AddressMode::ClampToBorder`] with a border color

wgpu-types/src/instance.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use alloc::string::String;
44

5-
use crate::Backends;
5+
use crate::{link_to_wgpu_docs, Backends};
66

77
#[cfg(doc)]
88
use crate::{Backend, DownlevelFlags};
@@ -165,7 +165,7 @@ bitflags::bitflags! {
165165
/// can be a hassle to do manually. When this is enabled, the timestamp period returned by the queue
166166
/// will always be `1.0`.
167167
///
168-
/// [rqs]: ../wgpu/struct.CommandEncoder.html#method.resolve_query_set
168+
#[doc = link_to_wgpu_docs!(["rqs"]: "struct.CommandEncoder.html#method.resolve_query_set")]
169169
const AUTOMATIC_TIMESTAMP_NORMALIZATION = 1 << 6;
170170
}
171171
}
@@ -461,7 +461,7 @@ pub enum Dx12SwapchainKind {
461461
/// This supports transparent windows, but does not have support from RenderDoc.
462462
///
463463
/// [`IDCompositionVisual`]: https://learn.microsoft.com/en-us/windows/win32/api/dcomp/nn-dcomp-idcompositionvisual
464-
/// [CV]: ../wgpu/struct.SurfaceTargetUnsafe.html#variant.CompositionVisual
464+
#[doc = link_to_wgpu_docs!(["CV"]: "struct.SurfaceTargetUnsafe.html#variant.CompositionVisual")]
465465
DxgiFromVisual,
466466
}
467467

0 commit comments

Comments
 (0)