pub struct ElementHandle { /* private fields */ }Expand description
ElementHandle 本地状态(包装 JSHandle)。
注意:由于 Rust 没有“继承“,我们用“组合 + Deref“模式。
ElementHandle 内部持有 Rc<JSHandle>,通过显式 getter 暴露 JSHandle API。
@trace REQ-BAO-API-006 [class:ElementHandle]
Implementations§
Source§impl ElementHandle
impl ElementHandle
Sourcepub fn new(js: Rc<JSHandle>, owner_frame: Rc<Frame>) -> ElementHandle
pub fn new(js: Rc<JSHandle>, owner_frame: Rc<Frame>) -> ElementHandle
构造 ElementHandle。
@trace REQ-BAO-API-006 [class:ElementHandle]
Sourcepub fn as_js_handle(&self) -> &JSHandle
pub fn as_js_handle(&self) -> &JSHandle
引用内部 JSHandle(基类访问)。
@trace REQ-BAO-API-006 [class:ElementHandle]
Sourcepub fn as_element(&self) -> Option<&ElementHandle>
pub fn as_element(&self) -> Option<&ElementHandle>
类型 override。ElementHandle 返回 Some(&self)。
注:由于 ElementHandle 持有 JSHandle(而非相反方向),JSHandle.as_element
不能直接返回。调用方拿到 JSHandle 后,可通过 try_as_element 方法
或在 Page/Frame 上使用 ElementHandle 列表。
@trace REQ-BAO-API-006 [class:ElementHandle]
Sourcepub fn owner_frame(&self) -> Rc<Frame>
pub fn owner_frame(&self) -> Rc<Frame>
所属 Frame。
@trace REQ-BAO-API-006 [class:ElementHandle]
Sourcepub fn is_visible(&self) -> Option<bool>
pub fn is_visible(&self) -> Option<bool>
是否可见(本地缓存)。
@trace REQ-BAO-API-006 [class:ElementHandle]
Sourcepub fn set_visible(&self, v: bool)
pub fn set_visible(&self, v: bool)
设置 visible 缓存。
@trace REQ-BAO-API-006 [class:ElementHandle]
是否隐藏(本地缓存)。
@trace REQ-BAO-API-006 [class:ElementHandle]
Sourcepub fn is_enabled(&self) -> Option<bool>
pub fn is_enabled(&self) -> Option<bool>
是否启用(本地缓存)。
@trace REQ-BAO-API-006 [class:ElementHandle]
Sourcepub fn set_enabled(&self, e: bool)
pub fn set_enabled(&self, e: bool)
设置 enabled 缓存。
@trace REQ-BAO-API-006 [class:ElementHandle]
Sourcepub fn is_disabled(&self) -> Option<bool>
pub fn is_disabled(&self) -> Option<bool>
是否禁用(本地缓存)。
@trace REQ-BAO-API-006 [class:ElementHandle]
Sourcepub fn is_checked(&self) -> Option<bool>
pub fn is_checked(&self) -> Option<bool>
是否选中(checkbox/radio,本地缓存)。
@trace REQ-BAO-API-006 [class:ElementHandle]
Sourcepub fn set_checked(&self, c: bool)
pub fn set_checked(&self, c: bool)
设置 checked 缓存。
@trace REQ-BAO-API-006 [class:ElementHandle]
Sourcepub fn is_editable(&self) -> Option<bool>
pub fn is_editable(&self) -> Option<bool>
是否可编辑(本地缓存)。
@trace REQ-BAO-API-006 [class:ElementHandle]
Sourcepub fn set_editable(&self, e: bool)
pub fn set_editable(&self, e: bool)
设置 editable 缓存。
@trace REQ-BAO-API-006 [class:ElementHandle]
Sourcepub fn bounding_box(&self) -> Option<BoundingBox>
pub fn bounding_box(&self) -> Option<BoundingBox>
Bounding box(本地缓存)。
@trace REQ-BAO-API-006 [class:ElementHandle]
Sourcepub fn set_bounding_box(&self, b: BoundingBox)
pub fn set_bounding_box(&self, b: BoundingBox)
设置 bbox 缓存。
@trace REQ-BAO-API-006 [class:ElementHandle]
Sourcepub fn content_frame(&self) -> Option<Rc<Frame>>
pub fn content_frame(&self) -> Option<Rc<Frame>>
内容 frame(对 iframe element 有效,本地缓存)。
@trace REQ-BAO-API-006 [class:ElementHandle]
Sourcepub fn set_content_frame(&self, f: Rc<Frame>)
pub fn set_content_frame(&self, f: Rc<Frame>)
设置 content_frame 缓存。
@trace REQ-BAO-API-006 [class:ElementHandle]
Sourcepub fn scroll_into_view_needed(&self) -> bool
pub fn scroll_into_view_needed(&self) -> bool
是否需要 scroll into view(本地缓存)。
@trace REQ-BAO-API-006 [class:ElementHandle]
Sourcepub fn set_scroll_into_view_needed(&self, needed: bool)
pub fn set_scroll_into_view_needed(&self, needed: bool)
设置 scroll_into_view_needed。
@trace REQ-BAO-API-006 [class:ElementHandle]
Sourcepub fn is_disposed(&self) -> bool
pub fn is_disposed(&self) -> bool
是否已 dispose(委托 JSHandle)。
@trace REQ-BAO-API-006 [class:ElementHandle]
Sourcepub fn remote_object_id(&self) -> &str
pub fn remote_object_id(&self) -> &str
remote object ID(委托 JSHandle)。
@trace REQ-BAO-API-006 [class:ElementHandle]
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ElementHandle
impl !RefUnwindSafe for ElementHandle
impl !Send for ElementHandle
impl !Sync for ElementHandle
impl !UnwindSafe for ElementHandle
impl Unpin for ElementHandle
impl UnsafeUnpin for ElementHandle
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