Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update gir: Use docsrs attribute #1369

Merged
merged 1 commit into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
0.5=0.5
0.4=0.4
0.3=0.3
RUSTFLAGS: --cfg docsrs
steps:
- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -77,7 +78,7 @@ jobs:
-p gsk4 -p gsk4-sys
-p gtk4 -p gtk4-sys
-p gtk4-macros
--features "dox" --no-deps
--no-deps

- name: Fix broken URLs
run: |
Expand Down
3 changes: 1 addition & 2 deletions gdk4-wayland/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ rust-version = "1.64"
[features]
v4_4 = ["ffi/v4_4"]
v4_10 = ["ffi/v4_10", "v4_4"]
dox = ["ffi/dox", "gdk/dox", "gio/dox", "glib/dox", "xkb_crate", "wayland_crate", "egl"]
wayland_crate = ["wayland-client", "wayland-backend"]
egl = ["khronos-egl"]
xkb_crate = ["xkb"]

[package.metadata.docs.rs]
features = ["dox"]
rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
ffi = {path = "./sys", package = "gdk4-wayland-sys", version = "0.7"}
Expand Down
2 changes: 1 addition & 1 deletion gdk4-wayland/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 2358cc24efd2)
Generated by gir (https://github.com/gtk-rs/gir @ 8a280cee2cbb)
from gir-files (https://github.com/gtk-rs/gir-files @ 1254daed0202)
17 changes: 7 additions & 10 deletions gdk4-wayland/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
// Take a look at the license at the top of the repository in the LICENSE file.

#![doc = include_str!("../README.md")]
#![cfg_attr(feature = "dox", feature(doc_cfg))]
#![cfg_attr(docsrs, feature(doc_cfg))]

pub use ffi;
pub use gdk;
pub use gio;
pub use glib;
#[cfg(any(feature = "wayland_crate", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "wayland_crate")))]
#[cfg(any(feature = "wayland_crate", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
pub use wayland_client;

#[cfg(any(all(feature = "v4_4", feature = "egl"), feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(all(feature = "v4_4", feature = "egl"))))]
#[cfg(any(all(feature = "v4_4", feature = "egl"), docsrs))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "egl"))))]
pub use khronos_egl;

#[cfg(any(all(feature = "v4_4", feature = "xkb_crate"), feature = "dox"))]
#[cfg_attr(
feature = "dox",
doc(cfg(all(feature = "v4_4", feature = "xkb_crate")))
)]
#[cfg(any(all(feature = "v4_4", feature = "xkb_crate"), docsrs))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "xkb_crate"))))]
pub use xkb;

mod auto;
Expand Down
38 changes: 16 additions & 22 deletions gdk4-wayland/src/wayland_device.rs
Original file line number Diff line number Diff line change
@@ -1,36 +1,33 @@
// Take a look at the license at the top of the repository in the LICENSE file.

#[cfg(any(feature = "wayland_crate", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "wayland_crate")))]
#[cfg(any(feature = "wayland_crate", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
use crate::prelude::*;
use crate::WaylandDevice;
#[cfg(any(feature = "wayland_crate", feature = "dox", feature = "xkb_crate"))]
#[cfg(any(feature = "wayland_crate", docsrs, feature = "xkb_crate"))]
#[cfg_attr(
feature = "dox",
docsrs,
doc(cfg(any(feature = "wayland_crate", feature = "xkb_crate")))
)]
use glib::translate::*;

#[cfg(any(feature = "wayland_crate", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "wayland_crate")))]
#[cfg(any(feature = "wayland_crate", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
use wayland_client::{
backend::ObjectId,
protocol::{wl_keyboard::WlKeyboard, wl_pointer::WlPointer, wl_seat::WlSeat},
Proxy,
};

