Skip to main content

InspectorState

Struct InspectorState 

Source
pub struct InspectorState {
    pub mode: InspectorMode,
    pub hover_pos: Option<(u16, u16)>,
    pub selected: Option<HitId>,
    pub widgets: Vec<WidgetInfo>,
    pub show_detail_panel: bool,
    pub style: InspectorStyle,
    pub show_hits: bool,
    pub show_bounds: bool,
    pub show_names: bool,
    pub show_times: bool,
    /* private fields */
}
Expand description

Inspector overlay state (shared across frames).

Fields§

§mode: InspectorMode

Current display mode.

§hover_pos: Option<(u16, u16)>

Mouse position for hover detection.

§selected: Option<HitId>

Selected widget (clicked).

§widgets: Vec<WidgetInfo>

Collected widget info for current frame.

§show_detail_panel: bool

Show detailed panel.

§style: InspectorStyle

Visual style configuration.

§show_hits: bool

Toggle for hit regions visibility (within mode).

§show_bounds: bool

Toggle for widget bounds visibility (within mode).

§show_names: bool

Toggle for widget name labels.

§show_times: bool

Toggle for render time display.

Implementations§

Source§

impl InspectorState

Source

pub fn new() -> Self

Create a new inspector state.

Source

pub fn with_diagnostics(self) -> Self

Create with diagnostic log enabled (for testing).

Source

pub fn with_telemetry_hooks(self, hooks: TelemetryHooks) -> Self

Create with telemetry hooks.

Source

pub fn diagnostic_log(&self) -> Option<&DiagnosticLog>

Get the diagnostic log (for testing).

Source

pub fn diagnostic_log_mut(&mut self) -> Option<&mut DiagnosticLog>

Get mutable diagnostic log (for testing).

Source

pub fn toggle(&mut self)

Toggle the inspector on/off.

Source

pub fn is_active(&self) -> bool

Check if the inspector is active.

Source

pub fn cycle_mode(&mut self)

Cycle through display modes.

Source

pub fn set_mode(&mut self, mode_num: u8)

Set mode directly (0=Off, 1=HitRegions, 2=WidgetBounds, 3=Full).

Source

pub fn set_hover(&mut self, pos: Option<(u16, u16)>)

Update hover position from mouse event.

Source

pub fn select(&mut self, id: Option<HitId>)

Select a widget by hit ID.

Source

pub fn clear_selection(&mut self)

Clear selection.

Source

pub fn toggle_detail_panel(&mut self)

Toggle the detail panel.

Source

pub fn toggle_hits(&mut self)

Toggle hit regions visibility.

Source

pub fn toggle_bounds(&mut self)

Toggle widget bounds visibility.

Source

pub fn toggle_names(&mut self)

Toggle name labels visibility.

Source

pub fn toggle_times(&mut self)

Toggle render time visibility.

Source

pub fn clear_widgets(&mut self)

Clear widget info for new frame.

Source

pub fn register_widget(&mut self, info: WidgetInfo)

Register a widget for inspection.

Source

pub fn should_show_hits(&self) -> bool

Check if we should render hit regions.

Source

pub fn should_show_bounds(&self) -> bool

Check if we should render widget bounds.

Trait Implementations§

Source§

impl Debug for InspectorState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InspectorState

Source§

fn default() -> InspectorState

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more