CodeSampleX

Sample

axum-core 0.5.6: IntoResponse

Verified sample for cargo axum-core 0.5.6: IntoResponse. The contract ran on rust 1 · linux alpine/x64 · docker and passed: axum_core::response::IntoResponse…

sha256:2287a7e245a5ee01dfc5b09509605797b1419aa8ed43b8619cbdf9fa2c44b7fd

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
1
Signing keys that built it
1
Declared environment linux x64 cargo

Verification-run environments

Environment Contract Stages Run
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

Case

HOW
Goal
verify IntoResponse in pkg:cargo/axum-core@0.5.6
Packages
Symbols
  • IntoResponse
Created
2026-10-19T14:36:40Z

Contract

  1. axum_core::response::IntoResponse (imported from axum_core::response, not the crate root) converts implementing types into axum_core::response::Response (http::Response<axum_core::body::Body>) via .into_response()
  2. &'static str, String, and Cow<'static, str> implement IntoResponse with HTTP 200 OK and content-type header "text/plain; charset=utf-8"
  3. &'static [u8] implements IntoResponse with HTTP 200 OK and content-type header "application/octet-stream"
  4. () implements IntoResponse with HTTP 200 OK and no content-type header
  5. (AppendHeaders([("x-custom", "val")]), "with header") implements IntoResponse and attaches custom headers alongside the inner body's response
  6. Result<T, E> implements IntoResponse when both T and E implement IntoResponse, and custom structs implement IntoResponse by defining fn into_response(self) -> Response

Files

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

Download the source artifact (tar.gz)

Source

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 = "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"

[[package]]
name = "verify-axum-core-into-response"
version = "0.1.0"
dependencies = [
 "axum-core",
]
Cargo.toml
[package]
name = "verify-axum-core-into-response"
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 IntoResponse 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:
  - IntoResponse

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:f876d035371f6b9d3ddc2f2186eb61e034c1b1cd556e591ed6beac9d45e1c61d","contract":["axum_core::response::IntoResponse (imported from axum_core::response, not the crate root) converts implementing types into axum_core::response::Response (http::Response\u003caxum_core::body::Body\u003e) via .into_response()","\u0026'static str, String, and Cow\u003c'static, str\u003e implement IntoResponse with HTTP 200 OK and content-type header \"text/plain; charset=utf-8\"","\u0026'static [u8] implements IntoResponse with HTTP 200 OK and content-type header \"application/octet-stream\"","() implements IntoResponse with HTTP 200 OK and no content-type header","(AppendHeaders([(\"x-custom\", \"val\")]), \"with header\") implements IntoResponse and attaches custom headers alongside the inner body's response","Result\u003cT, E\u003e implements IntoResponse when both T and E implement IntoResponse, and custom structs implement IntoResponse by defining fn into_response(self) -\u003e Response"],"goal":"verify IntoResponse in pkg:cargo/axum-core@0.5.6","kind":"HOW","packages":["pkg:cargo/axum-core@0.5.6"],"schemaVersion":1,"symbols":["IntoResponse"]},"contractCommand":["cargo","run","--offline"],"environment":{"arch":"x64","ecosystem":"cargo","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":["IntoResponse"],"verifierAdapter":"cargo@1"}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify IntoResponse in pkg:cargo/axum-core@0.5.6",
  "kind": "HOW",
  "packages": [
    "pkg:cargo/axum-core@0.5.6"
  ],
  "symbols": [
    "IntoResponse"
  ]
}
src/main.rs
use std::borrow::Cow;
use axum_core::body::Body;
use axum_core::response::{AppendHeaders, IntoResponse, Response};

struct CustomReply(&'static str);

impl IntoResponse for CustomReply {
    fn into_response(self) -> Response {
        Response::new(Body::from(self.0))
    }
}

fn main() {
    // 1. &'static str and String implement IntoResponse with 200 OK and text/plain; charset=utf-8
    let str_resp: Response = "hello world".into_response();
    assert_eq!(str_resp.status().as_u16(), 200);
    assert_eq!(
        str_resp
            .headers()
            .get("content-type")
            .and_then(|v| v.to_str().ok()),
        Some("text/plain; charset=utf-8")
    );

    let string_resp: Response = String::from("owned body").into_response();
    assert_eq!(string_resp.status().as_u16(), 200);
    assert_eq!(
        string_resp
            .headers()
            .get("content-type")
            .and_then(|v| v.to_str().ok()),
        Some("text/plain; charset=utf-8")
    );

    let cow_resp: Response = Cow::<str>::Borrowed("cow body").into_response();
    assert_eq!(cow_resp.status().as_u16(), 200);

    // 2. &'static [u8] and Vec<u8> implement IntoResponse with application/octet-stream
    let bytes_resp: Response = (&b"raw bytes"[..]).into_response();
    assert_eq!(bytes_resp.status().as_u16(), 200);
    assert_eq!(
        bytes_resp
            .headers()
            .get("content-type")
            .and_then(|v| v.to_str().ok()),
        Some("application/octet-stream")
    );

    // 3. () implements IntoResponse with 200 OK and empty body (no content-type header)
    let unit_resp: Response = ().into_response();
    assert_eq!(unit_resp.status().as_u16(), 200);
    assert!(unit_resp.headers().get("content-type").is_none());

    // 4. Tuple with AppendHeaders and body implements IntoResponse
    let header_resp: Response = (AppendHeaders([("x-custom", "val")]), "with header").into_response();
    assert_eq!(header_resp.status().as_u16(), 200);
    assert_eq!(
        header_resp
            .headers()
            .get("x-custom")
            .and_then(|v| v.to_str().ok()),
        Some("val")
    );
    assert_eq!(
        header_resp
            .headers()
            .get("content-type")
            .and_then(|v| v.to_str().ok()),
        Some("text/plain; charset=utf-8")
    );

    // 5. Result<T, E> where T, E: IntoResponse implements IntoResponse
    let ok_res: Result<&'static str, &'static str> = Ok("ok payload");
    let ok_resp: Response = ok_res.into_response();
    assert_eq!(ok_resp.status().as_u16(), 200);

    // 6. Custom type implementing IntoResponse produces a Response<Body>
    let custom_resp: Response = CustomReply("custom").into_response();
    assert_eq!(custom_resp.status().as_u16(), 200);
}

Origin Seeder

anonymous