DebugFreeze

Struct DebugFreeze 

Source
pub struct DebugFreeze<A> {
    pub enabled: bool,
    pub pending_capture: bool,
    pub snapshot: Option<Buffer>,
    pub snapshot_text: String,
    pub queued_actions: Vec<A>,
    pub message: Option<String>,
    pub overlay: Option<DebugOverlay>,
    pub mouse_capture_enabled: bool,
}
Expand description

Debug freeze state for capturing and inspecting UI frames

Generic over the action type A to store queued actions while frozen.

§Example

use tui_dispatch_core::debug::DebugFreeze;

// In your app state:
struct AppState {
    debug: DebugFreeze<MyAction>,
    // ... other fields
}

// Toggle freeze on F12:
fn handle_action(state: &mut AppState, action: MyAction) {
    match action {
        MyAction::ToggleDebug => {
            state.debug.toggle();
        }
        other if state.debug.enabled => {
            // Queue actions while frozen
            state.debug.queue(other);
        }
        // ... normal handling
    }
}

Fields§

§enabled: bool

Whether debug/freeze mode is enabled

§pending_capture: bool

Flag to capture the next frame

§snapshot: Option<Buffer>

The captured buffer snapshot

§snapshot_text: String

Plain text version of snapshot (for clipboard)

§queued_actions: Vec<A>

Actions queued while frozen

§message: Option<String>

Feedback message to display

§overlay: Option<DebugOverlay>

Currently displayed overlay

§mouse_capture_enabled: bool

Whether mouse capture mode is enabled (for position inspection)

Implementations§

Source§

impl<A> DebugFreeze<A>

Source

pub fn new() -> Self

Create a new debug freeze state

Source

pub fn toggle(&mut self)

Toggle freeze mode on/off

When enabling, sets pending_capture to capture the next frame. When disabling, clears the snapshot and queued actions.

Source

pub fn enable(&mut self)

Enable freeze mode

Source

pub fn disable(&mut self)

Disable freeze mode

Source

pub fn capture(&mut self, buffer: &Buffer)

Capture the current buffer as a snapshot

Source

pub fn request_capture(&mut self)

Request a new capture on the next frame

Source

pub fn queue(&mut self, action: A)

Queue an action to be processed when freeze is disabled

Source

pub fn take_queued(&mut self) -> Vec<A>

Take all queued actions, leaving the queue empty

Source

pub fn set_message(&mut self, msg: impl Into<String>)

Set a feedback message

Source

pub fn clear_message(&mut self)

Clear the feedback message

Source

pub fn set_overlay(&mut self, overlay: DebugOverlay)

Set the current overlay

Source

pub fn clear_overlay(&mut self)

Clear the current overlay

Source

pub fn toggle_mouse_capture(&mut self)

Toggle mouse capture mode

Trait Implementations§

Source§

impl<A: Debug> Debug for DebugFreeze<A>

Source§

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

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

impl<A> Default for DebugFreeze<A>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<A> Freeze for DebugFreeze<A>

§

impl<A> RefUnwindSafe for DebugFreeze<A>
where A: RefUnwindSafe,

§

impl<A> Send for DebugFreeze<A>
where A: Send,

§

impl<A> Sync for DebugFreeze<A>
where A: Sync,

§

impl<A> Unpin for DebugFreeze<A>
where A: Unpin,

§

impl<A> UnwindSafe for DebugFreeze<A>
where A: UnwindSafe,

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> 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
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