Source context

Program Rust

ByteSlice

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

1 //! Common utilities, for internal use only.2 3 /// Helper methods to process immutable bytes.4 pub(crate) trait ByteSlice {5     // The removed closure-based parse_digits operation is specialized at its6     // former call sites in parse.rs and decimal_seq.rs. Their comments record7     // the same byte test, callback update order, and first-nondigit suffix;8     // removing this unused trait method adds no new source behavior.9     /// Reads 8 bytes as a 64-bit integer in little-endian order.10     fn read_u64(&self) -> u64;11 12     /// Writes a 64-bit integer as 8 bytes in little-endian order.13     fn write_u64(&mut self, value: u64);14 15     /// Calculate the difference in length between two slices.16     fn offset_from(&self, other: &Self) -> isize;17 18 }19 20 impl ByteSlice for [u8] {21     #[inline(always)] // inlining this is crucial to remove bound checks

Aeneas declaration

The Lean below was mechanically extracted by Aeneas from Rust.

structure num.imp.dec2flt.common.ByteSlice (Self : Type) where
  read_u64 : Self → Result Std.U64
  write_u64 : Self → Std.U64 → Result Self
  offset_from : Self → Self → Result Std.Isize
Source details
Declarationnum.imp.dec2flt.common.ByteSlice
Filenum/imp/../../dec2flt/common.rs
Lines4:0–18:1
Program versionRevised program