CodeSampleX

サンプル

axum-core 0.5.6: BoxError

検証済みサンプル — cargo axum-core 0.5.6: BoxError. rust 1 · linux alpine/x64 · docker で contract を実行し、成功しました: axum_core::BoxError wraps any Send + Sync +…

sha256:bb5681a8cfb0b17671d761fe3f2171e1f1d915050d3db59bf0e19b7f2a9fdfab

このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。 合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。 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-19

ケース

HOW
ゴール
verify BoxError in pkg:cargo/axum-core@0.5.6
パッケージ
シンボル
  • BoxError
作成日
2026-10-19T12:59:37Z

コントラクト

  1. axum_core::BoxError wraps any Send + Sync + std::error::Error value via From/Into and preserves its Display message and downcast_ref::<io::Error>() type
  2. axum_core::Error::new accepts a BoxError and Error::into_inner returns the inner BoxError suitable for downcast::<io::Error>()

ファイル

  • Cargo.lock
  • Cargo.toml
  • PROMPT.md
  • csx.json
  • spec.json
  • src/main.rs

ソースアーティファクトをダウンロード (tar.gz)

ソース

Cargo.lock
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4

[[package]]
name = "axum-core"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1"
dependencies = [
 "bytes",
 "futures-core",
 "http",
 "http-body",
 "http-body-util",
 "mime",
 "pin-project-lite",
 "sync_wrapper",
 "tower-layer",
 "tower-service",
]

[[package]]
name = "bytes"
version = "1.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"

[[package]]
name = "futures-core"
version = "0.3.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e"

[[package]]
name = "http"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0"
dependencies = [
 "bytes",
 "itoa",
]

[[package]]
name = "http-body"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c"
dependencies = [
 "bytes",
 "http",
]

[[package]]
name = "http-body-util"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c"
dependencies = [
 "bytes",
 "futures-core",
 "http",
 "http-body",
 "pin-project-lite",
]

[[package]]
name = "itoa"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"

[[package]]
name = "mime"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"

[[package]]
name = "pin-project-lite"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"

[[package]]
name = "sample"
version = "0.1.0"
dependencies = [
 "axum-core",
]

[[package]]
name = "sync_wrapper"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263"

[[package]]
name = "tower-layer"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e"

[[package]]
name = "tower-service"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"
Cargo.toml
[package]
name = "sample"
version = "0.1.0"
edition = "2021"

[dependencies]
axum-core = "=0.5.6"
PROMPT.md
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 BoxError in pkg:cargo/axum-core@0.5.6
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:cargo/axum-core@0.5.6
Demonstrate these symbols/APIs:
  - BoxError

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.
csx.json
{"case":{"caseId":"case:sha256:06c3c68a5f9b2b458e5b34994865967b29e388c150438f7b9c3e200e5b2549e3","contract":["axum_core::BoxError wraps any Send + Sync + std::error::Error value via From/Into and preserves its Display message and downcast_ref::\u003cio::Error\u003e() type","axum_core::Error::new accepts a BoxError and Error::into_inner returns the inner BoxError suitable for downcast::\u003cio::Error\u003e()"],"goal":"verify BoxError in pkg:cargo/axum-core@0.5.6","kind":"HOW","packages":["pkg:cargo/axum-core@0.5.6"],"schemaVersion":1,"symbols":["BoxError"]},"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/axum-core@0.5.6"],"schemaVersion":1,"subject":"pkg:cargo/axum-core@0.5.6","symbols":["BoxError"],"verifierAdapter":"cargo@1"}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify BoxError in pkg:cargo/axum-core@0.5.6",
  "kind": "HOW",
  "packages": [
    "pkg:cargo/axum-core@0.5.6"
  ],
  "symbols": [
    "BoxError"
  ]
}
src/main.rs
use axum_core::{BoxError, Error};
use std::io;

fn fallible_operation(fail: bool) -> Result<&'static str, BoxError> {
    if fail {
        Err(io::Error::new(io::ErrorKind::Other, "operation failed").into())
    } else {
        Ok("ok")
    }
}

fn main() {
    let ok_res = fallible_operation(false).expect("expected success");
    assert_eq!(ok_res, "ok");

    let boxed_err: BoxError = fallible_operation(true).expect_err("expected error");
    assert_eq!(boxed_err.to_string(), "operation failed");
    assert!(boxed_err.downcast_ref::<io::Error>().is_some());

    let axum_err = Error::new(boxed_err);
    assert_eq!(axum_err.to_string(), "operation failed");

    let inner: BoxError = axum_err.into_inner();
    let io_err = inner
        .downcast::<io::Error>()
        .expect("should downcast back to io::Error");
    assert_eq!(io_err.kind(), io::ErrorKind::Other);
}

オリジンシーダー

匿名