pub struct DevToolsState { /* private fields */ }Expand description
Everything the inspector displays, and the only mutable state it owns.
Installed once with DevToolsState::init; feed it through the free
functions in crate::devtools (console_log, network_begin, …), which
are no-ops when it was never installed. That is deliberate: instrumentation
left in a release build costs a global lookup and nothing more.
Implementations§
Source§impl DevToolsState
impl DevToolsState
pub fn new() -> Self
pub fn limits(self, limits: Limits) -> Self
Sourcepub fn init(self, cx: &mut App)
pub fn init(self, cx: &mut App)
Install as the app global. Call once at startup, before opening
crate::devtools::DevTools.
Sourcepub fn generation(&self) -> u64
pub fn generation(&self) -> u64
Bumped on every mutation, so a panel can tell “nothing changed” cheaply.
Sourcepub fn now(&self) -> Duration
pub fn now(&self) -> Duration
Time since the store was created — the clock every record is stamped on.
Sourcepub fn push_log(&mut self, record: LogRecord)
pub fn push_log(&mut self, record: LogRecord)
Append a line, coalescing it into the previous one when identical.
pub fn logs(&self) -> &VecDeque<LogRecord>
pub fn clear_logs(&mut self)
Sourcepub fn log_issues(&self) -> (usize, usize)
pub fn log_issues(&self) -> (usize, usize)
Warning and error tallies for the toolbar badges.
Sourcepub fn push_network(&mut self, record: NetworkRecord) -> u64
pub fn push_network(&mut self, record: NetworkRecord) -> u64
Record a request that has started. Returns its id, which the host keeps to settle the request later.
Sourcepub fn update_network(&mut self, id: u64, f: impl FnOnce(&mut NetworkRecord))
pub fn update_network(&mut self, id: u64, f: impl FnOnce(&mut NetworkRecord))
Amend a request in flight — the response landed, the transfer grew, it failed. Silently does nothing if the record was already evicted.
pub fn network(&self) -> &VecDeque<NetworkRecord>
pub fn clear_network(&mut self)
Sourcepub fn network_span(&self) -> (Duration, Duration)
pub fn network_span(&self) -> (Duration, Duration)
The window the waterfall is drawn against: earliest start to latest end.
Sourcepub fn network_totals(&self) -> (usize, u64, u64)
pub fn network_totals(&self) -> (usize, u64, u64)
Row count, total transfer, and total resource bytes — the status bar.
Sourcepub fn set_storage(&mut self, domain: StorageDomain)
pub fn set_storage(&mut self, domain: StorageDomain)
Register a domain, replacing any existing one with the same id. Hosts call this whenever their store changes; the panel always shows the latest snapshot.
pub fn remove_storage(&mut self, id: &str)
pub fn storage(&self) -> &[StorageDomain]
pub fn push_timeline(&mut self, event: TimelineEvent)
pub fn timeline(&self) -> &VecDeque<TimelineEvent>
pub fn clear_timeline(&mut self)
Sourcepub fn record_frame(&mut self)
pub fn record_frame(&mut self)
Called once per rendered frame by the inspector itself. Deriving the interval here — rather than asking the host to report it — is what makes the Frames band work with no wiring at all.
Sourcepub fn stop_frames(&mut self)
pub fn stop_frames(&mut self)
Forget where the last frame landed. Called when recording stops so the idle gap before it resumes is not measured as one enormous frame.
pub fn frames(&self) -> &VecDeque<Duration>
Trait Implementations§
Source§impl Default for DevToolsState
impl Default for DevToolsState
impl Global for DevToolsState
Auto Trait Implementations§
impl Freeze for DevToolsState
impl RefUnwindSafe for DevToolsState
impl Send for DevToolsState
impl Sync for DevToolsState
impl Unpin for DevToolsState
impl UnsafeUnpin for DevToolsState
impl UnwindSafe for DevToolsState
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ReadGlobal for Twhere
T: Global,
impl<T> ReadGlobal for Twhere
T: Global,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().