Skip to content

Commit

Permalink
Untangle docsrs attribute from features (#1454)
Browse files Browse the repository at this point in the history
* Untangle docsrs attribute from features

* More changes for docsrs
  • Loading branch information
pentamassiv authored Aug 6, 2023
1 parent c3ab1a7 commit 5731a4f
Show file tree
Hide file tree
Showing 29 changed files with 108 additions and 95 deletions.
6 changes: 3 additions & 3 deletions gdk4-wayland/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ pub use ffi;
pub use gdk;
pub use gio;
pub use glib;
#[cfg(any(feature = "wayland_crate", docsrs))]
#[cfg(feature = "wayland_crate")]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
pub use wayland_client;

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

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

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

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

#[cfg(any(feature = "wayland_crate", docsrs))]
#[cfg(feature = "wayland_crate")]
#[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"), docsrs))]
#[cfg(all(feature = "v4_4", feature = "xkb_crate"))]
#[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", docsrs))]
#[cfg(feature = "wayland_crate")]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
pub fn wl_keyboard(&self) -> Option<WlKeyboard> {
let display = self.display().downcast::<crate::WaylandDisplay>().unwrap();
Expand All @@ -46,7 +46,7 @@ impl WaylandDevice {

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

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

#[cfg(any(all(feature = "v4_4", feature = "xkb_crate"), docsrs))]
#[cfg(all(feature = "v4_4", feature = "xkb_crate"))]
#[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")]
Expand Down
14 changes: 7 additions & 7 deletions gdk4-wayland/src/wayland_display.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::WaylandDisplay;
#[cfg(any(feature = "wayland_crate", docsrs))]
#[cfg(feature = "wayland_crate")]
#[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"), docsrs))]
#[cfg(all(feature = "v4_4", feature = "egl"))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "egl"))))]
use khronos_egl as egl;

#[cfg(any(feature = "wayland_crate", docsrs))]
#[cfg(feature = "wayland_crate")]
#[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", docsrs))]
#[cfg(feature = "wayland_crate")]
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"), docsrs))]
#[cfg(all(feature = "v4_4", feature = "egl"))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "egl"))))]
#[doc(alias = "gdk_wayland_display_get_egl_display")]
#[doc(alias = "get_egl_display")]
Expand All @@ -39,7 +39,7 @@ impl WaylandDisplay {

#[doc(alias = "gdk_wayland_display_get_wl_compositor")]
#[doc(alias = "get_wl_compositor")]
#[cfg(any(feature = "wayland_crate", docsrs))]
#[cfg(feature = "wayland_crate")]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
pub fn wl_compositor(&self) -> Option<WlCompositor> {
unsafe {
Expand All @@ -58,7 +58,7 @@ impl WaylandDisplay {

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

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

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

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

#[cfg(any(feature = "wayland_crate", docsrs))]
#[cfg(feature = "wayland_crate")]
#[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", docsrs))]
#[cfg(feature = "wayland_crate")]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
pub fn wl_seat(&self) -> Option<WlSeat> {
let display = self.display().downcast::<crate::WaylandDisplay>().unwrap();
Expand Down
6 changes: 3 additions & 3 deletions gdk4-wayland/src/wayland_surface.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// 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", docsrs))]
#[cfg(feature = "wayland_crate")]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
use glib::translate::*;

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

Expand All @@ -19,7 +19,7 @@ mod sealed {
pub trait WaylandSurfaceExtManual: sealed::Sealed + IsA<WaylandSurface> + 'static {
#[doc(alias = "gdk_wayland_surface_get_wl_surface")]
#[doc(alias = "get_wl_surface")]
#[cfg(any(feature = "wayland_crate", docsrs))]
#[cfg(feature = "wayland_crate")]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
fn wl_surface(&self) -> Option<WlSurface> {
let display = self
Expand Down
2 changes: 1 addition & 1 deletion gdk4-win32/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub use ffi;
pub use gdk;
pub use gio;
pub use glib;
#[cfg(any(feature = "win32", docsrs))]
#[cfg(feature = "win32")]
#[cfg_attr(docsrs, doc(cfg(feature = "win32")))]
pub use windows;

Expand Down
4 changes: 2 additions & 2 deletions gdk4-win32/src/win32_display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
use crate::{Win32Display, Win32MessageFilterReturn, MSG};
use glib::translate::*;

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

impl Win32Display {
#[cfg(any(all(feature = "v4_4", feature = "egl"), docsrs))]
#[cfg(all(feature = "v4_4", feature = "egl"))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "egl"))))]
#[doc(alias = "gdk_win32_display_get_egl_display")]
#[doc(alias = "get_egl_display")]
Expand Down
2 changes: 1 addition & 1 deletion gdk4-x11/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use glib::{translate::*, IntoGStr};

#[cfg(not(feature = "xlib"))]
use crate::XAtom;
#[cfg(any(feature = "xlib", docsrs))]
#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
use x11::xlib::Atom as XAtom;

Expand Down
4 changes: 2 additions & 2 deletions gdk4-x11/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ pub use ffi;
pub use gdk;
pub use gio;
pub use glib;
#[cfg(any(feature = "xlib", docsrs))]
#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
pub use x11;

#[cfg(any(all(feature = "v4_4", feature = "egl"), docsrs))]
#[cfg(all(feature = "v4_4", feature = "egl"))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "egl"))))]
pub use khronos_egl;
#[macro_use]
Expand Down
18 changes: 9 additions & 9 deletions gdk4-x11/src/x11_display.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::{prelude::*, X11Display};
#[cfg(any(feature = "xlib", docsrs))]
#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
use glib::signal::{connect_raw, SignalHandlerId};
#[cfg(any(all(feature = "v4_4", feature = "egl"), docsrs))]
#[cfg(all(feature = "v4_4", feature = "egl"))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "egl"))))]
use khronos_egl as egl;
#[cfg(any(feature = "xlib", docsrs))]
#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
use std::{boxed::Box as Box_, mem::transmute};
#[cfg(any(feature = "xlib", docsrs))]
#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
use x11::xlib;

#[cfg(not(feature = "xlib"))]
use crate::{XCursor, XWindow};
use glib::{translate::*, IntoGStr};
#[cfg(any(feature = "xlib", docsrs))]
#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
use x11::xlib::{Cursor as XCursor, Window as XWindow};

impl X11Display {
#[cfg(any(all(feature = "v4_4", feature = "egl"), docsrs))]
#[cfg(all(feature = "v4_4", feature = "egl"))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "egl"))))]
#[doc(alias = "gdk_x11_display_get_egl_display")]
#[doc(alias = "get_egl_display")]
Expand All @@ -49,23 +49,23 @@ impl X11Display {
unsafe { ffi::gdk_x11_display_get_xrootwindow(self.to_glib_none().0) }
}

#[cfg(any(feature = "xlib", docsrs))]
#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
#[doc(alias = "gdk_x11_display_get_xdisplay")]
#[doc(alias = "get_xdisplay")]
pub unsafe fn xdisplay(&self) -> *mut xlib::Display {
ffi::gdk_x11_display_get_xdisplay(self.to_glib_none().0) as *mut xlib::Display
}

#[cfg(any(feature = "xlib", docsrs))]
#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
#[doc(alias = "gdk_x11_display_get_xscreen")]
#[doc(alias = "get_xscreen")]
pub unsafe fn xscreen(&self) -> *mut xlib::Screen {
ffi::gdk_x11_display_get_xscreen(self.to_glib_none().0) as *mut xlib::Screen
}

#[cfg(any(feature = "xlib", docsrs))]
#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
#[doc(alias = "xevent")]
pub unsafe fn connect_xevent<F: Fn(&Self, *mut xlib::XEvent) -> glib::Propagation + 'static>(
Expand Down
2 changes: 1 addition & 1 deletion gdk4-x11/src/x11_monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::X11Monitor;
#[cfg(not(feature = "xlib"))]
use crate::XID;
use glib::translate::*;
#[cfg(any(feature = "xlib", docsrs))]
#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
use x11::xlib::XID;

Expand Down
4 changes: 2 additions & 2 deletions gdk4-x11/src/x11_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ use crate::X11Screen;
#[cfg(not(feature = "xlib"))]
use crate::XID;
use glib::translate::*;
#[cfg(any(feature = "xlib", docsrs))]
#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
use x11::xlib::{self, XID};

impl X11Screen {
#[cfg(any(feature = "xlib", docsrs))]
#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
#[doc(alias = "gdk_x11_screen_get_xscreen")]
#[doc(alias = "get_xscreen")]
Expand Down
2 changes: 1 addition & 1 deletion gdk4-x11/src/x11_surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::X11Surface;
#[cfg(not(feature = "xlib"))]
use crate::XWindow;
use glib::translate::*;
#[cfg(any(feature = "xlib", docsrs))]
#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
use x11::xlib::Window as XWindow;

Expand Down
2 changes: 1 addition & 1 deletion gdk4/src/content_formats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl ContentFormats {
}
}

#[cfg(any(feature = "v4_4", docsrs))]
#[cfg(feature = "v4_4")]
#[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
impl std::str::FromStr for ContentFormats {
type Err = glib::BoolError;
Expand Down
2 changes: 1 addition & 1 deletion gdk4/src/drag_surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ mod sealed {
// rustdoc-stripper-ignore-next
/// Trait containing manually implemented methods of [`DragSurface`](crate::DragSurface).
pub trait DragSurfaceExtManual: sealed::Sealed + IsA<DragSurface> {
#[cfg(any(feature = "v4_12", docsrs))]
#[cfg(feature = "v4_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
#[doc(alias = "compute-size")]
fn connect_compute_size<F: Fn(&DragSurface, &mut DragSurfaceSize) + 'static>(
Expand Down
Loading

0 comments on commit 5731a4f

Please sign in to comment.