pub struct Cdp {
out: UnboundedSender<Vec<u8>>,
next: AtomicU64,
pending: Mutex<HashMap<u64, Sender<Result<Value, String>>>>,
sessions: Mutex<HashMap<String, Box<dyn Fn(Event) + Send + Sync>>>,
browser: Mutex<Option<UnboundedSender<Event>>>,
dead: AtomicBool,
}Fields§
§out: UnboundedSender<Vec<u8>>§next: AtomicU64§pending: Mutex<HashMap<u64, Sender<Result<Value, String>>>>§sessions: Mutex<HashMap<String, Box<dyn Fn(Event) + Send + Sync>>>§browser: Mutex<Option<UnboundedSender<Event>>>Events about the browser itself (no session).
dead: AtomicBoolImplementations§
Source§impl Cdp
impl Cdp
Sourcepub fn over<R, W>(reader: R, writer: W) -> Arc<Cdp> ⓘ
pub fn over<R, W>(reader: R, writer: W) -> Arc<Cdp> ⓘ
A client over a reader and a writer to the browser. Its tasks end with the reader.
Sourcefn finish(&self)
fn finish(&self)
The browser has gone: every waiting call fails and every session’s queue ends.
Sourcepub fn abandon(&self)
pub fn abandon(&self)
Give up on the browser (its start did not complete): calls fail now, and whoever holds the process ends it.
pub fn is_dead(&self) -> bool
fn dispatch(&self, message: &[u8])
Sourcepub fn subscribe(&self, session: &str) -> UnboundedReceiver<Event>
pub fn subscribe(&self, session: &str) -> UnboundedReceiver<Event>
The events of one session, from now on.
Sourcepub fn subscribe_with(
&self,
session: &str,
deliver: impl Fn(Event) + Send + Sync + 'static,
)
pub fn subscribe_with( &self, session: &str, deliver: impl Fn(Event) + Send + Sync + 'static, )
The events of one session, from now on, handed to deliver in the order they arrive (it must not block).
pub fn unsubscribe(&self, session: &str)
Sourcepub fn browser_events(&self) -> UnboundedReceiver<Event>
pub fn browser_events(&self) -> UnboundedReceiver<Event>
The events about the browser itself (a window a page opened).
Auto Trait Implementations§
impl !Freeze for Cdp
impl RefUnwindSafe for Cdp
impl Send for Cdp
impl Sync for Cdp
impl Unpin for Cdp
impl UnsafeUnpin for Cdp
impl UnwindSafe for Cdp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more