# Consumer contract
`RustCodeDocument::new` validates one identity and the exact UTF-8 contents of `Documentation.md`, `Cargo.toml`, and `src/lib.rs`. `RustCodeDocument::from_source_package` accepts only that three-file editing shape, and `into_source_package` returns it without changing bytes. Manifest identity, K1 dependency extraction, and source containment are delegated to `kcode-k1-rust-package`; this package adds no Cargo manifest, target, lint, feature, metadata, edition, workspace, dependency-source, or Rust-language policy.
`approved_default` generates an ordinary minimal package manifest with the K1-assigned name and version, Rust 2024, Rust 1.97, and MIT license, plus documentation `# Consumer contract\n\n\`run\` performs no operation.\n` and code `pub fn run() {}\n`. Cargo's normal `src/lib.rs` discovery makes the default a library. Authors may replace the manifest with any form accepted by the package layer and Cargo, including an explicit binary target using `src/lib.rs`.
`identity`, `documentation`, `manifest`, and `code` borrow the represented values. `code_chunk_ranges` returns contiguous byte ranges that reconstruct the code exactly. It uses an 800-Unicode-scalar floor and safe boundaries after complete top-level items and direct impl or trait members. An empty file returns `0..0`; a short tail is retained with its preceding chunk, indivisible syntax has no maximum, and parsing or span uncertainty returns the whole file.
Failures return `RustCodeDocumentError`; `message` provides its stable explanatory text. Operations perform no I/O.