Struct DevToolsWindowState

Source
pub struct DevToolsWindowState {
    pub enabled: bool,
    pub mode: DevToolsMode,
    pub picker_active: bool,
    pub selected: Option<u64>,
    pub hovered: Option<u64>,
    /* private fields */
}
Expand description

Per-window devtools interaction, snapshot, overlay-runtime, and remote state.

Self::new starts disabled unless the modern or legacy remote environment variable contains a valid loopback socket address. Keyboard shortcuts are Ctrl+Shift+I for visibility, Ctrl+Shift+C for the picker, and Escape to leave picker mode or hide the overlay.

§Examples

use ailloli_ui_devtools_core::DevToolsMode;
let state = ailloli_ui_winit::devtools::DevToolsWindowState::new();
assert_eq!(state.mode, DevToolsMode::Overlay);
assert!(!state.picker_active);

Fields§

§enabled: bool

Whether the local overlay may render and consume panel input.

§mode: DevToolsMode

Current overlay placement or hidden mode.

§picker_active: bool

Whether pointer motion/click selects inspected elements.

§selected: Option<u64>

Selected inspected element’s numeric id, or none.

§hovered: Option<u64>

Picker-hovered inspected element’s numeric id, or none.

Implementations§

Source§

impl DevToolsWindowState

Window-local devtools lifecycle, event handling, and scene construction.

Source

pub fn new() -> Self

Creates overlay state and optionally starts the environment-configured remote.

AILLOLI_UI_DEVTOOLS_REMOTE wins over OCTAVUI_DEVTOOLS_REMOTE. Invalid, non-loopback, or unbindable addresses behave as no remote and leave the local overlay disabled.

§Examples
let state = ailloli_ui_winit::devtools::DevToolsWindowState::new();
assert!(state.selected.is_none() && state.hovered.is_none());
Source

pub fn set_remote_addr(&mut self, addr: Option<SocketAddr>)

Replaces the remote server with an optional loopback address.

None drops this handle’s channels but does not forcibly disable an already-enabled local overlay. A successful server enables the overlay and receives the previously installed host wake. Startup failure leaves no remote.

§Examples
let mut state = ailloli_ui_winit::devtools::DevToolsWindowState::new();
state.set_remote_addr(None);
assert_eq!(state.mode, ailloli_ui_devtools_core::DevToolsMode::Overlay);
Source

pub fn handle_event(&mut self, event: &Event) -> bool

Applies queued remote commands, shortcuts, panel input, and picker input.

Returns true only when devtools consumed the event. Panel pointer input is routed before application content; picker motion updates hover, and a released primary click selects then disables picking.

§Examples
use ailloli_ui_core::Event;
let mut state = ailloli_ui_winit::devtools::DevToolsWindowState::new();
let _handler: fn(&mut _, &Event) -> bool =
    ailloli_ui_winit::devtools::DevToolsWindowState::handle_event;
let _ = &mut state;
Source

pub fn build_scene<A: 'static>( &mut self, tree: &ElementTree<A>, root: ElementId, viewport: Rect, scale: Scale, text_system: &mut TextSystem, ) -> Option<Scene>

Updates the inspected snapshot and optionally builds the local overlay scene.

Remote-only mode still snapshots and publishes while returning None. Visible mode reconciles, lays out, and paints a separate overlay runtime, then inserts selection/hover rectangles as the first overlay layer. The frame index saturates at u64::MAX.

§Examples
use ailloli_ui_core::{ElementId, Rect};
use ailloli_ui_core::math::Scale;
use ailloli_ui_runtime::element::ElementTree;
use ailloli_ui_text::TextSystem;
fn build<A: 'static>(state: &mut ailloli_ui_winit::devtools::DevToolsWindowState,
    tree: &ElementTree<A>, root: ElementId, text: &mut TextSystem) {
    let scene: Option<ailloli_ui_runtime::scene::Scene> = state.build_scene(
        tree, root, Rect::new(0.0, 0.0, 800.0, 600.0), Scale::new(1.0), text);
    let _ = scene;
}

Trait Implementations§

Source§

impl Default for DevToolsWindowState

Delegates to environment-aware Self::new.

Source§

fn default() -> Self

Creates the same state as DevToolsWindowState::new.

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
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: 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>

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)

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)

Convert &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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,