Skip to content

Commit 841f31d

Browse files
Gnurouojeda
authored andcommitted
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: 01e345e ("rust: num: add Bounded integer wrapping type") Signed-off-by: Alexandre Courbot <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
1 parent bc197e2 commit 841f31d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

rust/kernel/num/bounded.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,11 @@ fn fits_within<T: Integer>(value: T, num_bits: u32) -> bool {
218218
/// use kernel::num::{Bounded, TryIntoBounded};
219219
///
220220
/// // 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();
222222
/// assert_eq!(v.as_deref().copied(), Some(128));
223223
///
224224
/// // 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();
226226
/// assert_eq!(v, None);
227227
/// ```
228228
#[repr(transparent)]
@@ -498,18 +498,18 @@ where
498498
/// use kernel::num::{Bounded, TryIntoBounded};
499499
///
500500
/// // 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();
502502
/// assert_eq!(v.as_deref().copied(), Some(128));
503503
///
504504
/// // 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();
506506
/// assert_eq!(v, None);
507507
/// ```
508508
pub trait TryIntoBounded<T: Integer, const N: u32> {
509509
/// Attempts to convert `self` into a [`Bounded`] using `N` bits.
510510
///
511511
/// 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>>;
513513
}
514514

515515
/// Any integer value can be attempted to be converted into a [`Bounded`] of any size.
@@ -518,7 +518,7 @@ where
518518
T: Integer,
519519
U: TryInto<T>,
520520
{
521-
fn try_into_bitint(self) -> Option<Bounded<T, N>> {
521+
fn try_into_bounded(self) -> Option<Bounded<T, N>> {
522522
self.try_into().ok().and_then(Bounded::try_new)
523523
}
524524
}

0 commit comments

Comments
 (0)