Skip to content

Commit

Permalink
Disentangle docsrs and features
Browse files Browse the repository at this point in the history
  • Loading branch information
pentamassiv authored and bilelmoussaoui committed Aug 6, 2023
1 parent 5fadbea commit 04bddc0
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 47 deletions.
12 changes: 6 additions & 6 deletions cairo/src/pdf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::{
use glib::translate::*;

use crate::{Error, PdfVersion, Surface, SurfaceType};
#[cfg(any(all(feature = "pdf", feature = "v1_16"), docsrs))]
#[cfg(all(feature = "pdf", feature = "v1_16"))]
use crate::{PdfMetadata, PdfOutline};

impl PdfVersion {
Expand Down Expand Up @@ -73,7 +73,7 @@ impl PdfSurface {
self.status()
}

#[cfg(any(all(feature = "pdf", feature = "v1_16"), docsrs))]
#[cfg(all(feature = "pdf", feature = "v1_16"))]
#[doc(alias = "cairo_pdf_surface_set_metadata")]
pub fn set_metadata(&self, metadata: PdfMetadata, value: &str) -> Result<(), Error> {
let value = CString::new(value).unwrap();
Expand All @@ -87,7 +87,7 @@ impl PdfSurface {
self.status()
}

#[cfg(any(all(feature = "pdf", feature = "v1_18"), docsrs))]
#[cfg(all(feature = "pdf", feature = "v1_18"))]
#[doc(alias = "cairo_pdf_surface_set_custom_metadata")]
pub fn set_custom_metadata(&self, name: &str, value: &str) -> Result<(), Error> {
let name = CString::new(name).unwrap();
Expand All @@ -102,7 +102,7 @@ impl PdfSurface {
self.status()
}

#[cfg(any(all(feature = "pdf", feature = "v1_16"), docsrs))]
#[cfg(all(feature = "pdf", feature = "v1_16"))]
#[doc(alias = "cairo_pdf_surface_set_page_label")]
pub fn set_page_label(&self, label: &str) -> Result<(), Error> {
let label = CString::new(label).unwrap();
Expand All @@ -112,7 +112,7 @@ impl PdfSurface {
self.status()
}

#[cfg(any(all(feature = "pdf", feature = "v1_16"), docsrs))]
#[cfg(all(feature = "pdf", feature = "v1_16"))]
#[doc(alias = "cairo_pdf_surface_set_thumbnail_size")]
pub fn set_thumbnail_size(&self, width: i32, height: i32) -> Result<(), Error> {
unsafe {
Expand All @@ -125,7 +125,7 @@ impl PdfSurface {
self.status()
}

#[cfg(any(all(feature = "pdf", feature = "v1_16"), docsrs))]
#[cfg(all(feature = "pdf", feature = "v1_16"))]
#[doc(alias = "cairo_pdf_surface_add_outline")]
pub fn add_outline(
&self,
Expand Down
6 changes: 3 additions & 3 deletions cairo/src/svg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::{
#[cfg(feature = "use_glib")]
use glib::translate::*;

#[cfg(any(all(feature = "svg", feature = "v1_16"), docsrs))]
#[cfg(all(feature = "svg", feature = "v1_16"))]
use crate::SvgUnit;
use crate::{Error, Surface, SurfaceType, SvgVersion};

Expand Down Expand Up @@ -95,15 +95,15 @@ impl SvgSurface {
}
}

#[cfg(any(all(feature = "svg", feature = "v1_16"), docsrs))]
#[cfg(all(feature = "svg", feature = "v1_16"))]
#[doc(alias = "cairo_svg_surface_set_document_unit")]
pub fn set_document_unit(&mut self, unit: SvgUnit) {
unsafe {
ffi::cairo_svg_surface_set_document_unit(self.0.to_raw_none(), unit.into());
}
}

#[cfg(any(all(feature = "svg", feature = "v1_16"), docsrs))]
#[cfg(all(feature = "svg", feature = "v1_16"))]
#[doc(alias = "cairo_svg_surface_get_document_unit")]
#[doc(alias = "get_document_unit")]
pub fn document_unit(&self) -> SvgUnit {
Expand Down
20 changes: 10 additions & 10 deletions gio/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ mod dbus_node_info;
#[cfg(feature = "v2_72")]
#[cfg_attr(docsrs, doc(cfg(feature = "v2_72")))]
mod debug_controller_dbus;
#[cfg(any(all(not(windows), not(target_os = "macos")), docsrs))]
#[cfg(all(not(windows), not(target_os = "macos")))]
mod desktop_app_info;
mod error;
mod file;
Expand All @@ -43,9 +43,9 @@ pub use crate::file_attribute_info::FileAttributeInfo;
mod file_attribute_info_list;
mod file_attribute_matcher;
pub use crate::file_attribute_matcher::FileAttributematcherIter;
#[cfg(any(unix, docsrs))]
#[cfg(unix)]
mod file_descriptor_based;
#[cfg(any(unix, docsrs))]
#[cfg(unix)]
pub use file_descriptor_based::FileDescriptorBased;
mod file_enumerator;
pub use crate::file_enumerator::FileEnumeratorStream;
Expand Down Expand Up @@ -84,19 +84,19 @@ pub use socket_msg_flags::SocketMsgFlags;
mod subprocess;
mod subprocess_launcher;
mod threaded_socket_service;
#[cfg(any(unix, docsrs))]
#[cfg(unix)]
mod unix_fd_list;
#[cfg(any(unix, docsrs))]
#[cfg(unix)]
mod unix_fd_message;
#[cfg(any(unix, docsrs))]
#[cfg(unix)]
mod unix_input_stream;
#[cfg(any(unix, docsrs))]
#[cfg(unix)]
mod unix_mount_entry;
#[cfg(any(unix, docsrs))]
#[cfg(unix)]
mod unix_mount_point;
#[cfg(any(unix, docsrs))]
#[cfg(unix)]
mod unix_output_stream;
#[cfg(any(unix, docsrs))]
#[cfg(unix)]
mod unix_socket_address;

#[cfg(test)]
Expand Down
4 changes: 2 additions & 2 deletions gio/src/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ impl Socket {
}
}

#[cfg(any(unix, docsrs))]
#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
impl AsRawFd for Socket {
fn as_raw_fd(&self) -> RawFd {
unsafe { ffi::g_socket_get_fd(self.to_glib_none().0) as _ }
}
}

#[cfg(any(windows, docsrs))]
#[cfg(windows)]
#[cfg_attr(docsrs, doc(cfg(windows)))]
impl AsRawSocket for Socket {
fn as_raw_socket(&self) -> RawSocket {
Expand Down
11 changes: 5 additions & 6 deletions gio/src/subprocess_launcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
#[cfg(any(unix, all(docsrs, unix)))]
use std::os::unix::io::IntoRawFd;

#[cfg(any(unix, docsrs))]
#[cfg(any(unix, docsrs))]
#[cfg(unix)]
use glib::translate::*;

use crate::SubprocessLauncher;
Expand All @@ -17,7 +16,7 @@ pub trait IntoRawFd: Sized {
}

impl SubprocessLauncher {
#[cfg(any(unix, docsrs))]
#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
#[doc(alias = "g_subprocess_launcher_take_fd")]
pub fn take_fd(&self, source_fd: impl IntoRawFd, target_fd: impl IntoRawFd) {
Expand All @@ -30,7 +29,7 @@ impl SubprocessLauncher {
}
}

#[cfg(any(unix, docsrs))]
#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
#[doc(alias = "g_subprocess_launcher_take_stderr_fd")]
pub fn take_stderr_fd(&self, fd: impl IntoRawFd) {
Expand All @@ -39,7 +38,7 @@ impl SubprocessLauncher {
}
}

#[cfg(any(unix, docsrs))]
#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
#[doc(alias = "g_subprocess_launcher_take_stdin_fd")]
pub fn take_stdin_fd(&self, fd: impl IntoRawFd) {
Expand All @@ -48,7 +47,7 @@ impl SubprocessLauncher {
}
}

#[cfg(any(unix, docsrs))]
#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
#[doc(alias = "g_subprocess_launcher_take_stdout_fd")]
pub fn take_stdout_fd(&self, fd: impl IntoRawFd) {
Expand Down
2 changes: 1 addition & 1 deletion gio/src/unix_mount_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use glib::translate::*;
use crate::UnixMountPoint;

impl UnixMountPoint {
#[cfg(any(unix, docsrs))]
#[cfg(unix)]
#[doc(alias = "g_unix_mount_points_get")]
#[doc(alias = "get_mount_points")]
pub fn mount_points() -> (Vec<UnixMountPoint>, u64) {
Expand Down
30 changes: 15 additions & 15 deletions glib/src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use ffi::{self, gboolean, gpointer};
#[cfg(all(not(unix), docsrs))]
use libc::c_int as RawFd;

#[cfg(any(unix, docsrs))]
#[cfg(unix)]
use crate::IOCondition;
use crate::{thread_guard::ThreadGuard, translate::*, ControlFlow, MainContext, Source};

Expand Down Expand Up @@ -151,7 +151,7 @@ fn into_raw_child_watch_local<F: FnMut(Pid, i32) + 'static>(func: F) -> gpointer
Box::into_raw(func) as gpointer
}

#[cfg(any(unix, docsrs))]
#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
unsafe extern "C" fn trampoline_unix_fd<
F: FnMut(RawFd, IOCondition) -> ControlFlow + Send + 'static,
Expand All @@ -164,7 +164,7 @@ unsafe extern "C" fn trampoline_unix_fd<
(*func.borrow_mut())(fd, from_glib(condition)).into_glib()
}

#[cfg(any(unix, docsrs))]
#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
unsafe extern "C" fn trampoline_unix_fd_local<
F: FnMut(RawFd, IOCondition) -> ControlFlow + 'static,
Expand All @@ -177,7 +177,7 @@ unsafe extern "C" fn trampoline_unix_fd_local<
(*func.get_ref().borrow_mut())(fd, from_glib(condition)).into_glib()
}

#[cfg(any(unix, docsrs))]
#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
unsafe extern "C" fn destroy_closure_unix_fd<
F: FnMut(RawFd, IOCondition) -> ControlFlow + Send + 'static,
Expand All @@ -187,7 +187,7 @@ unsafe extern "C" fn destroy_closure_unix_fd<
let _ = Box::<RefCell<F>>::from_raw(ptr as *mut _);
}

#[cfg(any(unix, docsrs))]
#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
unsafe extern "C" fn destroy_closure_unix_fd_local<
F: FnMut(RawFd, IOCondition) -> ControlFlow + 'static,
Expand All @@ -197,7 +197,7 @@ unsafe extern "C" fn destroy_closure_unix_fd_local<
let _ = Box::<ThreadGuard<RefCell<F>>>::from_raw(ptr as *mut _);
}

#[cfg(any(unix, docsrs))]
#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
fn into_raw_unix_fd<F: FnMut(RawFd, IOCondition) -> ControlFlow + Send + 'static>(
func: F,
Expand All @@ -206,7 +206,7 @@ fn into_raw_unix_fd<F: FnMut(RawFd, IOCondition) -> ControlFlow + Send + 'static
Box::into_raw(func) as gpointer
}

#[cfg(any(unix, docsrs))]
#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
fn into_raw_unix_fd_local<F: FnMut(RawFd, IOCondition) -> ControlFlow + 'static>(
func: F,
Expand Down Expand Up @@ -630,7 +630,7 @@ where
}
}

#[cfg(any(unix, docsrs))]
#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
// rustdoc-stripper-ignore-next
/// Adds a closure to be called by the default main loop whenever a UNIX signal is raised.
Expand All @@ -656,7 +656,7 @@ where
}
}

#[cfg(any(unix, docsrs))]
#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
// rustdoc-stripper-ignore-next
/// Adds a closure to be called by the default main loop whenever a UNIX signal is raised.
Expand All @@ -677,7 +677,7 @@ where
unix_signal_add(signum, fnmut_callback_wrapper(func))
}

#[cfg(any(unix, docsrs))]
#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
// rustdoc-stripper-ignore-next
/// Adds a closure to be called by the default main loop whenever a UNIX signal is raised.
Expand Down Expand Up @@ -713,7 +713,7 @@ where
}
}

#[cfg(any(unix, docsrs))]
#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
// rustdoc-stripper-ignore-next
/// Adds a closure to be called by the default main loop whenever a UNIX signal is raised.
Expand All @@ -740,7 +740,7 @@ where
unix_signal_add_local(signum, fnmut_callback_wrapper_local(func))
}

