pub struct Frame { /* private fields */ }Expand description
Frame 树节点。
持有 frame ID / name / URL / parent/children / ExecutionContext / page 弱引用。
@trace REQ-BAO-API-006 [class:Frame]
Implementations§
Source§impl Frame
impl Frame
Sourcepub fn new(id: impl Into<String>, is_main: bool, page: Weak<Page>) -> Frame
pub fn new(id: impl Into<String>, is_main: bool, page: Weak<Page>) -> Frame
构造 Frame。is_main=true 表示主 frame。
@trace REQ-BAO-API-006 [class:Frame]
Sourcepub fn is_main_frame(&self) -> bool
pub fn is_main_frame(&self) -> bool
是否主 frame。
@trace REQ-BAO-API-006 [class:Frame]
Sourcepub fn set_name(&self, name: impl Into<String>)
pub fn set_name(&self, name: impl Into<String>)
设置 Frame name(Page.frameNavigated 等事件填入)。
@trace REQ-BAO-API-006 [class:Frame]
Sourcepub fn set_url(&self, url: impl Into<String>)
pub fn set_url(&self, url: impl Into<String>)
设置 URL(frameNavigated 事件填入)。
@trace REQ-BAO-API-006 [class:Frame]
Sourcepub fn parent_frame(&self) -> Option<Rc<Frame>>
pub fn parent_frame(&self) -> Option<Rc<Frame>>
父 Frame(根 frame 返回 None)。
@trace REQ-BAO-API-006 [class:Frame]
Sourcepub fn add_child(&self, child: Rc<Frame>, self_ref: Weak<Frame>)
pub fn add_child(&self, child: Rc<Frame>, self_ref: Weak<Frame>)
添加子 Frame。同步设置 child 的 parent 为自身弱引用。
@trace REQ-BAO-API-006 [class:Frame]
Sourcepub fn remove_child(&self, child_id: &str)
pub fn remove_child(&self, child_id: &str)
移除子 Frame。
@trace REQ-BAO-API-006 [class:Frame]
Sourcepub fn child_frames(&self) -> Vec<Rc<Frame>>
pub fn child_frames(&self) -> Vec<Rc<Frame>>
子 Frame 列表(克隆,本地树)。
@trace REQ-BAO-API-006 [class:Frame]
Sourcepub fn execution_context(&self) -> Option<Rc<ExecutionContext>>
pub fn execution_context(&self) -> Option<Rc<ExecutionContext>>
所属 ExecutionContext(本地缓存)。
@trace REQ-BAO-API-006 [class:Frame]
Sourcepub fn set_execution_context(&self, ctx: Rc<ExecutionContext>)
pub fn set_execution_context(&self, ctx: Rc<ExecutionContext>)
设置 ExecutionContext(executionContextCreated 事件填入)。
@trace REQ-BAO-API-006 [class:Frame]
Sourcepub fn is_detached(&self) -> bool
pub fn is_detached(&self) -> bool
是否已 detached(本地标记)。
@trace REQ-BAO-API-006 [class:Frame]
Sourcepub fn set_detached(&self, detached: bool)
pub fn set_detached(&self, detached: bool)
标记 detached(frameDetached 事件填入)。
@trace REQ-BAO-API-006 [class:Frame]
Sourcepub fn page(&self) -> Option<Rc<Page>>
pub fn page(&self) -> Option<Rc<Page>>
所属 Page(Weak::upgrade 失败时返回 None)。
@trace REQ-BAO-API-006 [class:Frame]
Sourcepub fn events(&self) -> &Rc<EventEmitterInner>
pub fn events(&self) -> &Rc<EventEmitterInner>
EventEmitter inner 引用(供 Page 上层转发)。
@trace REQ-BAO-API-006 [class:Frame]
Trait Implementations§
Source§impl EventEmitter for Frame
impl EventEmitter for Frame
Source§fn on(&self, event: &str, handler: Arc<dyn Fn(&[Value])>) -> u64
fn on(&self, event: &str, handler: Arc<dyn Fn(&[Value])>) -> u64
Source§fn off(&self, event: &str, handler_id: u64) -> SubscriptionResult
fn off(&self, event: &str, handler_id: u64) -> SubscriptionResult
Source§fn remove_all_listeners(&self, event: Option<&str>)
fn remove_all_listeners(&self, event: Option<&str>)
event=None 时清空所有事件的所有 handler。Source§fn listener_count(&self, event: &str) -> usize
fn listener_count(&self, event: &str) -> usize
Auto Trait Implementations§
impl !Freeze for Frame
impl !RefUnwindSafe for Frame
impl !Send for Frame
impl !Sync for Frame
impl !UnwindSafe for Frame
impl Unpin for Frame
impl UnsafeUnpin for Frame
Blanket Implementations§
Source§impl<T> AsCtxPtr for Twhere
T: ?Sized,
impl<T> AsCtxPtr for Twhere
T: ?Sized,
Source§fn as_ctx_ptr(&self) -> *mut Selfwhere
Self: Sized,
fn as_ctx_ptr(&self) -> *mut Selfwhere
Self: Sized,
self’s address as *mut Self for deferred-task / scopeguard /
ref_guard ctx slots. The closures/trampolines deref it as shared
(&*p) — every method they reach is &self post-R-2, so no write
provenance is required; the *mut spelling is purely to match the
existing DerefOnDrop / HasAutoFlush / RefCount ABI.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
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
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 more