Source context

Program Rust

try_parse_digits_loop1

This Rust is the input prepared for Aeneas. Modeling choices explains the adaptations from the production source.

47     // only parser use: identical wrapping digit classification, accumulator48     // update, and first-nondigit stop, without an unsupported closure state.49     let mut count = 0;50     while count < s.len() && s[count].wrapping_sub(b'0') < 10 {51         let digit = s[count].wrapping_sub(b'0');52         x = x.wrapping_mul(10).wrapping_add(digit as _);53         count += 1;54     }55     s = &s[count..];56 57     (s, x)

Aeneas declaration

The Lean below was mechanically extracted by Aeneas from Rust.

@[rust_loop]
def num.imp.dec2flt.parse.try_parse_digits_loop1
  (s : Slice Std.U8) (x : Std.U64) (count : Std.Usize) :
  Result (Std.U64 × Std.Usize)
  := do
  loop
    (fun (x1, count1) => num.imp.dec2flt.parse.try_parse_digits_loop1.body s x1
      count1)
    (x, count)
Operations used here

body · Program Rust

Other extracted objects at this span

num.imp.dec2flt.parse.try_parse_digits_loop1.body

Source details
Declarationnum.imp.dec2flt.parse.try_parse_digits_loop1
Filenum/imp/../../dec2flt/parse.rs
Lines50:4–54:5
Program versionOriginal program