ConnectionLike

Trait ConnectionLike 

Source
pub trait ConnectionLike: Send + Sync {
    // Required methods
    fn send_message(
        &self,
        guid: &str,
        method: &str,
        params: Value,
    ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + '_>>;
    fn register_object(
        &self,
        guid: Arc<str>,
        object: Arc<dyn ChannelOwner>,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>;
    fn unregister_object(
        &self,
        guid: &str,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>;
    fn get_object(
        &self,
        guid: &str,
    ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ChannelOwner>>> + Send + '_>>;
}
Expand description

Trait defining the interface that ChannelOwner needs from a Connection

This trait allows ChannelOwner to work with Connection without needing to know the generic parameters W and R. The Connection struct implements this trait.

Required Methods§

Source

fn send_message( &self, guid: &str, method: &str, params: Value, ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + '_>>

Send a message to the Playwright server and await response

Source

fn register_object( &self, guid: Arc<str>, object: Arc<dyn ChannelOwner>, ) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>

Register an object in the connection’s registry

Source

fn unregister_object( &self, guid: &str, ) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>

Unregister an object from the connection’s registry

Source

fn get_object( &self, guid: &str, ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ChannelOwner>>> + Send + '_>>

Get an object by GUID

Implementors§

Source§

impl<W, R> ConnectionLike for Connection<W, R>
where W: AsyncWrite + Unpin + Send + Sync + 'static, R: AsyncRead + Unpin + Send + Sync + 'static,