[v3,10/13] rust: prelude: add `pin-init` API items to prelude

Message ID 20230329223239.138757-11-y86-dev@protonmail.com
State New
Headers
Series Rust pin-init API for pinned initialization of structs |

Commit Message

y86-dev March 29, 2023, 10:33 p.m. UTC
  From: Benno Lossin <y86-dev@protonmail.com>

Add `pin-init` API macros and traits to the prelude.

Signed-off-by: Benno Lossin <y86-dev@protonmail.com>
---
 rust/kernel/prelude.rs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--
2.39.2
  

Comments

Gary Guo March 30, 2023, 11:07 a.m. UTC | #1
On Wed, 29 Mar 2023 22:33:40 +0000
y86-dev@protonmail.com wrote:

> From: Benno Lossin <y86-dev@protonmail.com>
> 
> Add `pin-init` API macros and traits to the prelude.
> 
> Signed-off-by: Benno Lossin <y86-dev@protonmail.com>

Reviewed-by: Gary Guo <gary@garyguo.net>

> ---
>  rust/kernel/prelude.rs | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/rust/kernel/prelude.rs b/rust/kernel/prelude.rs
> index 0bc1c97e5604..fcdc511d2ce8 100644
> --- a/rust/kernel/prelude.rs
> +++ b/rust/kernel/prelude.rs
> @@ -18,7 +18,7 @@ pub use core::pin::Pin;
>  pub use alloc::{boxed::Box, vec::Vec};
> 
>  #[doc(no_inline)]
> -pub use macros::{module, vtable};
> +pub use macros::{module, pin_data, pinned_drop, vtable};
> 
>  pub use super::build_assert;
> 
> @@ -27,8 +27,12 @@ pub use super::build_assert;
>  pub use super::dbg;
>  pub use super::{pr_alert, pr_crit, pr_debug, pr_emerg, pr_err, pr_info, pr_notice, pr_warn};
> 
> +pub use super::{init, pin_init, try_init, try_pin_init};
> +
>  pub use super::static_assert;
> 
>  pub use super::error::{code::*, Error, Result};
> 
>  pub use super::{str::CStr, ThisModule};
> +
> +pub use super::init::{InPlaceInit, Init, PinInit};
> --
> 2.39.2
> 
>
  
Alice Ryhl March 31, 2023, 6:58 a.m. UTC | #2
On 3/30/23 00:33, y86-dev@protonmail.com wrote:
> From: Benno Lossin <y86-dev@protonmail.com>
> 
> Add `pin-init` API macros and traits to the prelude.
> 
> Signed-off-by: Benno Lossin <y86-dev@protonmail.com>

Reviewed-by: Alice Ryhl <aliceryhl@google.com>
  
Andreas Hindborg March 31, 2023, 12:50 p.m. UTC | #3
y86-dev@protonmail.com writes:

> From: Benno Lossin <y86-dev@protonmail.com>
>
> Add `pin-init` API macros and traits to the prelude.
>
> Signed-off-by: Benno Lossin <y86-dev@protonmail.com>
> ---

Reviewed-by: Andreas Hindborg <a.hindborg@samsung.com>

>  rust/kernel/prelude.rs | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/rust/kernel/prelude.rs b/rust/kernel/prelude.rs
> index 0bc1c97e5604..fcdc511d2ce8 100644
> --- a/rust/kernel/prelude.rs
> +++ b/rust/kernel/prelude.rs
> @@ -18,7 +18,7 @@ pub use core::pin::Pin;
>  pub use alloc::{boxed::Box, vec::Vec};
>
>  #[doc(no_inline)]
> -pub use macros::{module, vtable};
> +pub use macros::{module, pin_data, pinned_drop, vtable};
>
>  pub use super::build_assert;
>
> @@ -27,8 +27,12 @@ pub use super::build_assert;
>  pub use super::dbg;
>  pub use super::{pr_alert, pr_crit, pr_debug, pr_emerg, pr_err, pr_info, pr_notice, pr_warn};
>
> +pub use super::{init, pin_init, try_init, try_pin_init};
> +
>  pub use super::static_assert;
>
>  pub use super::error::{code::*, Error, Result};
>
>  pub use super::{str::CStr, ThisModule};
> +
> +pub use super::init::{InPlaceInit, Init, PinInit};
  

Patch

diff --git a/rust/kernel/prelude.rs b/rust/kernel/prelude.rs
index 0bc1c97e5604..fcdc511d2ce8 100644
--- a/rust/kernel/prelude.rs
+++ b/rust/kernel/prelude.rs
@@ -18,7 +18,7 @@  pub use core::pin::Pin;
 pub use alloc::{boxed::Box, vec::Vec};

 #[doc(no_inline)]
-pub use macros::{module, vtable};
+pub use macros::{module, pin_data, pinned_drop, vtable};

 pub use super::build_assert;

@@ -27,8 +27,12 @@  pub use super::build_assert;
 pub use super::dbg;
 pub use super::{pr_alert, pr_crit, pr_debug, pr_emerg, pr_err, pr_info, pr_notice, pr_warn};

+pub use super::{init, pin_init, try_init, try_pin_init};
+
 pub use super::static_assert;

 pub use super::error::{code::*, Error, Result};

 pub use super::{str::CStr, ThisModule};
+
+pub use super::init::{InPlaceInit, Init, PinInit};