[][src]Crate webview2

Rust bindings for WebView2.

The new Chromium based Edge browser (>= 82.0.430.0) need to be installed for this to actually work. Or the build method will return an error.

By default, this crate ships a copy of the WebView2Loader.dll file for the target platform. At runtime, this dll will be loaded from memory with the memory-module-sys library. License of the DLL file (part of the WebView2 SDK) is included in the Microsoft.Web.WebView2.0.9.430 folder. You can also use an external WebView2Loader.dll file.

There are high level, idiomatic Rust wrappers for most APIs. And there are bindings to almost all the raw COM APIs in the webview2-sys crate. You can use the as_raw methods to convert to raw COM objects and call all those methods. The callback macro can be helpful for implementing callbacks as COM objects.

Macros

callback

Returns a pointer that implements the COM callback interface with the specified closure. Inspired by C++ Microsoft::WRT::Callback.

Structs

AcceleratorKeyPressedEventArgs

ICoreWebView2AcceleratorKeyPressedEventArgs.

ContentLoadingEventArgs

ICoreWebView2ContentLoadingEventArgs.

Deferral

ICoreWebView2Deferral.

Environment

ICoreWebView2Environment.

EnvironmentBuilder

A builder for calling the CreateCoreWebView2EnvironmentWithDetails function.

Error

A webview2 error. Actually, an HRESULT.

EventRegistrationToken
Host

ICoreWebView2Host.

HttpHeadersCollectionIterator

ICoreWebView2HttpHeadersCollectionIterator.

HttpRequestHeaders

ICoreWebView2HttpRequestHeaders.

HttpResponseHeaders

ICoreWebView2HttpResponseHeaders.

MoveFocusRequestedEventArgs

ICoreWebView2MoveFocusRequestedEventArgs.

NavigationCompletedEventArgs

ICoreWebView2NavigationCompletedEventArgs.

NavigationStartingEventArgs

ICoreWebView2NavigationStartingEventArgs.

NewWindowRequestedEventArgs

ICoreWebView2NewWindowRequestedEventArgs.

PermissionRequestedEventArgs

ICoreWebView2PermissionRequestedEventArgs.

PhysicalKeyStatus

A structure representing the information packed into the LPARAM given to a Win32 key event. See the documentation for WM_KEYDOWN for details at https://docs.microsoft.com/windows/win32/inputdev/wm-keydown

ProcessFailedEventArgs

ICoreWebView2ProcessFailedEventArgs.

ScriptDialogOpeningEventArgs

ICoreWebView2ScriptDialogOpeningEventArgs.

Settings

ICoreWebView2Settings.

SourceChangedEventArgs

ICoreWebView2SourceChangedEventArgs.

Stream

IStream.

WebMessageReceivedEventArgs

ICoreWebView2WebMessageReceivedEventArgs.

WebResourceRequest

ICoreWebView2WebResourceRequest.

WebResourceRequestedEventArgs

ICoreWebView2WebResourceRequestedEventArgs.

WebResourceResponse

ICoreWebView2WebResourceResponse.

WebView

ICoreWebView2.

Enums

CapturePreviewImageFormat

Image format used by the ICoreWebView2::CapturePreview method.

KeyEventKind

The type of key event that triggered an AcceleratorKeyPressed event.

MoveFocusReason

Reason for moving focus.

PermissionKind

The type of a permission request.

PermissionState

Response to a permission request.

ProcessFailedKind

Kind of process failure used in the ICoreWebView2ProcessFailedEventHandler interface.

ScriptDialogKind

Kind of JavaScript dialog used in the ICoreWebView2ScriptDialogOpeningEventHandler interface.

WebErrorStatus

Error status values for web navigations.

WebResourceContext

Enum for web resource request contexts.

Functions

check_hresult

Check a HRESULT, if it is SUCCEEDED, return Ok(()). Otherwide return an error containing the HRESULT.

Type Definitions

Result