Source context

Program Rust

parse_digits_into_seq_loop

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

256 // parser context while retaining the same wrapping digit test and updates.257 fn parse_digits_into_seq<'a>(s: &'a [u8], d: &mut DecimalSeq) -> &'a [u8] {258     let mut count = 0;259     while count < s.len() && s[count].wrapping_sub(b'0') < 10 {260         let digit = s[count].wrapping_sub(b'0');261         d.try_add_digit(digit);262         count += 1;263     }264     &s[count..]265 }266 

Aeneas declaration

The Lean below was mechanically extracted by Aeneas from Rust.

@[rust_loop]
def num.imp.dec2flt.decimal_seq.parse_digits_into_seq_loop
  (s : Slice Std.U8) (d : num.imp.dec2flt.decimal_seq.DecimalSeq)
  (count : Std.Usize) :
  Result (num.imp.dec2flt.decimal_seq.DecimalSeq × Std.Usize)
  := do
  loop
    (fun (d1, count1) =>
      num.imp.dec2flt.decimal_seq.parse_digits_into_seq_loop.body s d1 count1)
    (d, count)
Operations used here

DecimalSeq · Program Rust

body · Program Rust

Other extracted objects at this span

num.imp.dec2flt.decimal_seq.parse_digits_into_seq_loop.body

Source details
Declarationnum.imp.dec2flt.decimal_seq.parse_digits_into_seq_loop
Filenum/imp/../../dec2flt/decimal_seq.rs
Lines259:4–263:5
Program versionRevised program