#[cfg(any(unix, docsrs))]
#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
// rustdoc-stripper-ignore-next
/// Adds a closure to be called by the main loop the returned `Source` is attached to whenever a
Expand Down Expand Up @@ -768,7 +768,7 @@ where
}
}

#[cfg(any(unix, docsrs))]
#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
// rustdoc-stripper-ignore-next
/// Adds a closure to be called by the main loop the returned `Source` is attached to whenever a
Expand Down Expand Up @@ -988,7 +988,7 @@ where
}
}

#[cfg(any(unix, docsrs))]
#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
// rustdoc-stripper-ignore-next
/// Adds a closure to be called by the main loop the returned `Source` is attached to whenever a
Expand Down Expand Up @@ -1024,7 +1024,7 @@ where
}
}

#[cfg(any(unix, docsrs))]
#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
// rustdoc-stripper-ignore-next
/// Adds a closure to be called by the main loop the returned `Source` is attached to whenever a
Expand Down
8 changes: 4 additions & 4 deletions glib/src/source_futures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ pub fn child_watch_future_with_priority(
}))
}

#[cfg(any(unix, docsrs))]
#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
// rustdoc-stripper-ignore-next
/// Create a `Future` that will resolve once the given UNIX signal is raised
Expand All @@ -204,7 +204,7 @@ pub fn unix_signal_future(signum: i32) -> Pin<Box<dyn Future<Output = ()> + Send
unix_signal_future_with_priority(crate::Priority::default(), signum)
}

#[cfg(any(unix, docsrs))]
#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
// rustdoc-stripper-ignore-next
/// Create a `Future` that will resolve once the given UNIX signal is raised
Expand Down Expand Up @@ -380,7 +380,7 @@ pub fn interval_stream_seconds_with_priority(
}))
}

#[cfg(any(unix, docsrs))]
#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
// rustdoc-stripper-ignore-next
/// Create a `Stream` that will provide a value whenever the given UNIX signal is raised
Expand All @@ -390,7 +390,7 @@ pub fn unix_signal_stream(signum: i32) -> Pin<Box<dyn Stream<Item = ()> + Send +
unix_signal_stream_with_priority(crate::Priority::default(), signum)
}

#[cfg(any(unix, docsrs))]
#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
// rustdoc-stripper-ignore-next
/// Create a `Stream` that will provide a value whenever the given UNIX signal is raised
Expand Down

0 comments on commit 04bddc0

Please sign in to comment.