lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <BB9E9B40-10F3-425D-BC44-C20B58F6E4EE@collabora.com>
Date: Fri, 6 Feb 2026 15:29:10 -0300
From: Daniel Almeida <daniel.almeida@...labora.com>
To: Alexandre Courbot <acourbot@...dia.com>
Cc: Danilo Krummrich <dakr@...nel.org>,
 Alice Ryhl <aliceryhl@...gle.com>,
 Miguel Ojeda <ojeda@...nel.org>,
 Boqun Feng <boqun.feng@...il.com>,
 Gary Guo <gary@...yguo.net>,
 Björn Roy Baron <bjorn3_gh@...tonmail.com>,
 Benno Lossin <lossin@...nel.org>,
 Andreas Hindborg <a.hindborg@...nel.org>,
 Trevor Gross <tmgross@...ch.edu>,
 Yury Norov <yury.norov@...il.com>,
 John Hubbard <jhubbard@...dia.com>,
 Alistair Popple <apopple@...dia.com>,
 Joel Fernandes <joelagnelf@...dia.com>,
 Timur Tabi <ttabi@...dia.com>,
 Edwin Peer <epeer@...dia.com>,
 Eliot Courtney <ecourtney@...dia.com>,
 Dirk Behme <dirk.behme@...bosch.com>,
 Steven Price <steven.price@....com>,
 rust-for-linux@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 4/7] rust: num: add `into_inner` method to `Bounded`



> On 29 Jan 2026, at 10:32, Alexandre Courbot <acourbot@...dia.com> wrote:
> 
> This is useful to access the inner value in const contexts.
> 
> Signed-off-by: Alexandre Courbot <acourbot@...dia.com>
> ---
> rust/kernel/num/bounded.rs | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
> 
> diff --git a/rust/kernel/num/bounded.rs b/rust/kernel/num/bounded.rs
> index b41ca6df1525..850827033f67 100644
> --- a/rust/kernel/num/bounded.rs
> +++ b/rust/kernel/num/bounded.rs
> @@ -388,6 +388,22 @@ pub fn get(self) -> T {
>         *self.deref()
>     }
> 
> +    /// Returns the wrapped value as the backing type.
> +    ///
> +    /// This is a const-friendly variant of [`Self::get`] that can be used in const contexts.
> +    ///
> +    /// # Examples
> +    ///
> +    /// ```
> +    /// use kernel::num::Bounded;
> +    ///
> +    /// const V: u32 = Bounded::<u32, 4>::new::<7>().into_inner();
> +    /// assert_eq!(V, 7u32);
> +    /// ```
> +    pub const fn into_inner(self) -> T {
> +        self.0
> +    }
> +
>     /// Increases the number of bits usable for `self`.
>     ///
>     /// This operation cannot fail.
> 
> -- 
> 2.52.0
> 
> 

Reviewed-by: Daniel Almeida <daniel.almeida@...labora.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