Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust
Rust ai-agentsai-toolsbrowserbrowser-automationcloud-browserheadlessheadless-browserkitesurfplaywrightpuppeteerrustservoweb-crawlerweb-crawlingweb-scraperweb-scraping
use std::sync::OnceLock;
use moli_core::network::{
SharedWebStorageStore, deep_clone_shared_web_storage_store, new_shared_web_storage_store,
};
#[derive(Clone, Default)]
pub(crate) struct TargetSessionStorageNamespace {
store: OnceLock<SharedWebStorageStore>,
}
impl std::fmt::Debug for TargetSessionStorageNamespace {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("TargetSessionStorageNamespace")
.field("initialized", &self.store.get().is_some())
.finish()
}
}
impl TargetSessionStorageNamespace {
pub(crate) fn from_store(store: SharedWebStorageStore) -> Self {
Self {
store: OnceLock::from(store),
}
}
pub(crate) fn store(&self) -> &SharedWebStorageStore {
self.store.get_or_init(new_shared_web_storage_store)
}
pub(crate) fn deep_clone(&self) -> Self {
Self {
store: OnceLock::from(deep_clone_shared_web_storage_store(self.store())),
}
}
}