1212//!
1313//! # The raw API
1414//!
15- //! The raw API consists of the `RawWorkItem` trait, where the work item needs to provide an
15+ //! The raw API consists of the [ `RawWorkItem`] trait, where the work item needs to provide an
1616//! arbitrary function that knows how to enqueue the work item. It should usually not be used
1717//! directly, but if you want to, you can use it without using the pieces from the safe API.
1818//!
1919//! # The safe API
2020//!
21- //! The safe API is used via the `Work` struct and `WorkItem` traits. Furthermore, it also includes
22- //! a trait called `WorkItemPointer`, which is usually not used directly by the user.
21+ //! The safe API is used via the [ `Work`] struct and [ `WorkItem`] traits. Furthermore, it also
22+ //! includes a trait called [ `WorkItemPointer`] , which is usually not used directly by the user.
2323//!
24- //! * The `Work` struct is the Rust wrapper for the C `work_struct` type.
25- //! * The `WorkItem` trait is implemented for structs that can be enqueued to a workqueue.
26- //! * The `WorkItemPointer` trait is implemented for the pointer type that points at a something
27- //! that implements `WorkItem`.
24+ //! * The [ `Work`] struct is the Rust wrapper for the C `work_struct` type.
25+ //! * The [ `WorkItem`] trait is implemented for structs that can be enqueued to a workqueue.
26+ //! * The [ `WorkItemPointer`] trait is implemented for the pointer type that points at a something
27+ //! that implements [ `WorkItem`] .
2828//!
2929//! ## Example
3030//!
@@ -218,7 +218,9 @@ impl Queue {
218218 }
219219}
220220
221- /// A helper type used in `try_spawn`.
221+ /// A helper type used in [`try_spawn`].
222+ ///
223+ /// [`try_spawn`]: Queue::try_spawn
222224#[ pin_data]
223225struct ClosureWork < T > {
224226 #[ pin]
@@ -258,9 +260,11 @@ impl<T: FnOnce()> WorkItem for ClosureWork<T> {
258260///
259261/// # Safety
260262///
261- /// Implementers must ensure that any pointers passed to a `queue_work_on` closure by `__enqueue`
263+ /// Implementers must ensure that any pointers passed to a `queue_work_on` closure by [ `__enqueue`]
262264/// remain valid for the duration specified in the guarantees section of the documentation for
263- /// `__enqueue`.
265+ /// [`__enqueue`].
266+ ///
267+ /// [`__enqueue`]: RawWorkItem::__enqueue
264268pub unsafe trait RawWorkItem < const ID : u64 > {
265269 /// The return type of [`Queue::enqueue`].
266270 type EnqueueOutput ;
@@ -290,10 +294,11 @@ pub unsafe trait RawWorkItem<const ID: u64> {
290294
291295/// Defines the method that should be called directly when a work item is executed.
292296///
293- /// This trait is implemented by `Pin<Box<T>>` and `Arc<T>`, and is mainly intended to be
297+ /// This trait is implemented by `Pin<Box<T>>` and [ `Arc<T>`] , and is mainly intended to be
294298/// implemented for smart pointer types. For your own structs, you would implement [`WorkItem`]
295- /// instead. The `run` method on this trait will usually just perform the appropriate
296- /// `container_of` translation and then call into the `run` method from the [`WorkItem`] trait.
299+ /// instead. The [`run`] method on this trait will usually just perform the appropriate
300+ /// `container_of` translation and then call into the [`run`][WorkItem::run] method from the
301+ /// [`WorkItem`] trait.
297302///
298303/// This trait is used when the `work_struct` field is defined using the [`Work`] helper.
299304///
@@ -309,8 +314,10 @@ pub unsafe trait WorkItemPointer<const ID: u64>: RawWorkItem<ID> {
309314 ///
310315 /// # Safety
311316 ///
312- /// The provided `work_struct` pointer must originate from a previous call to `__enqueue` where
313- /// the `queue_work_on` closure returned true, and the pointer must still be valid.
317+ /// The provided `work_struct` pointer must originate from a previous call to [`__enqueue`]
318+ /// where the `queue_work_on` closure returned true, and the pointer must still be valid.
319+ ///
320+ /// [`__enqueue`]: RawWorkItem::__enqueue
314321 unsafe extern "C" fn run ( ptr : * mut bindings:: work_struct ) ;
315322}
316323
@@ -328,12 +335,14 @@ pub trait WorkItem<const ID: u64 = 0> {
328335
329336/// Links for a work item.
330337///
331- /// This struct contains a function pointer to the `run` function from the [`WorkItemPointer`]
338+ /// This struct contains a function pointer to the [ `run`] function from the [`WorkItemPointer`]
332339/// trait, and defines the linked list pointers necessary to enqueue a work item in a workqueue.
333340///
334341/// Wraps the kernel's C `struct work_struct`.
335342///
336343/// This is a helper type used to associate a `work_struct` with the [`WorkItem`] that uses it.
344+ ///
345+ /// [`run`]: WorkItemPointer::run
337346#[ repr( transparent) ]
338347pub struct Work < T : ?Sized , const ID : u64 = 0 > {
339348 work : Opaque < bindings:: work_struct > ,
@@ -409,7 +418,7 @@ impl<T: ?Sized, const ID: u64> Work<T, ID> {
409418/// }
410419/// ```
411420///
412- /// Note that since the `Work` type is annotated with an id, you can have several `work_struct`
421+ /// Note that since the [ `Work`] type is annotated with an id, you can have several `work_struct`
413422/// fields by using a different id for each one.
414423///
415424/// # Safety
@@ -429,7 +438,7 @@ pub unsafe trait HasWork<T, const ID: u64 = 0> {
429438 /// Returns the offset of the [`Work<T, ID>`] field.
430439 ///
431440 /// This method exists because the [`OFFSET`] constant cannot be accessed if the type is not
432- /// `Sized`.
441+ /// [ `Sized`] .
433442 ///
434443 /// [`Work<T, ID>`]: Work
435444 /// [`OFFSET`]: HasWork::OFFSET
0 commit comments