pub struct DocumentControl { /* private fields */ }Expand description
One document, driven in process.
Not Send: a blitz-dom document is not, and neither is anything that
carries one. The socket transport crosses that boundary with a channel
rather than by making the document shareable, which is why
crate::server::ControlBridge is a closure returning a receiver.
Implementations§
Source§impl DocumentControl
impl DocumentControl
pub fn new() -> Self
Sourcepub fn revision(&self) -> u64
pub fn revision(&self) -> u64
The revision the last Inspect or action reported.
A host that also serves diagnostics stamps its snapshots with this, so the two surfaces agree about which version of the document a client is looking at.
Sourcepub fn next_revision(&mut self) -> u64
pub fn next_revision(&mut self) -> u64
Advance the revision without answering a request.
A diagnostic snapshot is a second reader of the same document and carries the same counter.
Sourcepub fn agent(
&mut self,
document: &mut (impl ControlScriptBackend + ?Sized),
request: AgentControlRequest,
) -> DebugResponse
pub fn agent( &mut self, document: &mut (impl ControlScriptBackend + ?Sized), request: AgentControlRequest, ) -> DebugResponse
Answer one agent-control request.
Inspect reads the tree. Act performs the action, settles the
synchronous script work it caused, and acknowledges. Navigate,
Relaunch and Quit are refused here on purpose: they need a loader
or a process, and only the embedder that started it can honour them.
Sourcepub fn act(
&mut self,
document: &mut (impl ControlScriptBackend + ?Sized),
action: AgentAction,
) -> Result<(), DebugError>
pub fn act( &mut self, document: &mut (impl ControlScriptBackend + ?Sized), action: AgentAction, ) -> Result<(), DebugError>
Perform one action, without settling and without acknowledging.
Separate from Self::agent because settling is the host’s business:
a windowed runtime drains the poll hook, and a headless host that owns
an animation clock has to advance that too before the document is
stable. Both want the same actions.
Sourcepub fn capture(
&mut self,
document: &mut (impl ControlScriptBackend + ?Sized),
request: CaptureRequest,
) -> Result<CapturedImage, DebugError>
pub fn capture( &mut self, document: &mut (impl ControlScriptBackend + ?Sized), request: CaptureRequest, ) -> Result<CapturedImage, DebugError>
Draw the document offscreen, reusing this control’s surface.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for DocumentControl
impl !Sync for DocumentControl
impl !UnwindSafe for DocumentControl
impl Forget for DocumentControl
impl Freeze for DocumentControl
impl Move for DocumentControl
impl Send for DocumentControl
impl Unpin for DocumentControl
impl UnsafeUnpin for DocumentControl
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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> ⓘ
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> ⓘ
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