pub struct CDPRdpBridge { /* private fields */ }Expand description
CDPRdpBridge — servo RDP 桥接核心。
持有 Arc<dyn ServoBackend> 实现命令派发。
§使用
use bao_cdp_client::bridge::{CDPRdpBridge, MockServoBackend, ServoBackend};
use bao_cdp_client::transport::InMemoryBridge;
use bao_cdp_client::transport::InMemoryTransport;
use std::sync::Arc;
let backend: Arc<dyn ServoBackend> = Arc::new(MockServoBackend::new());
let bridge = CDPRdpBridge::new(backend);
let transport_bridge: Arc<dyn InMemoryBridge> = bridge.into_in_memory_bridge();
let _transport = InMemoryTransport::new(transport_bridge);@trace REQ-BAO-API-004 [level:library]
Implementations§
Source§impl CDPRdpBridge
impl CDPRdpBridge
Sourcepub fn new(backend: Arc<dyn ServoBackend>) -> CDPRdpBridge
pub fn new(backend: Arc<dyn ServoBackend>) -> CDPRdpBridge
构造 bridge。
@trace REQ-BAO-API-004 [level:library]
Sourcepub fn dispatch(
&self,
target_id: &str,
method: &str,
params: Value,
) -> Result<Value, BridgeError>
pub fn dispatch( &self, target_id: &str, method: &str, params: Value, ) -> Result<Value, BridgeError>
派发 CDP 命令。
§参数
target_id:目标 Page 标识(对应 session_id 或 targetId)method:CDP method 名(如Page.navigate)params:JSON 参数
@trace REQ-BAO-API-004 [level:library] @trace REQ-BAO-API-007 [level:library]
Sourcepub fn backend(&self) -> &dyn ServoBackend
pub fn backend(&self) -> &dyn ServoBackend
获取 backend 引用(供子模块/测试使用)。
Sourcepub fn into_in_memory_bridge(self) -> Arc<dyn InMemoryBridge> ⓘ
pub fn into_in_memory_bridge(self) -> Arc<dyn InMemoryBridge> ⓘ
把自身包装为 Arc<dyn InMemoryBridge>。
这是 InMemoryTransport 构造所需的类型。
@trace REQ-BAO-API-004 [level:library]
Trait Implementations§
Source§impl InMemoryBridge for CDPRdpBridge
impl InMemoryBridge for CDPRdpBridge
Source§fn dispatch_command(
&self,
method: &str,
params: Value,
session_id: Option<&str>,
) -> InMemoryBridgeResponse
fn dispatch_command( &self, method: &str, params: Value, session_id: Option<&str>, ) -> InMemoryBridgeResponse
派发 CDP 命令到 servo,同步返回响应。 Read more
Auto Trait Implementations§
impl !RefUnwindSafe for CDPRdpBridge
impl !UnwindSafe for CDPRdpBridge
impl Freeze for CDPRdpBridge
impl Send for CDPRdpBridge
impl Sync for CDPRdpBridge
impl Unpin for CDPRdpBridge
impl UnsafeUnpin for CDPRdpBridge
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
Mutably borrows from an owned value. Read more
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>
Creates a filterable data provider with the given name for debugging. Read more
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> ⓘ
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 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> ⓘ
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 moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert