34
34
//! [`pin_init!`]. The syntax is almost the same as normal `struct` initializers. The difference is
35
35
//! that you need to write `<-` instead of `:` for fields that you want to initialize in-place.
36
36
//!
37
- //! ```rust
37
+ //! ```rust,ignore
38
38
//! # #![expect(clippy::disallowed_names)]
39
39
//! use kernel::sync::{new_mutex, Mutex};
40
40
//! # use core::pin::Pin;
54
54
//! `foo` now is of the type [`impl PinInit<Foo>`]. We can now use any smart pointer that we like
55
55
//! (or just the stack) to actually initialize a `Foo`:
56
56
//!
57
- //! ```rust
57
+ //! ```rust,ignore
58
58
//! # #![expect(clippy::disallowed_names)]
59
59
//! # use kernel::sync::{new_mutex, Mutex};
60
60
//! # use core::pin::Pin;
78
78
//! Many types from the kernel supply a function/macro that returns an initializer, because the
79
79
//! above method only works for types where you can access the fields.
80
80
//!
81
- //! ```rust
81
+ //! ```rust,ignore
82
82
//! # use kernel::sync::{new_mutex, Arc, Mutex};
83
83
//! let mtx: Result<Arc<Mutex<usize>>> =
84
84
//! Arc::pin_init(new_mutex!(42, "example::mtx"), GFP_KERNEL);
85
85
//! ```
86
86
//!
87
87
//! To declare an init macro/function you just return an [`impl PinInit<T, E>`]:
88
88
//!
89
- //! ```rust
89
+ //! ```rust,ignore
90
90
//! # use kernel::{sync::Mutex, new_mutex, init::PinInit, try_pin_init};
91
91
//! #[pin_data]
92
92
//! struct DriverData {
119
119
//! - you may assume that `slot` will stay pinned even after the closure returns until `drop` of
120
120
//! `slot` gets called.
121
121
//!
122
- //! ```rust
122
+ //! ```rust,ignore
123
123
//! # #![expect(unreachable_pub, clippy::disallowed_names)]
124
124
//! use kernel::{init, types::Opaque};
125
125
//! use core::{ptr::addr_of_mut, marker::PhantomPinned, pin::Pin};
@@ -236,7 +236,7 @@ pub mod macros;
236
236
///
237
237
/// # Examples
238
238
///
239
- /// ```rust
239
+ /// ```rust,ignore
240
240
/// # #![expect(clippy::disallowed_names)]
241
241
/// # use kernel::{init, macros::pin_data, pin_init, stack_pin_init, init::*, sync::Mutex, new_mutex};
242
242
/// # use core::pin::Pin;
@@ -382,7 +382,7 @@ macro_rules! stack_try_pin_init {
382
382
///
383
383
/// The syntax is almost identical to that of a normal `struct` initializer:
384
384
///
385
- /// ```rust
385
+ /// ```rust,ignore
386
386
/// # use kernel::{init, pin_init, macros::pin_data, init::*};
387
387
/// # use core::pin::Pin;
388
388
/// #[pin_data]
@@ -426,7 +426,7 @@ macro_rules! stack_try_pin_init {
426
426
///
427
427
/// To create an initializer function, simply declare it like this:
428
428
///
429
- /// ```rust
429
+ /// ```rust,ignore
430
430
/// # use kernel::{init, pin_init, init::*};
431
431
/// # use core::pin::Pin;
432
432
/// # #[pin_data]
@@ -452,7 +452,7 @@ macro_rules! stack_try_pin_init {
452
452
///
453
453
/// Users of `Foo` can now create it like this:
454
454
///
455
- /// ```rust
455
+ /// ```rust,ignore
456
456
/// # #![expect(clippy::disallowed_names)]
457
457
/// # use kernel::{init, pin_init, macros::pin_data, init::*};
458
458
/// # use core::pin::Pin;
@@ -480,7 +480,7 @@ macro_rules! stack_try_pin_init {
480
480
///
481
481
/// They can also easily embed it into their own `struct`s:
482
482
///
483
- /// ```rust
483
+ /// ```rust,ignore
484
484
/// # use kernel::{init, pin_init, macros::pin_data, init::*};
485
485
/// # use core::pin::Pin;
486
486
/// # #[pin_data]
@@ -539,7 +539,7 @@ macro_rules! stack_try_pin_init {
539
539
///
540
540
/// For instance:
541
541
///
542
- /// ```rust
542
+ /// ```rust,ignore
543
543
/// # use kernel::{macros::{Zeroable, pin_data}, pin_init};
544
544
/// # use core::{ptr::addr_of_mut, marker::PhantomPinned};
545
545
/// #[pin_data]
@@ -602,7 +602,7 @@ macro_rules! pin_init {
602
602
///
603
603
/// # Examples
604
604
///
605
- /// ```rust
605
+ /// ```rust,ignore
606
606
/// use kernel::{init::{self, PinInit}, error::Error};
607
607
/// #[pin_data]
608
608
/// struct BigBuf {
@@ -705,7 +705,7 @@ macro_rules! init {
705
705
///
706
706
/// # Examples
707
707
///
708
- /// ```rust
708
+ /// ```rust,ignore
709
709
/// use kernel::{alloc::KBox, init::{PinInit, zeroed}, error::Error};
710
710
/// struct BigBuf {
711
711
/// big: KBox<[u8; 1024 * 1024 * 1024]>,
@@ -761,7 +761,7 @@ macro_rules! try_init {
761
761
/// # Example
762
762
///
763
763
/// This will succeed:
764
- /// ```
764
+ /// ```ignore
765
765
/// use kernel::assert_pinned;
766
766
/// #[pin_data]
767
767
/// struct MyStruct {
@@ -787,7 +787,7 @@ macro_rules! try_init {
787
787
/// Some uses of the macro may trigger the `can't use generic parameters from outer item` error. To
788
788
/// work around this, you may pass the `inline` parameter to the macro. The `inline` parameter can
789
789
/// only be used when the macro is invoked from a function body.
790
- /// ```
790
+ /// ```ignore
791
791
/// use kernel::assert_pinned;
792
792
/// #[pin_data]
793
793
/// struct Foo<T> {
@@ -865,7 +865,7 @@ pub unsafe trait PinInit<T: ?Sized, E = Infallible>: Sized {
865
865
///
866
866
/// # Examples
867
867
///
868
- /// ```rust
868
+ /// ```rust,ignore
869
869
/// # #![expect(clippy::disallowed_names)]
870
870
/// use kernel::{types::Opaque, init::pin_init_from_closure};
871
871
/// #[repr(C)]
@@ -977,7 +977,7 @@ pub unsafe trait Init<T: ?Sized, E = Infallible>: PinInit<T, E> {
977
977
///
978
978
/// # Examples
979
979
///
980
- /// ```rust
980
+ /// ```rust,ignore
981
981
/// # #![expect(clippy::disallowed_names)]
982
982
/// use kernel::{types::Opaque, init::{self, init_from_closure}};
983
983
/// struct Foo {
@@ -1089,7 +1089,7 @@ pub fn uninit<T, E>() -> impl Init<MaybeUninit<T>, E> {
1089
1089
///
1090
1090
/// # Examples
1091
1091
///
1092
- /// ```rust
1092
+ /// ```rust,ignore
1093
1093
/// use kernel::{alloc::KBox, error::Error, init::init_array_from_fn};
1094
1094
/// let array: KBox<[usize; 1_000]> =
1095
1095
/// KBox::init::<Error>(init_array_from_fn(|i| i), GFP_KERNEL)?;
@@ -1134,7 +1134,7 @@ where
1134
1134
///
1135
1135
/// # Examples
1136
1136
///
1137
- /// ```rust
1137
+ /// ```rust,ignore
1138
1138
/// use kernel::{sync::{Arc, Mutex}, init::pin_init_array_from_fn, new_mutex};
1139
1139
/// let array: Arc<[Mutex<usize>; 1_000]> =
1140
1140
/// Arc::pin_init(pin_init_array_from_fn(|i| new_mutex!(i)), GFP_KERNEL)?;
@@ -1323,7 +1323,7 @@ impl<T> InPlaceWrite<T> for UniqueArc<MaybeUninit<T>> {
1323
1323
///
1324
1324
/// Use [`pinned_drop`] to implement this trait safely:
1325
1325
///
1326
- /// ```rust
1326
+ /// ```rust,ignore
1327
1327
/// # use kernel::sync::Mutex;
1328
1328
/// use kernel::macros::pinned_drop;
1329
1329
/// use core::pin::Pin;
0 commit comments