Crate rfheadless

Crate rfheadless 

Source
Expand description

RFox Headless Engine

A headless browsing engine API for Rust that provides a high-level interface for loading pages, running JavaScript, and producing rendered outputs.

§Features

  • CDP Backend (default): Uses Chrome DevTools Protocol via headless Chrome
  • Modular Design: Adapter-based architecture for swappable backends
  • Safe Defaults: Sandboxing and restrictive defaults with explicit opt-ins

§Example

use rfheadless::{Engine, EngineConfig, Viewport};

let config = EngineConfig {
    user_agent: "RFox/1.0".to_string(),
    viewport: Viewport { width: 1280, height: 720 },
    timeout_ms: 30000,
    ..Default::default()
};

let mut engine = rfheadless::new_engine(config)?;
engine.load_url("https://example.com")?;
let snapshot = engine.render_text_snapshot()?;
println!("Title: {}", snapshot.title);

Re-exports§

pub use error::Error;
pub use error::Result;

Modules§

error
Error types for the headless engine
platform
Platform API surface: service workers, media hooks, accessibility, device emulation
rendering
Rendering module (Phase 1 prototype)
rfengine
RFEngine: lightweight pure-Rust backend with minimal JS and CSS extraction.

Structs§

ConsoleMessage
Console message emitted by the page
Cookie
A cookie retrieved from the browser
CookieParam
Parameters for setting a cookie
EngineConfig
Configuration for the headless engine
RequestInfo
Information about an outgoing network request
ScriptResult
Result of JavaScript execution
TextSnapshot
A textual snapshot of a rendered page
Viewport
Viewport dimensions

Enums§

RequestAction
Action to take when a request is observed by on_request handlers.

Traits§

Engine
Core trait for headless engine implementations

Functions§

new_engine
Create a new engine instance with the default backend