Skip to main content

xcelerate_core/
lib.rs

1//! # xcelerate
2//! 
3//! `xcelerate` is a high-performance, lightweight Chrome DevTools Protocol (CDP) client.
4//! It provides a fluent, chained API for browser automation, designed for speed and reliability.
5
6pub mod error;
7pub mod connection;
8pub mod browser;
9pub mod page;
10pub mod element;
11pub mod stealth;
12
13pub use error::{XcelerateError, XcelerateResult};
14pub use browser::{Browser, BrowserConfig};
15pub use page::Page;
16pub use element::Element;
17pub use connection::{CdpClient, CdpHandler};
18
19uniffi::setup_scaffolding!("xcelerate_core");
20
21/// The core trait for defining CDP commands.
22pub use connection::client::CdpCommand;
23
24// Boilerplate trait implementations (usually generated)
25impl CdpCommand for browser_protocol::page::NavigateParams {
26    type Response = browser_protocol::page::NavigateReturns;
27    const METHOD: &'static str = "Page.navigate";
28}
29impl CdpCommand for browser_protocol::page::EnableParams {
30    type Response = serde_json::Value;
31    const METHOD: &'static str = "Page.enable";
32}
33impl CdpCommand for browser_protocol::target::CreateTargetParams {
34    type Response = browser_protocol::target::CreateTargetReturns;
35    const METHOD: &'static str = "Target.createTarget";
36}
37impl CdpCommand for browser_protocol::target::AttachToTargetParams {
38    type Response = browser_protocol::target::AttachToTargetReturns;
39    const METHOD: &'static str = "Target.attachToTarget";
40}
41impl CdpCommand for js_protocol::runtime::EvaluateParams {
42    type Response = js_protocol::runtime::EvaluateReturns;
43    const METHOD: &'static str = "Runtime.evaluate";
44}
45impl CdpCommand for js_protocol::runtime::CallFunctionOnParams {
46    type Response = js_protocol::runtime::CallFunctionOnReturns;
47    const METHOD: &'static str = "Runtime.callFunctionOn";
48}
49impl CdpCommand for browser_protocol::browser::GetVersionParams {
50    type Response = browser_protocol::browser::GetVersionReturns;
51    const METHOD: &'static str = "Browser.getVersion";
52}
53impl CdpCommand for browser_protocol::browser::CloseParams {
54    type Response = serde_json::Value;
55    const METHOD: &'static str = "Browser.close";
56}
57impl CdpCommand for browser_protocol::page::ReloadParams {
58    type Response = serde_json::Value;
59    const METHOD: &'static str = "Page.reload";
60}
61impl CdpCommand for browser_protocol::page::CaptureScreenshotParams {
62    type Response = browser_protocol::page::CaptureScreenshotReturns;
63    const METHOD: &'static str = "Page.captureScreenshot";
64}
65impl CdpCommand for browser_protocol::page::PrintToPDFParams {
66    type Response = browser_protocol::page::PrintToPDFReturns;
67    const METHOD: &'static str = "Page.printToPDF";
68}
69impl CdpCommand for browser_protocol::page::GetNavigationHistoryParams {
70    type Response = browser_protocol::page::GetNavigationHistoryReturns;
71    const METHOD: &'static str = "Page.getNavigationHistory";
72}
73impl CdpCommand for browser_protocol::page::NavigateToHistoryEntryParams {
74    type Response = serde_json::Value;
75    const METHOD: &'static str = "Page.navigateToHistoryEntry";
76}
77impl CdpCommand for browser_protocol::network::EnableParams {
78    type Response = serde_json::Value;
79    const METHOD: &'static str = "Network.enable";
80}
81impl CdpCommand for browser_protocol::target::GetTargetsParams {
82    type Response = browser_protocol::target::GetTargetsReturns;
83    const METHOD: &'static str = "Target.getTargets";
84}
85impl CdpCommand for browser_protocol::page::AddScriptToEvaluateOnNewDocumentParams {
86    type Response = browser_protocol::page::AddScriptToEvaluateOnNewDocumentReturns;
87    const METHOD: &'static str = "Page.addScriptToEvaluateOnNewDocument";
88}
89impl CdpCommand for browser_protocol::page::GetLayoutMetricsParams {
90    type Response = browser_protocol::page::GetLayoutMetricsReturns;
91    const METHOD: &'static str = "Page.getLayoutMetrics";
92}
93impl CdpCommand for browser_protocol::emulation::SetDeviceMetricsOverrideParams {
94    type Response = serde_json::Value;
95    const METHOD: &'static str = "Emulation.setDeviceMetricsOverride";
96}
97impl CdpCommand for browser_protocol::emulation::ClearDeviceMetricsOverrideParams {
98    type Response = serde_json::Value;
99    const METHOD: &'static str = "Emulation.clearDeviceMetricsOverride";
100}