Source context

Program Rust

adjust_many_digit_count_loop

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

86 fn adjust_many_digit_count(start: &[u8], mut n_digits: isize) -> isize {87     let mut scan_index = 0;88     let mut scanning = true;89     while scan_index < start.len() && scanning {90         let c = start[scan_index];91         if c == b'.' || c == b'0' {92             n_digits -= c.saturating_sub(b'0' - 1) as isize;93             scan_index += 1;94         } else {95             scanning = false;96         }97     }98     n_digits99 }100 

Aeneas declaration

The Lean below was mechanically extracted by Aeneas from Rust.

@[rust_loop]
def num.imp.dec2flt.parse.adjust_many_digit_count_loop
  (start : Slice Std.U8) (n_digits : Std.Isize) (scan_index : Std.Usize)
  (scanning : Bool) :
  Result Std.Isize
  := do
  loop
    (fun (n_digits1, scan_index1, scanning1) =>
      num.imp.dec2flt.parse.adjust_many_digit_count_loop.body start n_digits1
      scan_index1 scanning1)
    (n_digits, scan_index, scanning)
Operations used here

body · Program Rust

Other extracted objects at this span

num.imp.dec2flt.parse.adjust_many_digit_count_loop.body

Source details
Declarationnum.imp.dec2flt.parse.adjust_many_digit_count_loop
Filenum/imp/../../dec2flt/parse.rs
Lines89:4–97:5
Program versionOriginal program