chromiumoxide/handler/
browser.rsuse chromiumoxide_cdp::cdp::browser_protocol::browser::BrowserContextId;
#[derive(Debug, Clone, Default, Hash, Eq, PartialEq)]
pub struct BrowserContext {
pub id: Option<BrowserContextId>,
}
impl BrowserContext {
pub fn is_incognito(&self) -> bool {
self.id.is_some()
}
pub fn id(&self) -> Option<&BrowserContextId> {
self.id.as_ref()
}
pub(crate) fn take(&mut self) -> Option<BrowserContextId> {
self.id.take()
}
}
impl From<BrowserContextId> for BrowserContext {
fn from(id: BrowserContextId) -> Self {
Self { id: Some(id) }
}
}