Skip to content

Commit e070f57

Browse files
committed
rust: init: Update documentation for new mutex init style
Signed-off-by: Asahi Lina <[email protected]>
1 parent 7dc72a3 commit e070f57

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

rust/kernel/init.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
//!
3737
//! ```rust
3838
//! # #![allow(clippy::disallowed_names, clippy::new_ret_no_self)]
39-
//! use kernel::{prelude::*, sync::Mutex, new_mutex};
39+
//! use kernel::{prelude::*, sync::Mutex};
4040
//! # use core::pin::Pin;
4141
//! #[pin_data]
4242
//! struct Foo {
@@ -46,7 +46,7 @@
4646
//! }
4747
//!
4848
//! let foo = pin_init!(Foo {
49-
//! a <- new_mutex!(42, "Foo::a"),
49+
//! a <- Mutex::new_named(42, "Foo::a"),
5050
//! b: 24,
5151
//! });
5252
//! ```
@@ -56,7 +56,7 @@
5656
//!
5757
//! ```rust
5858
//! # #![allow(clippy::disallowed_names, clippy::new_ret_no_self)]
59-
//! # use kernel::{prelude::*, sync::Mutex, new_mutex};
59+
//! # use kernel::{prelude::*, sync::Mutex};
6060
//! # use core::pin::Pin;
6161
//! # #[pin_data]
6262
//! # struct Foo {
@@ -65,7 +65,7 @@
6565
//! # b: u32,
6666
//! # }
6767
//! # let foo = pin_init!(Foo {
68-
//! # a <- new_mutex!(42, "Foo::a"),
68+
//! # a <- Mutex::new_named(42, "Foo::a"),
6969
//! # b: 24,
7070
//! # });
7171
//! let foo: Result<Pin<Box<Foo>>> = Box::pin_init(foo);
@@ -98,7 +98,7 @@
9898
//! impl DriverData {
9999
//! fn new() -> impl PinInit<Self, Error> {
100100
//! try_pin_init!(Self {
101-
//! status <- new_mutex!(0, "DriverData::status"),
101+
//! status <- Mutex::new_named(0, "DriverData::status"),
102102
//! buffer: Box::init(kernel::init::zeroed())?,
103103
//! })
104104
//! }
@@ -240,7 +240,7 @@ pub mod macros;
240240
/// }
241241
///
242242
/// stack_pin_init!(let foo = pin_init!(Foo {
243-
/// a <- new_mutex!(42),
243+
/// a <- Mutex::new(42),
244244
/// b: Bar {
245245
/// x: 64,
246246
/// },
@@ -290,7 +290,7 @@ macro_rules! stack_pin_init {
290290
/// }
291291
///
292292
/// stack_try_pin_init!(let foo: Result<Pin<&mut Foo>, AllocError> = pin_init!(Foo {
293-
/// a <- new_mutex!(42),
293+
/// a <- Mutex::new(42),
294294
/// b: Box::try_new(Bar {
295295
/// x: 64,
296296
/// })?,
@@ -316,7 +316,7 @@ macro_rules! stack_pin_init {
316316
/// }
317317
///
318318
/// stack_try_pin_init!(let foo: Pin<&mut Foo> =? pin_init!(Foo {
319-
/// a <- new_mutex!(42),
319+
/// a <- Mutex::new(42),
320320
/// b: Box::try_new(Bar {
321321
/// x: 64,
322322
/// })?,
@@ -1435,7 +1435,7 @@ where
14351435
///
14361436
/// ```rust
14371437
/// let array: Arc<[Mutex<usize>; 1000_000_000]>=
1438-
/// Arc::pin_init(init_array_from_fn(|i| new_mutex!(i))).unwrap();
1438+
/// Arc::pin_init(init_array_from_fn(|i| Mutex::new(i))).unwrap();
14391439
/// println!("{array:?}");
14401440
/// ```
14411441
pub fn pin_init_array_from_fn<I, const N: usize, T, E>(

0 commit comments

Comments
 (0)