Skip to content

Commit 35ff237

Browse files
authored
Merge pull request #1078 from AaronErhardt/master
Update gir: Use docsrs attribute
2 parents 4a6b26b + b4aac68 commit 35ff237

File tree

172 files changed

+2857
-2687
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+2857
-2687
lines changed

.github/workflows/docs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
0.16=0.16
1919
0.15=0.15
2020
0.14=0.14
21+
RUSTFLAGS: --cfg docsrs
2122
steps:
2223
- uses: actions/checkout@v3
2324
with:
@@ -37,7 +38,7 @@ jobs:
3738
- uses: actions-rs/cargo@v1
3839
with:
3940
command: doc
40-
args: -p cairo-rs -p cairo-sys-rs -p gdk-pixbuf -p gdk-pixbuf-sys -p gio -p gio-sys -p glib -p gobject-sys -p glib-sys -p glib-macros -p glib-build-tools -p graphene-rs -p graphene-sys -p pango -p pango-sys -p pangocairo -p pangocairo-sys --features dox --no-deps
41+
args: -p cairo-rs -p cairo-sys-rs -p gdk-pixbuf -p gdk-pixbuf-sys -p gio -p gio-sys -p glib -p gobject-sys -p glib-sys -p glib-macros -p glib-build-tools -p graphene-rs -p graphene-sys -p pango -p pango-sys -p pangocairo -p pangocairo-sys --no-deps --all-features
4142
- run: echo "RELEASE=$(echo '${{ github.event.release.tag_name }}' | grep -Po '(\d+)\.(\d+)')" >> ${GITHUB_ENV}
4243
- run: echo "DEST=$(if [ "$GITHUB_EVENT_NAME" == "release" ]; then echo 'stable/${{ env.RELEASE }}'; else echo 'git'; fi)" >> ${GITHUB_ENV}
4344
- name: Grab gtk-rs LOGO

cairo/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@ freetype = ["ffi/freetype", "freetype-rs"]
2828
script = ["ffi/script"]
2929
xcb = ["ffi/xcb"]
3030
xlib = ["ffi/xlib"]
31-
dox = ["ffi/dox", "glib/dox", "freetype"]
3231
win32-surface = ["ffi/win32-surface"]
3332

3433
[package.metadata.docs.rs]
35-
features = ["dox"]
34+
rustdoc-args = ["--cfg", "docsrs"]
3635

3736
[dependencies.glib]
3837
optional = true

