We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c1ea0c7 commit 8b7dadcCopy full SHA for 8b7dadc
rust/kernel/init.rs
@@ -643,7 +643,29 @@ where
643
644
/// Trait facilitating pinned destruction.
645
///
646
-/// Use [`pinned_drop`] to implement this trait safely.
+/// Use [`pinned_drop`] to implement this trait safely:
647
+/// ```rust
648
+/// # use kernel::sync::Mutex;
649
+/// use kernel::macros::pinned_drop;
650
+/// #[pin_project]
651
+/// struct Foo {
652
+/// #[pin]
653
+/// mtx: Mutex<usize>,
654
+/// }
655
+///
656
+/// #[pinned_drop]
657
+/// impl PinnedDrop for Foo {
658
+/// fn drop(self: Pin<&mut Self>) {
659
+/// pr_info!("Foo is being dropped!");
660
661
662
+/// ```
663
664
+/// # Safety
665
666
+/// This trait must be implemented with [`pinned_drop`].
667
668
+/// [`pinned_drop`]: kernel::macros::pinned_drop
669
pub unsafe trait PinnedDrop {
670
/// # Safety
671
0 commit comments