Program Rust
parse_digits_into_seq_loop
This Rust is the input prepared for Aeneas. Modeling choices explains the adaptations from the production source.
255 // parser context while retaining the same wrapping digit test and updates.256 fn parse_digits_into_seq<'a>(s: &'a [u8], d: &mut DecimalSeq) -> &'a [u8] {257 let mut count = 0;258 while count < s.len() && s[count].wrapping_sub(b'0') < 10 {259 let digit = s[count].wrapping_sub(b'0');260 d.try_add_digit(digit);261 count += 1;262 }263 &s[count..]264 }265 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)Other extracted objects at this span
Source details
| Declaration | num.imp.dec2flt.decimal_seq.parse_digits_into_seq_loop |
|---|---|
| File | num/imp/../../dec2flt/decimal_seq.rs |
| Lines | 258:4–262:5 |
| Program version | Preparation 2 |