Skip to content

Commit fef97c6

Browse files
committed
Fixed doctests
1 parent f91ccd6 commit fef97c6

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

rust/kernel/init.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,19 @@
6868
//!
6969
//! To declare an init macro/function you just return an `impl`[`PinInit<T, E>`]:
7070
//! ```rust
71-
//! # use kernel::prelude::*;
71+
//! # use kernel::{sync::Mutex, prelude::*, new_mutex, init::PinInit};
7272
//! #[pin_project]
7373
//! struct DriverData {
74+
//! #[pin]
7475
//! status: Mutex<i32>,
7576
//! buffer: Box<[u8; 1_000_000]>,
7677
//! }
7778
//!
7879
//! impl DriverData {
79-
//! fn new() -> impl PinInit<Self Error> {
80+
//! fn new() -> impl PinInit<Self, Error> {
8081
//! pin_init!(Self {
8182
//! status: new_mutex!(0, "DriverData::status"),
82-
//! buffer: Box::init(kernel::init::zeroed()),
83+
//! buffer: Box::init(kernel::init::zeroed())?,
8384
//! })
8485
//! }
8586
//! }
@@ -192,15 +193,17 @@ macro_rules! stack_init {
192193
///
193194
/// ```rust
194195
/// # #![allow(clippy::blacklisted_name, clippy::new_ret_no_self)]
195-
/// # use kernel::{init, pin_init, pin_data, init::*};
196+
/// # use kernel::{init, pin_init, prelude::*, init::*};
196197
/// # use core::pin::Pin;
197-
/// # pin_data! { struct Foo {
198+
/// # #[pin_project]
199+
/// # struct Foo {
198200
/// # a: usize,
199201
/// # b: Bar,
200-
/// # }}
201-
/// # pin_data! { struct Bar {
202+
/// # }
203+
/// # #[pin_project]
204+
/// # struct Bar {
202205
/// # x: u32,
203-
/// # }}
206+
/// # }
204207
///
205208
/// impl Foo {
206209
/// fn new() -> impl PinInit<Self> {

0 commit comments

Comments
 (0)