cairo/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ Currently, the minimum supported Rust version is `1.64.0`.
3131
* [Rust API - Development](https://gtk-rs.org/gtk-rs-core/git/docs/cairo)
3232
* [C API](https://www.cairographics.org/documentation/)
3333

34-
## Documentation features
35-
36-
* **dox** - Used to keep system dependent items in documentation
37-
3834
## X Window features
3935

4036
* **xcb** - X Window System rendering using the XCB library
@@ -44,6 +40,10 @@ Currently, the minimum supported Rust version is `1.64.0`.
4440

4541
* **win32-surface** - Microsoft Windows surface support
4642

43+
## Documentation rustdoc attributes
44+
45+
* **docsrs** - Used to keep system dependent items in documentation
46+
4747
## Using
4848

4949
We recommend using [crates from crates.io](https://crates.io/keywords/gtk-rs),

cairo/src/constants.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,26 @@ pub const MIME_TYPE_UNIQUE_ID: &str = "application/x-cairo.uuid";
88
pub const MIME_TYPE_JBIG2: &str = "application/x-cairo.jbig2";
99
pub const MIME_TYPE_JBIG2_GLOBAL: &str = "application/x-cairo.jbig2-global";
1010
pub const MIME_TYPE_JBIG2_GLOBAL_ID: &str = "application/x-cairo.jbig2-global-id";
11-
#[cfg(any(feature = "v1_16", feature = "dox"))]
11+
#[cfg(feature = "v1_16")]
12+
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
1213
pub const MIME_TYPE_CCITT_FAX: &str = "image/g3fax";
13-
#[cfg(any(feature = "v1_16", feature = "dox"))]
14+
#[cfg(feature = "v1_16")]
15+
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
1416
pub const MIME_TYPE_CCITT_FAX_PARAMS: &str = "application/x-cairo.ccitt.params";
15-
#[cfg(any(feature = "v1_16", feature = "dox"))]
17+
#[cfg(feature = "v1_16")]
18+
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
1619
pub const MIME_TYPE_EPS: &str = "application/postscript";
17-
#[cfg(any(feature = "v1_16", feature = "dox"))]
20+
#[cfg(feature = "v1_16")]
21+
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
1822
pub const MIME_TYPE_EPS_PARAMS: &str = "application/x-cairo.eps.params";
1923

20-
#[cfg(any(feature = "v1_16", feature = "dox"))]
24+
#[cfg(feature = "v1_16")]
25+
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
2126
pub const PDF_OUTLINE_ROOT: i32 = 0;
2227

23-
#[cfg(any(feature = "v1_16", feature = "dox"))]
28+
#[cfg(feature = "v1_16")]
29+
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
2430
pub const CAIRO_TAG_DEST: &str = "cairo.dest";
25-
#[cfg(any(feature = "v1_16", feature = "dox"))]
31+
#[cfg(feature = "v1_16")]
32+
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
2633
pub const CAIRO_TAG_LINK: &str = "Link";

cairo/src/context.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ impl fmt::Display for RectangleList {
6464
pub struct Context(ptr::NonNull<cairo_t>);
6565

6666
#[cfg(feature = "use_glib")]
67+
#[cfg_attr(docsrs, doc(cfg(feature = "use_glib")))]
6768
impl IntoGlibPtr<*mut ffi::cairo_t> for Context {
6869
#[inline]
6970
unsafe fn into_glib_ptr(self) -> *mut ffi::cairo_t {
@@ -72,6 +73,7 @@ impl IntoGlibPtr<*mut ffi::cairo_t> for Context {
7273
}
7374

7475
#[cfg(feature = "use_glib")]
76+
#[cfg_attr(docsrs, doc(cfg(feature = "use_glib")))]
7577
impl<'a> ToGlibPtr<'a, *mut ffi::cairo_t> for &'a Context {
7678
type Storage = PhantomData<&'a Context>;
7779

@@ -87,6 +89,7 @@ impl<'a> ToGlibPtr<'a, *mut ffi::cairo_t> for &'a Context {
8789
}
8890

8991
#[cfg(feature = "use_glib")]
92+
#[cfg_attr(docsrs, doc(cfg(feature = "use_glib")))]
9093
impl FromGlibPtrNone<*mut ffi::cairo_t> for Context {
9194
#[inline]
9295
unsafe fn from_glib_none(ptr: *mut ffi::cairo_t) -> Context {
@@ -95,6 +98,7 @@ impl FromGlibPtrNone<*mut ffi::cairo_t> for Context {
9598
}
9699

97100
#[cfg(feature = "use_glib")]
101+
#[cfg_attr(docsrs, doc(cfg(feature = "use_glib")))]
98102
impl FromGlibPtrBorrow<*mut ffi::cairo_t> for Context {
99103
#[inline]
100104
unsafe fn from_glib_borrow(ptr: *mut ffi::cairo_t) -> crate::Borrowed<Context> {
@@ -103,6 +107,7 @@ impl FromGlibPtrBorrow<*mut ffi::cairo_t> for Context {
103107
}
104108

105109
#[cfg(feature = "use_glib")]
110+
#[cfg_attr(docsrs, doc(cfg(feature = "use_glib")))]
106111
impl FromGlibPtrFull<*mut ffi::cairo_t> for Context {
107112
#[inline]
108113
unsafe fn from_glib_full(ptr: *mut ffi::cairo_t) -> Context {
@@ -358,13 +363,15 @@ impl Context {
358363
unsafe { ffi::cairo_get_line_width(self.0.as_ptr()) }
359364
}
360365

361-
#[cfg(any(feature = "v1_18", feature = "dox"))]
366+
#[cfg(feature = "v1_18")]
367+
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
362368
#[doc(alias = "cairo_set_hairline")]
363369
pub fn set_hairline(&self, set_hairline: bool) {
364370
unsafe { ffi::cairo_set_hairline(self.0.as_ptr(), set_hairline.into()) }
365371
}
366372

367-
#[cfg(any(feature = "v1_18", feature = "dox"))]
373+
#[cfg(feature = "v1_18")]
374+
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
368375
#[doc(alias = "get_hairline")]
369376
#[doc(alias = "cairo_get_hairline")]
370377
pub fn hairline(&self) -> bool {
@@ -926,7 +933,8 @@ impl Context {
926933
self.status().map(|_| (x1, y1, x2, y2))
927934
}
928935

929-
#[cfg(any(feature = "v1_16", feature = "dox"))]
936+
#[cfg(feature = "v1_16")]
937+
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
930938
#[doc(alias = "cairo_tag_begin")]
931939
pub fn tag_begin(&self, tag_name: &str, attributes: &str) {
932940
unsafe {
@@ -936,7 +944,8 @@ impl Context {
936944
}
937945
}
938946

939-
#[cfg(any(feature = "v1_16", feature = "dox"))]
947+
#[cfg(feature = "v1_16")]
948+
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
940949
#[doc(alias = "cairo_tag_end")]
941950
pub fn tag_end(&self, tag_name: &str) {
942951
unsafe {

cairo/src/device.rs

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
// Take a look at the license at the top of the repository in the LICENSE file.
22

3-
#[cfg(any(feature = "script", feature = "dox"))]
3+
#[cfg(feature = "script")]
44
use std::ffi::CString;
55
#[cfg(feature = "use_glib")]
66
use std::marker::PhantomData;
7-
#[cfg(any(feature = "script", feature = "dox"))]
7+
#[cfg(feature = "script")]
88
use std::path::Path;
99
use std::{fmt, ptr};
1010

1111
#[cfg(feature = "use_glib")]
1212
use glib::translate::*;
1313

1414
use crate::{utils::status_to_result, DeviceType, Error};
15-
#[cfg(any(feature = "script", feature = "dox"))]
15+
#[cfg(feature = "script")]
1616
use crate::{Content, RecordingSurface, ScriptMode, Surface};
1717

1818
#[derive(Debug)]
@@ -56,7 +56,8 @@ impl Device {
5656
self.0.as_ptr()
5757
}
5858

59-
#[cfg(any(feature = "script", feature = "dox"))]
59+
#[cfg(feature = "script")]
60+
#[cfg_attr(docsrs, doc(cfg(feature = "script")))]
6061
#[doc(alias = "cairo_script_create")]
6162
pub fn create<P: AsRef<Path>>(filename: P) -> Option<Device> {
6263
unsafe {
@@ -71,7 +72,8 @@ impl Device {
7172
}
7273
}
7374

74-
#[cfg(any(feature = "script", feature = "dox"))]
75+
#[cfg(feature = "script")]
76+
#[cfg_attr(docsrs, doc(cfg(feature = "script")))]
7577
#[doc(alias = "cairo_script_from_recording_surface")]
7678
pub fn from_recording_surface(&self, surface: &RecordingSurface) -> Result<(), Error> {
7779
unsafe {
@@ -81,20 +83,23 @@ impl Device {
8183
}
8284
}
8385

84-
#[cfg(any(feature = "script", feature = "dox"))]
86+
#[cfg(feature = "script")]
87+
#[cfg_attr(docsrs, doc(cfg(feature = "script")))]
8588
#[doc(alias = "cairo_script_get_mode")]
8689
#[doc(alias = "get_mode")]
8790
pub fn mode(&self) -> ScriptMode {
8891
unsafe { ScriptMode::from(ffi::cairo_script_get_mode(self.to_raw_none())) }
8992
}
9093

91-
#[cfg(any(feature = "script", feature = "dox"))]
94+
#[cfg(feature = "script")]
95+
#[cfg_attr(docsrs, doc(cfg(feature = "script")))]
9296
#[doc(alias = "cairo_script_set_mode")]
9397
pub fn set_mode(&self, mode: ScriptMode) {
9498
unsafe { ffi::cairo_script_set_mode(self.to_raw_none(), mode.into()) }
9599
}
96100

97-
#[cfg(any(feature = "script", feature = "dox"))]
101+
#[cfg(feature = "script")]
102+
#[cfg_attr(docsrs, doc(cfg(feature = "script")))]
98103
#[doc(alias = "cairo_script_surface_create")]
99104
pub fn surface_create(
100105
&self,
@@ -112,7 +117,8 @@ impl Device {
112117
}
113118
}
114119

115-
#[cfg(any(feature = "script", feature = "dox"))]
120+
#[cfg(feature = "script")]
121+
#[cfg_attr(docsrs, doc(cfg(feature = "script")))]
116122
#[doc(alias = "cairo_script_surface_create_for_target")]
117123
pub fn surface_create_for_target(&self, target: impl AsRef<Surface>) -> Result<Surface, Error> {
118124
let target = target.as_ref();
@@ -125,7 +131,8 @@ impl Device {
125131
}
126132
}
127133

128-
#[cfg(any(feature = "script", feature = "dox"))]
134+
#[cfg(feature = "script")]
135+
#[cfg_attr(docsrs, doc(cfg(feature = "script")))]
129136
#[doc(alias = "cairo_script_write_comment")]
130137
pub fn write_comment(&self, comment: &str) {
131138
unsafe {
@@ -195,7 +202,8 @@ impl Device {
195202
unsafe { ffi::cairo_device_observer_stroke_elapsed(self.to_raw_none()) }
196203
}
197204

198-
#[cfg(any(feature = "xlib", feature = "xcb", feature = "dox"))]
205+
#[cfg(any(feature = "xlib", feature = "xcb"))]
206+
#[cfg_attr(docsrs, doc(cfg(any(feature = "xlib", feature = "xcb"))))]
199207
#[doc(alias = "cairo_xlib_device_debug_cap_xrender_version")]
200208
#[doc(alias = "cairo_xcb_device_debug_cap_xrender_version")]
201209
pub fn debug_cap_xrender_version(&self, _major_version: i32, _minor_version: i32) {
@@ -232,7 +240,8 @@ impl Device {
232240
}
233241
}
234242

235-
#[cfg(any(feature = "xlib", feature = "xcb", feature = "dox"))]
243+
#[cfg(any(feature = "xlib", feature = "xcb"))]
244+
#[cfg_attr(docsrs, doc(cfg(any(feature = "xlib", feature = "xcb"))))]
236245
#[doc(alias = "cairo_xlib_device_debug_get_precision")]
237246
#[doc(alias = "cairo_xcb_device_debug_get_precision")]
238247
pub fn debug_get_precision(&self) -> i32 {
@@ -261,7 +270,8 @@ impl Device {
261270
}
262271
}
263272

264-
#[cfg(any(feature = "xlib", feature = "xcb", feature = "dox"))]
273+
#[cfg(any(feature = "xlib", feature = "xcb"))]
274+
#[cfg_attr(docsrs, doc(cfg(any(feature = "xlib", feature = "xcb"))))]
265275
#[doc(alias = "cairo_xlib_device_debug_set_precision")]
266276
#[doc(alias = "cairo_xcb_device_debug_set_precision")]
267277
pub fn debug_set_precision(&self, _precision: i32) {
@@ -304,6 +314,7 @@ impl Device {
304314
}
305315

306316
#[cfg(feature = "use_glib")]
317+
#[cfg_attr(docsrs, doc(cfg(feature = "use_glib")))]
307318
impl IntoGlibPtr<*mut ffi::cairo_device_t> for Device {
308319
#[inline]
309320
unsafe fn into_glib_ptr(self) -> *mut ffi::cairo_device_t {
@@ -312,6 +323,7 @@ impl IntoGlibPtr<*mut ffi::cairo_device_t> for Device {
312323
}
313324

314325
#[cfg(feature = "use_glib")]
326+
#[cfg_attr(docsrs, doc(cfg(feature = "use_glib")))]
315327
impl<'a> ToGlibPtr<'a, *mut ffi::cairo_device_t> for Device {
316328
type Storage = PhantomData<&'a Device>;
317329

@@ -327,6 +339,7 @@ impl<'a> ToGlibPtr<'a, *mut ffi::cairo_device_t> for Device {
327339
}
328340

329341
#[cfg(feature = "use_glib")]
342+
#[cfg_attr(docsrs, doc(cfg(feature = "use_glib")))]
330343
impl FromGlibPtrNone<*mut ffi::cairo_device_t> for Device {
331344
#[inline]
332345
unsafe fn from_glib_none(ptr: *mut ffi::cairo_device_t) -> Device {
@@ -335,6 +348,7 @@ impl FromGlibPtrNone<*mut ffi::cairo_device_t> for Device {
335348
}
336349

337350
#[cfg(feature = "use_glib")]
351+
#[cfg_attr(docsrs, doc(cfg(feature = "use_glib")))]
338352
impl FromGlibPtrBorrow<*mut ffi::cairo_device_t> for Device {
339353
#[inline]
340354
unsafe fn from_glib_borrow(ptr: *mut ffi::cairo_device_t) -> crate::Borrowed<Device> {
@@ -343,6 +357,7 @@ impl FromGlibPtrBorrow<*mut ffi::cairo_device_t> for Device {
343357
}
344358

345359
#[cfg(feature = "use_glib")]
360+
#[cfg_attr(docsrs, doc(cfg(feature = "use_glib")))]
346361
impl FromGlibPtrFull<*mut ffi::cairo_device_t> for Device {
347362
#[inline]
348363
unsafe fn from_glib_full(ptr: *mut ffi::cairo_device_t) -> Device {

0 commit comments

Comments
 (0)