diff --git a/rust/kernel/traits.rs b/rust/kernel/traits.rs index 366de02099fbbb..79e121027b3046 100644 --- a/rust/kernel/traits.rs +++ b/rust/kernel/traits.rs @@ -1,16 +1,16 @@ // SPDX-License-Identifier: GPL-2.0 -//! Traits useful to Drivers, and their implementations for common types. +//! Traits useful to drivers, and their implementations for common types. use core::{ops::Deref, pin::Pin}; use alloc::{alloc::AllocError, sync::Arc}; -/// Trait which implements a fallible version of `pin()` for any pointer type. +/// Trait which provides a fallible version of `pin()` for pointer types. /// -/// Common pointer types which implement `pin()` include `Box`, `Arc` and `Rc`. +/// Common pointer types which implement a `pin()` method include [`Box`], [`Arc`] and [`Rc`]. pub trait TryPin { - /// Constructs a new Pin>. If T does not implement Unpin, then data + /// Constructs a new `Pin>`. If `T` does not implement [`Unpin`], then data /// will be pinned in memory and unable to be moved. An error will be returned /// if allocation fails. fn try_pin(data: P::Target) -> core::result::Result, AllocError>; @@ -18,7 +18,7 @@ pub trait TryPin { impl TryPin> for Arc { fn try_pin(data: T) -> core::result::Result>, AllocError> { - // SAFETY: the data T is exposed only through a `Pin>`, which + // SAFETY: the data `T` is exposed only through a `Pin>`, which // does not allow data to move out of the `Arc`. Therefore it can // never be moved. Ok(unsafe { Pin::new_unchecked(Arc::try_new(data)?) })