Expand description
Type-safe identifiers for browser entities.
Newtype wrappers prevent mixing incompatible IDs at compile time. Type-safe identifier wrappers for Firefox WebDriver.
This module provides newtype wrappers around primitive types to prevent accidentally mixing incompatible IDs at compile time.
§ID System
From ARCHITECTURE.md Section 1.4:
| ID | Type | Source | Purpose |
|---|---|---|---|
SessionId | NonZeroU32 | Rust counter | Window identification |
TabId | NonZeroU32 | Firefox | Tab identification |
FrameId | u64 | Firefox | Frame identification (0 = main) |
RequestId | UUID v4 | Rust | WebSocket correlation |
ElementId | UUID v4 | Extension | DOM element reference |
ScriptId | UUID v4 | Extension | Preload script reference |
SubscriptionId | UUID v4 | Extension | Element observation |
InterceptId | UUID v4 | Extension | Network interception |
§Example
ⓘ
use firefox_webdriver::{TabId, FrameId, ElementId};
// Type safety prevents mixing IDs
let tab_id = TabId::new(1).expect("valid tab id");
let frame_id = FrameId::main();
let element_id = ElementId::new("uuid-string");
// This would not compile:
// let wrong: TabId = frame_id; // Error: mismatched typesStructs§
- Element
Id - Identifier for a DOM element.
- FrameId
- Identifier for a frame context.
- Intercept
Id - Identifier for a network intercept.
- Request
Id - Unique identifier for a WebSocket request.
- Script
Id - Identifier for a preload script.
- Session
Id - Identifier for a browser session (Firefox window/process).
- Subscription
Id - Identifier for an element observation subscription.
- TabId
- Identifier for a browser tab.