Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
teasr-core
Orchestration and capture library for teasr. Handles config loading, server lifecycle, web/terminal/screen capture, and GIF conversion.
This crate is the engine behind the teasr CLI. Use it directly to embed teasr capture into your own Rust programs.
Usage
[]
= "0.11"
= { = "1", = ["full"] }
use ;
async
Config Loading
// Auto-discover: walks up from a directory to filesystem root
let path: = discover_config;
// Load and resolve (applies defaults, validates scenes non-empty)
let config: ResolvedConfig = load_config?;
ResolvedConfig is the fully-defaulted version of the TOML config with all Option fields resolved.
Types
ResolvedConfig
SceneConfig
A tagged enum with variants Web, Screen, Terminal, and File. Mirrors the [[scenes]] TOML entries.
ServerConfig
OutputConfig
OutputFormat
CaptureResult
Orchestrator
pub async run
Runs all scenes in declaration order:
- Creates the output directory.
- Starts the server (if
serveris set) and health-polls it until ready. - Iterates scenes, dispatching to the appropriate capture backend.
- On drop, kills the server process group (Unix:
SIGTERMthenSIGKILL; Windows:TerminateProcess).
Capture Backends
Web (capture::web)
Uses chromiumoxide (Chrome DevTools Protocol) to navigate, execute actions (click, scroll, hover, wait), and take screenshots. Requires Chrome or Chromium on PATH or at a standard install location.
Terminal (capture::terminal)
Runs the command in a PTY via portable-pty, collects ANSI output, and delegates to teasr-term-render to produce a styled PNG.
Screen (capture::screen)
Captures a display or region using xcap. Supports display index selection and pixel-precise region cropping.
File (capture::file)
Renders a local file (HTML, SVG, PDF, etc.) in headless Chrome and captures a screenshot. No dev server required.
GIF Conversion (convert::gif)
Assembles multiple captured frames into an animated GIF using gifski (pure Rust, no FFmpeg).
Server Lifecycle
ManagedServer is an RAII guard that starts a shell command in its own process group and tears it down on drop.
let server = start.await?;
// server is health-polled until config.url returns 2xx/3xx
// ...captures run...
// server killed when `server` is dropped
On Unix the entire process group receives SIGTERM, then SIGKILL 200 ms later, preventing orphaned child processes.
License
Apache-2.0