Skip to content

Commit

Permalink
intradoc-link redundancy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijnS95 committed May 7, 2024
1 parent 6e893a6 commit a8b218e
Show file tree
Hide file tree
Showing 17 changed files with 109 additions and 109 deletions.
35 changes: 19 additions & 16 deletions wayland-backend/src/client_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ use std::{
sync::Arc,
};

#[cfg(doc)]
use std::io::ErrorKind::WouldBlock;

use crate::protocol::{Interface, Message, ObjectInfo};

use super::client_impl;
Expand Down Expand Up @@ -43,8 +46,8 @@ pub trait ObjectData: downcast_rs::DowncastSync {

/// Helper for accessing user data
///
/// This function is used to back the `Proxy::data` function in `wayland_client`. By default,
/// it returns `self` (via Downcast), but this may be overridden to allow downcasting user data
/// This function is used to back the `Proxy::data()` function in `wayland_client`. By default,
/// it returns `self` (via [`Downcast`][downcast_rs::DowncastSync]), but this may be overridden to allow downcasting user data
/// without needing to have access to the full type.
fn data_as_any(&self) -> &dyn Any {
self.as_any()
Expand Down Expand Up @@ -103,7 +106,7 @@ impl ObjectId {
/// This object ID is always invalid, and should be used as placeholder in requests that create objects,
/// or for request with an optional `Object` argument.
///
/// See [`Backend::send_request`](Backend::send_request) for details.
/// See [`Backend::send_request()`] for details.
#[inline]
pub fn null() -> ObjectId {
client_impl::InnerBackend::null_id()
Expand All @@ -118,7 +121,7 @@ impl ObjectId {
/// Return the protocol-level numerical ID of this object
///
/// Protocol IDs are reused after object destruction, so this should not be used as a unique identifier,
/// instead use the `ObjectId` directly, it implements `Clone`, `PartialEq`, `Eq` and `Hash`.
/// instead use the [`ObjectId`] directly, it implements [`Clone`], [`PartialEq`], [`Eq`] and [`Hash`].
#[inline]
pub fn protocol_id(&self) -> u32 {
self.id.protocol_id()
Expand All @@ -136,7 +139,7 @@ pub struct Backend {

/// A weak handle to a [`Backend`]
///
/// This handle behaves similarly to [`Weak`](std::sync::Weak), and can be used to keep access to
/// This handle behaves similarly to [`Weak`][std::sync::Weak], and can be used to keep access to
/// the backend without actually preventing it from being dropped.
#[derive(Clone, Debug)]
pub struct WeakBackend {
Expand Down Expand Up @@ -172,10 +175,10 @@ impl Backend {
/// Flush all pending outgoing requests to the server
///
/// Most errors on this method mean that the Wayland connection is no longer valid, the only
/// exception being an IO `WouldBlock` error. In that case it means that you should try flushing again
/// exception being an IO [`WouldBlock`] error. In that case it means that you should try flushing again
/// later.
///
/// You can however expect this method returning `WouldBlock` to be very rare: it can only occur if
/// You can however expect this method returning [`WouldBlock`] to be very rare: it can only occur if
/// either your client sent a lot of big messages at once, or the server is very laggy.
pub fn flush(&self) -> Result<(), WaylandError> {
self.backend.flush()
Expand Down Expand Up @@ -220,7 +223,7 @@ impl Backend {
///
/// - the message opcode must be valid for the sender interface
/// - the argument list must match the prototype for the message associated with this opcode
/// - if the method creates a new object, a [`ObjectId::null()`](ObjectId::null) must be given
/// - if the method creates a new object, a [`ObjectId::null()`] must be given
/// in the argument list at the appropriate place, and a `child_spec` (interface and version)
/// can be provided. If one is provided, it'll be checked against the protocol spec. If the
/// protocol specification does not define the interface of the created object (notable example
Expand Down Expand Up @@ -259,7 +262,7 @@ impl Backend {
///
/// This call will not block, but may return `None` if the inner queue of the backend needs to
/// be dispatched. In which case you should invoke
/// [`dispatch_inner_queue()`](Backend::dispatch_inner_queue).
/// [`dispatch_inner_queue()`][Self::dispatch_inner_queue()].
#[inline]
#[must_use]
pub fn prepare_read(&self) -> Option<ReadEventsGuard> {
Expand All @@ -271,12 +274,12 @@ impl Backend {
///
/// This function actually only does something when using the system backend. It dispaches an inner
/// queue that the backend uses to wrap `libwayland`. While this dispatching is generally done in
/// [`ReadEventsGuard::read()`](ReadEventsGuard::read), if multiple threads are interacting with the
/// [`ReadEventsGuard::read()`], if multiple threads are interacting with the
/// Wayland socket it can happen that this queue was filled by another thread. In that case
/// [`prepare_read()`](Backend::prepare_read) will return `None`, and you should invoke
/// [`prepare_read()`][Self::prepare_read()] will return `None`, and you should invoke
/// this function instead of using the [`ReadEventsGuard`]
///
/// Returns the number of messages that were dispatched to their `ObjectData` callbacks.
/// Returns the number of messages that were dispatched to their [`ObjectData`] callbacks.
#[inline]
pub fn dispatch_inner_queue(&self) -> Result<usize, WaylandError> {
self.backend.dispatch_inner_queue()
Expand All @@ -290,12 +293,12 @@ impl Backend {
/// threads to not be notified of new events, and sleep much longer than appropriate.
///
/// This guard is provided to ensure the proper synchronization is done. The guard is created using
/// the [`Backend::prepare_read()`](Backend::prepare_read) method. And the event reading is
/// triggered by consuming the guard using the [`read()`](ReadEventsGuard::read) method, synchronizing
/// the [`Backend::prepare_read()`] method. And the event reading is
/// triggered by consuming the guard using the [`ReadEventsGuard::read()`] method, synchronizing
/// with other threads as necessary so that only one of the threads will actually perform the socket read.
///
/// If you plan to poll the Wayland socket for readiness, the file descriptor can be retrieved via
/// the [`connection_fd`](ReadEventsGuard::connection_fd) method. Note that for the synchronization to
/// the [`ReadEventsGuard::connection_fd()`] method. Note that for the synchronization to
/// correctly occur, you must *always* create the `ReadEventsGuard` *before* polling the socket.
///
/// Dropping the guard is valid and will cancel the prepared read.
Expand All @@ -319,7 +322,7 @@ impl ReadEventsGuard {
/// threads will then resume their execution.
///
/// This returns the number of dispatched events, or `0` if an other thread handled the dispatching.
/// If no events are available to read from the socket, this returns a `WouldBlock` IO error.
/// If no events are available to read from the socket, this returns a [`WouldBlock`] IO error.
#[inline]
pub fn read(self) -> Result<usize, WaylandError> {
self.guard.read()
Expand Down
6 changes: 3 additions & 3 deletions wayland-backend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
//!
//! ## raw-window-handle integration
//!
//! This crate can implement [`HasRawDisplayHandle`](raw_window_handle::HasRawDisplayHandle) for the client
//! module [`Backend`](client::Backend) type if you activate the `raw-window-handle` feature.
//! This crate can implement [`HasRawDisplayHandle`][raw_window_handle::HasRawDisplayHandle] for the client
//! module [`Backend`][client::Backend] type if you activate the `raw-window-handle` feature.
//!
//! Note that the `client_system` feature must also be enabled for the implementation to be activated.

Expand All @@ -50,7 +50,7 @@
/// Reexport of the `smallvec` crate, which is part of `wayland-backend`'s public API.
pub extern crate smallvec;

/// Helper macro for quickly making a [`Message`](crate::protocol::Message)
/// Helper macro for quickly making a [`Message`][crate::protocol::Message]
#[macro_export]
macro_rules! message {
($sender_id: expr, $opcode: expr, [$($args: expr),* $(,)?] $(,)?) => {
Expand Down
4 changes: 2 additions & 2 deletions wayland-backend/src/rs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ mod wire;

/// Client-side rust implementation of a Wayland protocol backend
///
/// The main entrypoint is the [`Backend::connect`](client::Backend::connect) method.
/// The main entrypoint is the [`Backend::connect()`][client::Backend::connect()] method.
#[path = "../client_api.rs"]
pub mod client;

/// Server-side rust implementation of a Wayland protocol backend
///
/// The main entrypoint is the [`Backend::new`](server::Backend::new) method.
/// The main entrypoint is the [`Backend::new()`][server::Backend::new()] method.
#[path = "../server_api.rs"]
pub mod server;
6 changes: 3 additions & 3 deletions wayland-backend/src/server_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,15 @@ impl fmt::Debug for GlobalId {
///
/// This type hosts most of the protocol-related functionality of the backend, and is the
/// main entry point for manipulating Wayland objects. It can be retrieved from the backend via
/// [`Backend::handle()`](Backend::handle) and cloned, and is given to you as argument in many callbacks.
/// [`Backend::handle()`] and cloned, and is given to you as argument in many callbacks.
#[derive(Clone, Debug)]
pub struct Handle {
pub(crate) handle: server_impl::InnerHandle,
}

/// A weak reference to a [`Handle`]
///
/// This handle behaves similarly to [`Weak`](std::sync::Weak), and can be used to keep access to
/// This handle behaves similarly to [`Weak`][std::sync::Weak], and can be used to keep access to
/// the handle without actually preventing it from being dropped.
#[derive(Clone, Debug)]
pub struct WeakHandle {
Expand Down Expand Up @@ -551,7 +551,7 @@ impl<D> Backend<D> {
///
/// **Note:** This functionality is currently only available on the rust backend, invoking this method on
/// the system backend will do the same as invoking
/// [`Backend::dispatch_all_clients()`](Backend::dispatch_all_clients).
/// [`Backend::dispatch_all_clients()`].
#[inline]
pub fn dispatch_single_client(
&mut self,
Expand Down
18 changes: 9 additions & 9 deletions wayland-backend/src/sys/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ unsafe fn free_arrays(signature: &[ArgumentType], arglist: &[wl_argument]) {
/// Client-side implementation of a Wayland protocol backend using `libwayland`
///
/// Entrypoints are:
/// - [`Backend::connect`](client::Backend::connect) method if you're creating the Wayland connection
/// - [`Backend::from_foreign_display`](client::Backend::from_foreign_display) if you're interacting with an
/// - [`Backend::connect()`][client::Backend::connect()] method if you're creating the Wayland connection
/// - [`Backend::from_foreign_display()`][client::Backend::from_foreign_display()] if you're interacting with an
/// already existing Wayland connection through FFI.
#[cfg(any(test, feature = "client_system"))]
#[path = "../client_api.rs"]
Expand All @@ -41,7 +41,7 @@ impl client::ObjectId {
///
/// # Errors
///
/// This function returns an [`InvalidId`](client::InvalidId) error if the interface of the proxy does
/// This function returns an [`InvalidId`][client::InvalidId] error if the interface of the proxy does
/// not match the provided interface.
///
/// # Safety
Expand All @@ -68,15 +68,15 @@ impl client::Backend {
/// This is useful if you are writing a library that is expected to plug itself into an existing
/// Wayland connection.
///
/// This will initialize the [`Backend`](client::Backend) in "guest" mode, meaning it will not close the
/// connection on drop. After the [`Backend`](client::Backend) is dropped, if the server sends an event
/// This will initialize the [`Backend`][Self] in "guest" mode, meaning it will not close the
/// connection on drop. After the [`Backend`][Self] is dropped, if the server sends an event
/// to an object that was created from it, that event will be silently discarded. This may lead to
/// protocol errors if the server expects an answer to that event, as such you should make sure to
/// cleanup your Wayland state before dropping the [`Backend`](client::Backend).
/// cleanup your Wayland state before dropping the [`Backend`][Self].
///
/// # Safety
///
/// You need to ensure the `*mut wl_display` remains live as long as the [`Backend`](client::Backend)
/// You need to ensure the `*mut wl_display` remains live as long as the [`Backend`][Self]
/// (or its clones) exist.
pub unsafe fn from_foreign_display(display: *mut wayland_sys::client::wl_display) -> Self {
Self { backend: unsafe { client_impl::InnerBackend::from_foreign_display(display) } }
Expand Down Expand Up @@ -107,7 +107,7 @@ unsafe impl raw_window_handle::HasRawDisplayHandle for client::Backend {

/// Server-side implementation of a Wayland protocol backend using `libwayland`
///
/// The main entrypoint is the [`Backend::new`](server::Backend::new) method.
/// The main entrypoint is the [`Backend::new()`][server::Backend::new()] method.
#[cfg(any(test, feature = "server_system"))]
#[path = "../server_api.rs"]
pub mod server;
Expand All @@ -118,7 +118,7 @@ impl server::ObjectId {
///
/// # Errors
///
/// This function returns an [`InvalidId`](server::InvalidId) error if the interface of the
/// This function returns an [`InvalidId`][server::InvalidId] error if the interface of the
/// resource does not match the provided interface.
///
/// # Safety
Expand Down
22 changes: 11 additions & 11 deletions wayland-client/src/conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ use crate::{protocol::wl_display::WlDisplay, EventQueue, Proxy};
/// with the protocol are actually done using other types. The two main uses a simple app has for the
/// [`Connection`] are:
///
/// - Obtaining the initial [`WlDisplay`] through the [`display()`](Connection::display) method.
/// - Creating new [`EventQueue`]s with the [`new_event_queue()`](Connection::new_event_queue) method.
/// - Obtaining the initial [`WlDisplay`] through the [`display()`][Self::display()] method.
/// - Creating new [`EventQueue`]s with the [`new_event_queue()`][Self::new_event_queue()] method.
///
/// It can be created through the [`connect_to_env()`](Connection::connect_to_env) method to follow the
/// It can be created through the [`connect_to_env()`][Self::connect_to_env()] method to follow the
/// configuration from the environment (which is what you'll do most of the time), or using the
/// [`from_socket()`](Connection::from_socket) method if you retrieved your connected Wayland socket through
/// [`from_socket()`][Self::from_socket()] method if you retrieved your connected Wayland socket through
/// other means.
///
/// In case you need to plug yourself into an external Wayland connection that you don't control, you'll
/// likely get access to it as a [`Backend`], in which case you can create a [`Connection`] from it using
/// the [`from_backend`](Connection::from_backend) method.
/// the [`from_backend()`][Self::from_backend()] method.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Connection {
pub(crate) backend: Backend,
Expand Down Expand Up @@ -129,10 +129,10 @@ impl Connection {
///
/// This is needed if you plan to wait on readiness of the Wayland socket using an event loop. See
/// [`ReadEventsGuard`] for details. Once the events are received, you'll then need to dispatch them from
/// their event queues using [`EventQueue::dispatch_pending()`](EventQueue::dispatch_pending).
/// their event queues using [`EventQueue::dispatch_pending()`].
///
/// If you don't need to manage multiple event sources, see
/// [`blocking_dispatch()`](EventQueue::blocking_dispatch) for a simpler mechanism.
/// [`EventQueue::blocking_dispatch()`] for a simpler mechanism.
#[must_use]
pub fn prepare_read(&self) -> Option<ReadEventsGuard> {
self.backend.prepare_read()
Expand Down Expand Up @@ -188,8 +188,8 @@ impl Connection {
/// Send a request associated with the provided object
///
/// This is a low-level interface used by the code generated by `wayland-scanner`, you will likely
/// instead use the methods of the types representing each interface, or the [`Proxy::send_request`] and
/// [`Proxy::send_constructor`]
/// instead use the methods of the types representing each interface, or the [`Proxy::send_request()`] and
/// [`Proxy::send_constructor()`].
pub fn send_request<I: Proxy>(
&self,
proxy: &I,
Expand All @@ -209,7 +209,7 @@ impl Connection {
/// Get the object data for a given object ID
///
/// This is a low-level interface used by the code generated by `wayland-scanner`, a higher-level
/// interface for manipulating the user-data assocated to [`Dispatch`](crate::Dispatch) implementations
/// interface for manipulating the user-data assocated to [`Dispatch`][crate::Dispatch] implementations
/// is given as [`Proxy::data()`]. Also see [`Proxy::object_data()`].
pub fn get_object_data(&self, id: ObjectId) -> Result<Arc<dyn ObjectData>, InvalidId> {
self.backend.get_data(id)
Expand Down Expand Up @@ -272,7 +272,7 @@ impl fmt::Display for ConnectError {
}

impl AsFd for Connection {
/// Provides fd from [`Backend::poll_fd`] for polling.
/// Provides fd from [`Backend::poll_fd()`] for polling.
fn as_fd(&self) -> BorrowedFd<'_> {
self.backend.poll_fd()
}
Expand Down
Loading

0 comments on commit a8b218e

Please sign in to comment.