Rust library
as_bytes
This is Rust standard-library source from the compiler version used in the run.
495 #[must_use]496 #[inline(always)]497 #[allow(unused_attributes)]498 pub const fn as_bytes(&self) -> &[u8] {499 // SAFETY: const sound because we transmute two types with the same layout500 unsafe { mem::transmute(self) }501 }Aeneas declaration
Aeneas generated this declaration for a Rust library operation. Any authored model recorded for this operation is shown below.
@[rust_fun "core::str::{str}::as_bytes"]
axiom core.str.Str.as_bytes : Str → Result (Slice Std.U8)Authored Lean model
Trellis authored this Lean model for an operation outside the mechanical extraction. Modeling choices explains its behavior and review.
import Aeneas
open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
namespace dec2flt_model
-- [TABLET NODE: ModelStrAsBytes]
def ModelStrAsBytes (s : Str) : Result (Slice Std.U8) :=
-- BODY
ok s
end dec2flt_model
Source details
| Declaration | core.str.Str.as_bytes |
|---|---|
| File | /rustc/library/core/src/str/mod.rs |
| Lines | 498:4–498:41 |
| Program version | Original program |