Module identifiers

Module identifiers 

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

IDTypeSourcePurpose
SessionIdNonZeroU32Rust counterWindow identification
TabIdNonZeroU32FirefoxTab identification
FrameIdu64FirefoxFrame identification (0 = main)
RequestIdUUID v4RustWebSocket correlation
ElementIdUUID v4ExtensionDOM element reference
ScriptIdUUID v4ExtensionPreload script reference
SubscriptionIdUUID v4ExtensionElement observation
InterceptIdUUID v4ExtensionNetwork 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 types

Structs§

ElementId
Identifier for a DOM element.
FrameId
Identifier for a frame context.
InterceptId
Identifier for a network intercept.
RequestId
Unique identifier for a WebSocket request.
ScriptId
Identifier for a preload script.
SessionId
Identifier for a browser session (Firefox window/process).
SubscriptionId
Identifier for an element observation subscription.
TabId
Identifier for a browser tab.