Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rust: num: bounded: rename `try_into_bitint` to `try_into_bounded`

This is a remnant from when `Bounded` was called `BitInt` which I didn't
rename. Fix this.

Fixes: 01e345e82ec3 ("rust: num: add Bounded integer wrapping type")
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Link: https://patch.msgid.link/20251124-bounded_fix-v1-1-d8e34e1c727f@nvidia.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

authored by

Alexandre Courbot and committed by
Miguel Ojeda
841f31d2 bc197e24

+6 -6
+6 -6
rust/kernel/num/bounded.rs
··· 218 218 /// use kernel::num::{Bounded, TryIntoBounded}; 219 219 /// 220 220 /// // Succeeds because `128` fits into 8 bits. 221 - /// let v: Option<Bounded<u16, 8>> = 128u32.try_into_bitint(); 221 + /// let v: Option<Bounded<u16, 8>> = 128u32.try_into_bounded(); 222 222 /// assert_eq!(v.as_deref().copied(), Some(128)); 223 223 /// 224 224 /// // Fails because `128` doesn't fits into 6 bits. 225 - /// let v: Option<Bounded<u16, 6>> = 128u32.try_into_bitint(); 225 + /// let v: Option<Bounded<u16, 6>> = 128u32.try_into_bounded(); 226 226 /// assert_eq!(v, None); 227 227 /// ``` 228 228 #[repr(transparent)] ··· 498 498 /// use kernel::num::{Bounded, TryIntoBounded}; 499 499 /// 500 500 /// // Succeeds because `128` fits into 8 bits. 501 - /// let v: Option<Bounded<u16, 8>> = 128u32.try_into_bitint(); 501 + /// let v: Option<Bounded<u16, 8>> = 128u32.try_into_bounded(); 502 502 /// assert_eq!(v.as_deref().copied(), Some(128)); 503 503 /// 504 504 /// // Fails because `128` doesn't fits into 6 bits. 505 - /// let v: Option<Bounded<u16, 6>> = 128u32.try_into_bitint(); 505 + /// let v: Option<Bounded<u16, 6>> = 128u32.try_into_bounded(); 506 506 /// assert_eq!(v, None); 507 507 /// ``` 508 508 pub trait TryIntoBounded<T: Integer, const N: u32> { 509 509 /// Attempts to convert `self` into a [`Bounded`] using `N` bits. 510 510 /// 511 511 /// Returns [`None`] if `self` does not fit into the target type. 512 - fn try_into_bitint(self) -> Option<Bounded<T, N>>; 512 + fn try_into_bounded(self) -> Option<Bounded<T, N>>; 513 513 } 514 514 515 515 /// Any integer value can be attempted to be converted into a [`Bounded`] of any size. ··· 518 518 T: Integer, 519 519 U: TryInto<T>, 520 520 { 521 - fn try_into_bitint(self) -> Option<Bounded<T, N>> { 521 + fn try_into_bounded(self) -> Option<Bounded<T, N>> { 522 522 self.try_into().ok().and_then(Bounded::try_new) 523 523 } 524 524 }