Expand description
Harness template and source validation for Rust code execution.
This module contains the harness template that wraps user code, source
validation functions, and output extraction utilities. These are shared
between RustSandboxExecutor (legacy) and RustExecutor (new).
Constants§
- HARNESS_
TEMPLATE - The harness template that wraps user code.
- REJECTED_
PATTERNS - Patterns that are rejected in user code because they conflict with the harness or exceed the phase 1 source model.
Functions§
- extract_
structured_ output - Extract structured JSON output from stdout.
- strip_
comments - Strip single-line (
//) and block (/* */) comments from Rust source. - truncate_
output - Truncate output to the given byte limit. Returns the (possibly truncated) string and whether truncation occurred.
- validate_
rust_ source - Validate that user source code fits the phase 1 bounded source model.