Skip to main content

rustenium_bidi_definitions/
lib.rs

1use serde::{Deserialize, Serialize};
2#[macro_use]
3mod macros;
4pub mod base;
5#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
6pub struct Binary(String);
7impl AsRef<str> for Binary {
8    fn as_ref(&self) -> &str {
9        self.0.as_str()
10    }
11}
12impl AsRef<[u8]> for Binary {
13    fn as_ref(&self) -> &[u8] {
14        self.0.as_bytes()
15    }
16}
17impl From<Binary> for String {
18    fn from(b: Binary) -> String {
19        b.0
20    }
21}
22impl From<String> for Binary {
23    fn from(expr: String) -> Self {
24        Self(expr)
25    }
26}
27pub trait CommandResult {
28    type Result: serde::de::DeserializeOwned + std::fmt::Debug;
29    fn result_from_value(result: serde_json::Value) -> serde_json::Result<Self::Result> {
30        serde_json::from_value(result)
31    }
32}
33pub mod browser;
34pub mod browsing_context;
35pub mod emulation;
36pub mod input;
37pub mod log;
38pub mod network;
39pub mod script;
40pub mod session;
41pub mod storage;
42pub mod web_extension;
43pub const VERSION: &str = "1.0";
44group_enum ! (Command { Browser (browser :: commands :: BrowserCommand) , BrowsingContext (browsing_context :: commands :: BrowsingContextCommand) , Emulation (emulation :: commands :: EmulationCommand) , Input (input :: commands :: InputCommand) , Network (network :: commands :: NetworkCommand) , Script (script :: commands :: ScriptCommand) , Session (session :: commands :: SessionCommand) , Storage (storage :: commands :: StorageCommand) , WebExtension (web_extension :: commands :: WebExtensionCommand) } + identifiable);
45group_enum ! (Event { BrowsingContext (browsing_context :: events :: BrowsingContextEvent) , Input (input :: events :: InputEvent) , Log (log :: events :: LogEvent) , Network (network :: events :: NetworkEvent) , Script (script :: events :: ScriptEvent) } + other + identifiable);
46impl_from ! (browser :: commands :: Close => browser :: commands :: BrowserCommand => Command , browser :: commands :: CreateUserContext => browser :: commands :: BrowserCommand => Command , browser :: commands :: GetClientWindows => browser :: commands :: BrowserCommand => Command , browser :: commands :: GetUserContexts => browser :: commands :: BrowserCommand => Command , browser :: commands :: RemoveUserContext => browser :: commands :: BrowserCommand => Command , browser :: commands :: SetClientWindowState => browser :: commands :: BrowserCommand => Command , browser :: commands :: SetDownloadBehavior => browser :: commands :: BrowserCommand => Command , browsing_context :: commands :: Activate => browsing_context :: commands :: BrowsingContextCommand => Command , browsing_context :: commands :: CaptureScreenshot => browsing_context :: commands :: BrowsingContextCommand => Command , browsing_context :: commands :: Close => browsing_context :: commands :: BrowsingContextCommand => Command , browsing_context :: commands :: Create => browsing_context :: commands :: BrowsingContextCommand => Command , browsing_context :: commands :: GetTree => browsing_context :: commands :: BrowsingContextCommand => Command , browsing_context :: commands :: HandleUserPrompt => browsing_context :: commands :: BrowsingContextCommand => Command , browsing_context :: commands :: LocateNodes => browsing_context :: commands :: BrowsingContextCommand => Command , browsing_context :: commands :: Navigate => browsing_context :: commands :: BrowsingContextCommand => Command , browsing_context :: commands :: Print => browsing_context :: commands :: BrowsingContextCommand => Command , browsing_context :: commands :: Reload => browsing_context :: commands :: BrowsingContextCommand => Command , browsing_context :: commands :: SetViewport => browsing_context :: commands :: BrowsingContextCommand => Command , browsing_context :: commands :: TraverseHistory => browsing_context :: commands :: BrowsingContextCommand => Command , browsing_context :: events :: ContextCreated => browsing_context :: events :: BrowsingContextEvent => Event , browsing_context :: events :: ContextDestroyed => browsing_context :: events :: BrowsingContextEvent => Event , browsing_context :: events :: NavigationStarted => browsing_context :: events :: BrowsingContextEvent => Event , browsing_context :: events :: FragmentNavigated => browsing_context :: events :: BrowsingContextEvent => Event , browsing_context :: events :: HistoryUpdated => browsing_context :: events :: BrowsingContextEvent => Event , browsing_context :: events :: DomContentLoaded => browsing_context :: events :: BrowsingContextEvent => Event , browsing_context :: events :: Load => browsing_context :: events :: BrowsingContextEvent => Event , browsing_context :: events :: DownloadWillBegin => browsing_context :: events :: BrowsingContextEvent => Event , browsing_context :: events :: DownloadEnd => browsing_context :: events :: BrowsingContextEvent => Event , browsing_context :: events :: NavigationAborted => browsing_context :: events :: BrowsingContextEvent => Event , browsing_context :: events :: NavigationCommitted => browsing_context :: events :: BrowsingContextEvent => Event , browsing_context :: events :: NavigationFailed => browsing_context :: events :: BrowsingContextEvent => Event , browsing_context :: events :: UserPromptClosed => browsing_context :: events :: BrowsingContextEvent => Event , browsing_context :: events :: UserPromptOpened => browsing_context :: events :: BrowsingContextEvent => Event , emulation :: commands :: SetForcedColorsModeThemeOverride => emulation :: commands :: EmulationCommand => Command , emulation :: commands :: SetGeolocationOverride => emulation :: commands :: EmulationCommand => Command , emulation :: commands :: SetLocaleOverride => emulation :: commands :: EmulationCommand => Command , emulation :: commands :: SetNetworkConditions => emulation :: commands :: EmulationCommand => Command , emulation :: commands :: SetScreenOrientationOverride => emulation :: commands :: EmulationCommand => Command , emulation :: commands :: SetUserAgentOverride => emulation :: commands :: EmulationCommand => Command , emulation :: commands :: SetScriptingEnabled => emulation :: commands :: EmulationCommand => Command , emulation :: commands :: SetTimezoneOverride => emulation :: commands :: EmulationCommand => Command , input :: commands :: PerformActions => input :: commands :: InputCommand => Command , input :: commands :: ReleaseActions => input :: commands :: InputCommand => Command , input :: commands :: SetFiles => input :: commands :: InputCommand => Command , input :: events :: FileDialogOpened => input :: events :: InputEvent => Event , log :: events :: EntryAdded => log :: events :: LogEvent => Event , network :: commands :: AddDataCollector => network :: commands :: NetworkCommand => Command , network :: commands :: AddIntercept => network :: commands :: NetworkCommand => Command , network :: commands :: ContinueRequest => network :: commands :: NetworkCommand => Command , network :: commands :: ContinueResponse => network :: commands :: NetworkCommand => Command , network :: commands :: ContinueWithAuth => network :: commands :: NetworkCommand => Command , network :: commands :: DisownData => network :: commands :: NetworkCommand => Command , network :: commands :: FailRequest => network :: commands :: NetworkCommand => Command , network :: commands :: GetData => network :: commands :: NetworkCommand => Command , network :: commands :: ProvideResponse => network :: commands :: NetworkCommand => Command , network :: commands :: RemoveDataCollector => network :: commands :: NetworkCommand => Command , network :: commands :: RemoveIntercept => network :: commands :: NetworkCommand => Command , network :: commands :: SetCacheBehavior => network :: commands :: NetworkCommand => Command , network :: commands :: SetExtraHeaders => network :: commands :: NetworkCommand => Command , network :: events :: AuthRequired => network :: events :: NetworkEvent => Event , network :: events :: BeforeRequestSent => network :: events :: NetworkEvent => Event , network :: events :: FetchError => network :: events :: NetworkEvent => Event , network :: events :: ResponseCompleted => network :: events :: NetworkEvent => Event , network :: events :: ResponseStarted => network :: events :: NetworkEvent => Event , script :: commands :: AddPreloadScript => script :: commands :: ScriptCommand => Command , script :: commands :: Disown => script :: commands :: ScriptCommand => Command , script :: commands :: CallFunction => script :: commands :: ScriptCommand => Command , script :: commands :: Evaluate => script :: commands :: ScriptCommand => Command , script :: commands :: GetRealms => script :: commands :: ScriptCommand => Command , script :: commands :: RemovePreloadScript => script :: commands :: ScriptCommand => Command , script :: events :: Message => script :: events :: ScriptEvent => Event , script :: events :: RealmCreated => script :: events :: ScriptEvent => Event , script :: events :: RealmDestroyed => script :: events :: ScriptEvent => Event , session :: commands :: Status => session :: commands :: SessionCommand => Command , session :: commands :: New => session :: commands :: SessionCommand => Command , session :: commands :: End => session :: commands :: SessionCommand => Command , session :: commands :: Subscribe => session :: commands :: SessionCommand => Command , session :: commands :: Unsubscribe => session :: commands :: SessionCommand => Command , storage :: commands :: GetCookies => storage :: commands :: StorageCommand => Command , storage :: commands :: SetCookie => storage :: commands :: StorageCommand => Command , storage :: commands :: DeleteCookies => storage :: commands :: StorageCommand => Command , web_extension :: commands :: Install => web_extension :: commands :: WebExtensionCommand => Command , web_extension :: commands :: Uninstall => web_extension :: commands :: WebExtensionCommand => Command);