Skip to content

Commit 48310c1

Browse files
Speedy37cuviper
authored andcommitted
document IterUxDigits structs
1 parent 3ee03f0 commit 48310c1

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/biguint.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2288,11 +2288,18 @@ pub(crate) fn to_str_radix_reversed(u: &BigUint, radix: u32) -> Vec<u8> {
22882288
res
22892289
}
22902290

2291-
#[cfg(u64_digit)]
2291+
/// An iterator of `u32` digits representation of the `BigUint` ordered least
2292+
/// significant digit first.
22922293
pub struct IterU32Digits<'a> {
2294+
#[cfg(u64_digit)]
22932295
data: &'a [u64],
2296+
#[cfg(u64_digit)]
22942297
next_is_lo: bool,
2298+
#[cfg(u64_digit)]
22952299
last_hi_is_zero: bool,
2300+
2301+
#[cfg(not(u64_digit))]
2302+
it: core::slice::Iter<'a, u32>,
22962303
}
22972304
#[cfg(u64_digit)]
22982305
impl<'a> IterU32Digits<'a> {
@@ -2361,10 +2368,6 @@ impl<'a> ExactSizeIterator for IterU32Digits<'a> {
23612368
}
23622369
}
23632370

2364-
#[cfg(not(u64_digit))]
2365-
pub struct IterU32Digits<'a> {
2366-
it: core::slice::Iter<'a, u32>,
2367-
}
23682371
#[cfg(not(u64_digit))]
23692372
impl<'a> IterU32Digits<'a> {
23702373
fn new(data: &'a [u32]) -> Self {
@@ -2403,9 +2406,14 @@ impl<'a> ExactSizeIterator for IterU32Digits<'a> {
24032406

24042407
impl<'a> FusedIterator for IterU32Digits<'a> {}
24052408

2406-
#[cfg(not(u64_digit))]
2409+
/// An iterator of `u64` digits representation of the `BigUint` ordered least
2410+
/// significant digit first.
24072411
pub struct IterU64Digits<'a> {
2412+
#[cfg(not(u64_digit))]
24082413
it: core::slice::Chunks<'a, u32>,
2414+
2415+
#[cfg(u64_digit)]
2416+
it: core::slice::Iter<'a, u64>,
24092417
}
24102418
#[cfg(not(u64_digit))]
24112419
impl<'a> IterU64Digits<'a> {
@@ -2441,10 +2449,6 @@ impl<'a> ExactSizeIterator for IterU64Digits<'a> {
24412449
}
24422450
}
24432451

2444-
#[cfg(u64_digit)]
2445-
pub struct IterU64Digits<'a> {
2446-
it: core::slice::Iter<'a, u64>,
2447-
}
24482452
#[cfg(u64_digit)]
24492453
impl<'a> IterU64Digits<'a> {
24502454
fn new(data: &'a [u64]) -> Self {

0 commit comments

Comments
 (0)