Skip to main content

Module harness

Module harness 

Source
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.