pub struct ProtocolHandler { /* private fields */ }Expand description
Factory for creating a protocol handler for a specific webview.
This struct is NOT Send because it holds a reference to shared webview state.
Create the protocol handler on the main thread before spawning the app thread.
Implementations§
Source§impl ProtocolHandler
impl ProtocolHandler
Sourcepub fn handle_request<F, R>(
&self,
protocol: &str,
proxy: F,
request: &Request<Vec<u8>>,
responder: R,
) -> Option<R>
pub fn handle_request<F, R>( &self, protocol: &str, proxy: F, request: &Request<Vec<u8>>, responder: R, ) -> Option<R>
Create a protocol handler closure suitable for WebViewBuilder::with_asynchronous_custom_protocol.
The returned closure handles this subset of “{protocol}://” requests:
- “/wbg/initialized” - signals webview loaded
- “/wbg/snippets/{path}” - serves inline JS modules
- “/wbg/init.js” - serves the initialization script
- “/wbg/handler” - main IPC endpoint
§Arguments
protocol- The protocol scheme (e.g., “wry”)proxy- Function to send events to the event loop
Auto Trait Implementations§
impl Freeze for ProtocolHandler
impl !RefUnwindSafe for ProtocolHandler
impl !Send for ProtocolHandler
impl !Sync for ProtocolHandler
impl Unpin for ProtocolHandler
impl !UnwindSafe for ProtocolHandler
Blanket Implementations§
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