#[cfg(any(all(feature = "v4_4", feature = "xkb_crate"), feature = "dox"))]
#[cfg_attr(
feature = "dox",
doc(cfg(all(feature = "v4_4", feature = "xkb_crate")))
)]
#[cfg(any(all(feature = "v4_4", feature = "xkb_crate"), docsrs))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "xkb_crate"))))]
use xkb::Keymap;

impl WaylandDevice {
#[doc(alias = "gdk_wayland_device_get_wl_keyboard")]
#[doc(alias = "get_wl_keyboard")]
#[cfg(any(feature = "wayland_crate", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "wayland_crate")))]
#[cfg(any(feature = "wayland_crate", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
pub fn wl_keyboard(&self) -> Option<WlKeyboard> {
let display = self.display().downcast::<crate::WaylandDisplay>().unwrap();
unsafe {
Expand All @@ -49,8 +46,8 @@ impl WaylandDevice {

#[doc(alias = "gdk_wayland_device_get_wl_pointer")]
#[doc(alias = "get_wl_pointer")]
#[cfg(any(feature = "wayland_crate", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "wayland_crate")))]
#[cfg(any(feature = "wayland_crate", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
pub fn wl_pointer(&self) -> Option<WlPointer> {
let display = self.display().downcast::<crate::WaylandDisplay>().unwrap();
unsafe {
Expand All @@ -68,8 +65,8 @@ impl WaylandDevice {

#[doc(alias = "gdk_wayland_device_get_wl_seat")]
#[doc(alias = "get_wl_seat")]
#[cfg(any(feature = "wayland_crate", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "wayland_crate")))]
#[cfg(any(feature = "wayland_crate", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
pub fn wl_seat(&self) -> Option<WlSeat> {
let display = self.display().downcast::<crate::WaylandDisplay>().unwrap();
unsafe {
Expand All @@ -85,11 +82,8 @@ impl WaylandDevice {
}
}

#[cfg(any(all(feature = "v4_4", feature = "xkb_crate"), feature = "dox"))]
#[cfg_attr(
feature = "dox",
doc(cfg(all(feature = "v4_4", feature = "xkb_crate")))
)]
#[cfg(any(all(feature = "v4_4", feature = "xkb_crate"), docsrs))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "xkb_crate"))))]
#[doc(alias = "gdk_wayland_device_get_xkb_keymap")]
#[doc(alias = "get_xkb_keymap")]
pub fn xkb_keymap(&self) -> Option<Keymap> {
Expand Down
26 changes: 13 additions & 13 deletions gdk4-wayland/src/wayland_display.rs
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::WaylandDisplay;
#[cfg(any(feature = "wayland_crate", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "wayland_crate")))]
#[cfg(any(feature = "wayland_crate", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
use glib::{once_cell::sync::Lazy, prelude::*, translate::*, Quark};

#[cfg(any(all(feature = "v4_4", feature = "egl"), feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(all(feature = "v4_4", feature = "egl"))))]
#[cfg(any(all(feature = "v4_4", feature = "egl"), docsrs))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "egl"))))]
use khronos_egl as egl;

#[cfg(any(feature = "wayland_crate", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "wayland_crate")))]
#[cfg(any(feature = "wayland_crate", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
use wayland_client::{
backend::ObjectId,
protocol::{wl_compositor::WlCompositor, wl_display::WlDisplay},
Proxy,
};

#[cfg(any(feature = "wayland_crate", feature = "dox"))]
#[cfg(any(feature = "wayland_crate", docsrs))]
static WAYLAND_DISPLAY_CONNECTION_QUARK: Lazy<Quark> =
Lazy::new(|| Quark::from_str("gtk-rs-wayland-display-connection-quark"));

impl WaylandDisplay {
#[cfg(any(all(feature = "v4_4", feature = "egl"), feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(all(feature = "v4_4", feature = "egl"))))]
#[cfg(any(all(feature = "v4_4", feature = "egl"), docsrs))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "egl"))))]
#[doc(alias = "gdk_wayland_display_get_egl_display")]
#[doc(alias = "get_egl_display")]
pub fn egl_display(&self) -> Option<egl::Display> {
Expand All @@ -39,8 +39,8 @@ impl WaylandDisplay {

#[doc(alias = "gdk_wayland_display_get_wl_compositor")]
#[doc(alias = "get_wl_compositor")]
#[cfg(any(feature = "wayland_crate", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "wayland_crate")))]
#[cfg(any(feature = "wayland_crate", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
pub fn wl_compositor(&self) -> Option<WlCompositor> {
unsafe {
let compositor_ptr = ffi::gdk_wayland_display_get_wl_compositor(self.to_glib_none().0);
Expand All @@ -58,8 +58,8 @@ impl WaylandDisplay {

#[doc(alias = "gdk_wayland_display_get_wl_display")]
#[doc(alias = "get_wl_display")]
#[cfg(any(feature = "wayland_crate", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "wayland_crate")))]
#[cfg(any(feature = "wayland_crate", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
pub fn wl_display(&self) -> Option<WlDisplay> {
unsafe {
let display_ptr = ffi::gdk_wayland_display_get_wl_display(self.to_glib_none().0);
Expand Down
12 changes: 6 additions & 6 deletions gdk4-wayland/src/wayland_monitor.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::WaylandMonitor;
#[cfg(any(feature = "wayland_crate", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "wayland_crate")))]
#[cfg(any(feature = "wayland_crate", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
use {crate::prelude::*, glib::translate::*};

#[cfg(any(feature = "wayland_crate", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "wayland_crate")))]
#[cfg(any(feature = "wayland_crate", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
use wayland_client::{backend::ObjectId, protocol::wl_output::WlOutput, Proxy};

impl WaylandMonitor {
#[doc(alias = "gdk_wayland_monitor_get_wl_output")]
#[doc(alias = "get_wl_output")]
#[cfg(any(feature = "wayland_crate", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "wayland_crate")))]
#[cfg(any(feature = "wayland_crate", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
pub fn wl_output(&self) -> Option<WlOutput> {
let display = self.display().downcast::<crate::WaylandDisplay>().unwrap();
unsafe {
Expand Down
12 changes: 6 additions & 6 deletions gdk4-wayland/src/wayland_seat.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::WaylandSeat;
#[cfg(any(feature = "wayland_crate", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "wayland_crate")))]
#[cfg(any(feature = "wayland_crate", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
use {crate::prelude::*, glib::translate::*};

#[cfg(any(feature = "wayland_crate", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "wayland_crate")))]
#[cfg(any(feature = "wayland_crate", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
use wayland_client::{backend::ObjectId, protocol::wl_seat::WlSeat, Proxy};

impl WaylandSeat {
#[doc(alias = "gdk_wayland_seat_get_wl_seat")]
#[doc(alias = "get_wl_seat")]
#[cfg(any(feature = "wayland_crate", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "wayland_crate")))]
#[cfg(any(feature = "wayland_crate", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
pub fn wl_seat(&self) -> Option<WlSeat> {
let display = self.display().downcast::<crate::WaylandDisplay>().unwrap();
unsafe {
Expand Down
16 changes: 8 additions & 8 deletions gdk4-wayland/src/wayland_surface.rs
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::{prelude::*, WaylandSurface};
#[cfg(any(feature = "wayland_crate", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "wayland_crate")))]
#[cfg(any(feature = "wayland_crate", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
use glib::translate::*;

#[cfg(any(feature = "wayland_crate", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "wayland_crate")))]
#[cfg(any(feature = "wayland_crate", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
use wayland_client::{backend::ObjectId, protocol::wl_surface::WlSurface, Proxy};

// rustdoc-stripper-ignore-next
/// Trait containing manually implemented methods of [`WaylandSurface`](crate::WaylandSurface).
pub trait WaylandSurfaceExtManual: 'static {
#[doc(alias = "gdk_wayland_surface_get_wl_surface")]
#[doc(alias = "get_wl_surface")]
#[cfg(any(feature = "wayland_crate", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "wayland_crate")))]
#[cfg(any(feature = "wayland_crate", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
fn wl_surface(&self) -> Option<WlSurface>;
}

impl<O: IsA<WaylandSurface>> WaylandSurfaceExtManual for O {
#[cfg(any(feature = "wayland_crate", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "wayland_crate")))]
#[cfg(any(feature = "wayland_crate", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
fn wl_surface(&self) -> Option<WlSurface> {
let display = self
.as_ref()
Expand Down
3 changes: 1 addition & 2 deletions gdk4-wayland/sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@ version = "4.4"
version = "4.10"

[package.metadata.docs.rs]
features = ["dox"]
features = []

[lib]
name = "gdk4_wayland_sys"

[features]
dox = ["glib/dox"]
v4_4 = []
v4_10 = ["v4_4"]

Expand Down
6 changes: 3 additions & 3 deletions gdk4-wayland/sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

#[cfg(not(feature = "dox"))]
#[cfg(not(docsrs))]
use std::process;

#[cfg(feature = "dox")]
#[cfg(docsrs)]
fn main() {} // prevent linking libraries to avoid documentation failure

#[cfg(not(feature = "dox"))]
#[cfg(not(docsrs))]
fn main() {
if let Err(s) = system_deps::Config::new().probe() {
println!("cargo:warning={s}");
Expand Down
10 changes: 5 additions & 5 deletions gdk4-wayland/sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
clippy::unreadable_literal,
clippy::upper_case_acronyms
)]
#![cfg_attr(feature = "dox", feature(doc_cfg))]
#![cfg_attr(docsrs, feature(doc_cfg))]

#[allow(unused_imports)]
use libc::{
Expand Down Expand Up @@ -181,16 +181,16 @@ extern "C" {
pub fn gdk_wayland_device_get_wl_keyboard(device: *mut GdkWaylandDevice) -> gpointer;
pub fn gdk_wayland_device_get_wl_pointer(device: *mut GdkWaylandDevice) -> gpointer;
pub fn gdk_wayland_device_get_wl_seat(device: *mut GdkWaylandDevice) -> gpointer;
#[cfg(any(feature = "v4_4", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v4_4")))]
#[cfg(any(feature = "v4_4", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
pub fn gdk_wayland_device_get_xkb_keymap(device: *mut GdkWaylandDevice) -> gpointer;

//=========================================================================
// GdkWaylandDisplay
//=========================================================================
pub fn gdk_wayland_display_get_type() -> GType;
#[cfg(any(feature = "v4_4", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v4_4")))]
#[cfg(any(feature = "v4_4", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
pub fn gdk_wayland_display_get_egl_display(display: *mut GdkWaylandDisplay) -> gpointer;
pub fn gdk_wayland_display_get_startup_notification_id(
display: *mut GdkWaylandDisplay,
Expand Down
2 changes: 1 addition & 1 deletion gdk4-wayland/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 2358cc24efd2)
Generated by gir (https://github.com/gtk-rs/gir @ 8a280cee2cbb)
from gir-files (https://github.com/gtk-rs/gir-files @ 1254daed0202)
3 changes: 1 addition & 2 deletions gdk4-win32/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@ rust-version = "1.64"
build = "build.rs"

[package.metadata.docs.rs]
features = ["dox"]
rustdoc-args = ["--cfg", "docsrs"]

[package.metadata.system-deps.gtk4_win32]
name = "gtk4-win32"
version = "4"

[features]
v4_4 = ["ffi/v4_4"]
dox = ["ffi/dox", "gdk/dox", "gio/dox", "glib/dox", "egl", "win32"]
egl = ["khronos-egl"]
win32 = ["windows"]

Expand Down
Loading