Skip to main content

EventLog

Struct EventLog 

Source
pub struct EventLog { /* private fields */ }
Expand description

环形缓冲事件日志。总闸关闭时不记录;enable(false) 可单独关闭某一棵树。

Implementations§

Source§

impl EventLog

Source

pub fn new() -> Self

Source

pub fn enabled(&self) -> bool

两层开关都为开时才采集。关闭时 Self::push 是 no-op(零分配、零锁)。

Source

pub fn enable(&self, on: bool)

单树本地开关。总闸关闭时本开关打开也不会采集。

Source

pub fn push(&self, record: EventRecord)

追加一条记录。关闭时立即返回。

Source

pub fn route( &self, event_type: &'static str, target: Option<ElementId>, detail: impl Into<String>, )

追加一条 Route 类记录(dispatch_event 入口)。

Source

pub fn deliver( &self, event_type: &'static str, target: ElementId, detail: impl Into<String>, )

追加一条 Deliver 类记录。

Source

pub fn consumed( &self, event_type: &'static str, chain: &[ElementId], consumed_by: Option<ElementId>, )

追加一条 Consume 类记录:事件冒泡/定向投递后被谁消费了。

接收切片而不是 Vec:关闭时调用点不必先 clone 整条链。

Source

pub fn focus( &self, old: Option<ElementId>, new: Option<ElementId>, visible: Option<bool>, )

追加一条 Focus 类记录。

Source

pub fn gesture(&self, winner: Option<ElementId>, detail: impl Into<String>)

追加一条 Gesture 类记录(竞技场胜者 / reject)。

Source

pub fn hit_test(&self, target: Option<ElementId>, from_overlay: bool)

追加一条 HitTest 类记录。

Source

pub fn snapshot(&self, max: usize) -> Vec<EventRecord>

取最近 N 条快照(devtools 面板每 250ms 调一次)。取 all 留 0。 总闸关闭时返回空,避免面板关闭期间仍读到旧记录。

Source

pub fn clear(&self)

清空缓冲(切换窗口 / 焦点会话结束时用)。显式清空不受总闸与本地开关影响。

Trait Implementations§

Source§

impl Debug for EventLog

Source§

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

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

impl Default for EventLog

Source§

fn default() -> Self

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, 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.