示例
r-efi 5.3.0: r_efi
已验证示例 — cargo r-efi 5.3.0: r_efi. contract 在 rust 1 · linux alpine/x64 · docker 上运行并通过: Boolean converts between bool/u8 and supports logical equality and…
sha256:b8d7b50648f04332193fc6b9f310d6a762e621cf5e93190d857b3ba37a6b2294
本网络只提供一件事:能构建的样本。它在沙箱中运行并保留签名回执。它不评级、不担保——同样的代码能否在你的环境构建,它没有测量过。
提交了通过的契约回执的不同签名密钥数量。为 1 表示只有作者;大于 1 表示还有其他人构建过。密钥是自行生成的,背后没有注册身份,因此计的是密钥而非人。
MIT-0
执行证据
声明的环境与签名的运行分开呈现,你可以看到这个样本究竟运行了什么、在哪里运行。
- 证据依据
- 签名契约通过
- 验证回执
- 1
- 构建过它的签名密钥
- 1
声明的环境
linux · alpine · musl x64 cargo
验证运行环境
| 环境 | 契约 | 阶段 | 运行日期 |
|---|---|---|---|
| rust 1 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · cargo@1rust:1-alpine@sha256:a10e64dd139b… |
2026-10-11 |
案例
HOW- 目标
- verify r_efi in pkg:cargo/r-efi@5.3.0
- 符号
-
- r_efi
- 创建时间
- 2026-10-11T14:23:33Z
契约
- Boolean converts between bool/u8 and supports logical equality and ordering
- Status differentiates success, warning, and error codes with correct masking
- Guid initializes from fields and raw byte representations with consistent round-trip conversion
- Core UEFI types maintain standard ABI sizes and alignments
- eficall macro annotates function pointers with the platform EFI calling convention
文件
- Cargo.lock
- Cargo.toml
- PROMPT.md
- csx.json
- spec.json
- src/lib.rs
- test/contract.rs
源代码
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "r-efi"
version = "5.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
[[package]]
name = "sample-r-efi"
version = "1.0.0"
dependencies = [
"r-efi",
]
[package]
name = "sample-r-efi"
version = "1.0.0"
edition = "2021"
publish = false
[dependencies]
r-efi = "=5.3.0"
[[bin]]
name = "contract"
path = "test/contract.rs"
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify r_efi in pkg:cargo/r-efi@5.3.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:cargo/r-efi@5.3.0
Demonstrate these symbols/APIs:
- r_efi
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:18e523af90a87f9c74a6d9b7981ebbedea7b87eb0ab421d13c894a3dfc63eac2","contract":["Boolean converts between bool/u8 and supports logical equality and ordering","Status differentiates success, warning, and error codes with correct masking","Guid initializes from fields and raw byte representations with consistent round-trip conversion","Core UEFI types maintain standard ABI sizes and alignments","eficall macro annotates function pointers with the platform EFI calling convention"],"goal":"verify r_efi in pkg:cargo/r-efi@5.3.0","kind":"HOW","packages":["pkg:cargo/r-efi@5.3.0"],"schemaVersion":1,"symbols":["r_efi"]},"contractCommand":["cargo","run","--offline"],"environment":{"arch":"x64","distro":"alpine","ecosystem":"cargo","libc":"musl","os":"linux","packageManager":"cargo","schemaVersion":1},"license":"MIT-0","packages":["pkg:cargo/r-efi@5.3.0"],"schemaVersion":1,"subject":"pkg:cargo/r-efi@5.3.0","symbols":["r_efi"],"verifierAdapter":"cargo@1"}
{
"schemaVersion": 1,
"goal": "verify r_efi in pkg:cargo/r-efi@5.3.0",
"kind": "HOW",
"packages": [
"pkg:cargo/r-efi@5.3.0"
],
"symbols": [
"r_efi"
]
}
//! Clean-room verification sample for r-efi.
pub use r_efi::*;
use r_efi::base::{Boolean, Char8, Char16, Guid, Handle, Status};
use r_efi::system::Time;
use r_efi::{eficall, eficall_abi};
use std::mem::{align_of, size_of};
fn main() {
// 1. Boolean converts between bool/u8 and supports logical equality and ordering
let b_true = Boolean::TRUE;
let b_false = Boolean::FALSE;
assert_ne!(b_true, b_false);
assert_eq!(b_true, true);
assert_eq!(b_false, false);
let from_bool_t = Boolean::from(true);
let from_bool_f = Boolean::from(false);
assert_eq!(from_bool_t, b_true);
assert_eq!(from_bool_f, b_false);
let from_u8_zero = Boolean::from(0u8);
let from_u8_nonzero = Boolean::from(42u8);
assert_eq!(from_u8_zero, b_false);
assert_eq!(from_u8_nonzero, b_true);
let to_bool: bool = b_true.into();
assert!(to_bool);
let to_u8: u8 = b_false.into();
assert_eq!(to_u8, 0);
// 2. Status differentiates success, warning, and error codes with correct masking
let success = Status::SUCCESS;
assert!(!success.is_error());
assert!(!success.is_warning());
assert_eq!(success.as_usize(), 0);
let err = Status::LOAD_ERROR;
assert!(err.is_error());
assert!(!err.is_warning());
let invalid_param = Status::INVALID_PARAMETER;
assert!(invalid_param.is_error());
let warn = Status::WARN_UNKNOWN_GLYPH;
assert!(!warn.is_error());
assert!(warn.is_warning());
let ok_res: Result<Status, Status> = success.into();
assert_eq!(ok_res, Ok(success));
let err_res: Result<Status, Status> = err.into();
assert_eq!(err_res, Err(err));
// 3. Guid initializes from fields and raw byte representations with consistent round-trip conversion
let fields = (
0x550e8400u32,
0xe29bu16,
0x41d4u16,
0xa7u8,
0x16u8,
&[0x44, 0x66, 0x55, 0x44, 0x00, 0x00],
);
let raw_bytes = [
0x00, 0x84, 0x0e, 0x55,
0x9b, 0xe2,
0xd4, 0x41,
0xa7,
0x16,
0x44, 0x66, 0x55, 0x44, 0x00, 0x00,
];
let g_from_fields = Guid::from_fields(fields.0, fields.1, fields.2, fields.3, fields.4, fields.5);
let g_from_bytes = Guid::from_bytes(&raw_bytes);
assert_eq!(g_from_fields, g_from_bytes);
assert_eq!(g_from_fields.as_bytes(), &raw_bytes);
assert_eq!(g_from_bytes.as_fields(), fields);
// 4. Core UEFI types maintain standard ABI sizes and alignments
assert_eq!(size_of::<Boolean>(), 1);
assert_eq!(align_of::<Boolean>(), 1);
assert_eq!(size_of::<Char8>(), 1);
assert_eq!(align_of::<Char8>(), 1);
assert_eq!(size_of::<Char16>(), 2);
assert_eq!(align_of::<Char16>(), 2);
assert_eq!(size_of::<Status>(), size_of::<usize>());
assert_eq!(align_of::<Status>(), align_of::<usize>());
assert_eq!(size_of::<Handle>(), size_of::<*mut ()>());
assert_eq!(align_of::<Handle>(), align_of::<*mut ()>());
assert_eq!(size_of::<Guid>(), 16);
assert_eq!(align_of::<Guid>(), 4);
assert_eq!(size_of::<Time>(), 16);
// 5. eficall macro annotates function pointers with the platform EFI calling convention
type Callback = eficall! { fn(u32) -> u32 };
let f: Callback = my_callback;
assert_eq!(f(41), 42);
println!("All r_efi contract assertions passed successfully.");
}
eficall! {
fn my_callback(val: u32) -> u32 {
val + 1
}
}
原始种子者
匿名