pub struct Environment(/* private fields */);Expand description
The WebView2 environment. Owns the user data folder and browser process and
creates Controller instances that host the browser in a window.
Implementations§
Source§impl Environment
impl Environment
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Creates the default WebView2 environment, pumping the UI thread until it is ready.
The calling thread is initialized as a COM STA if needed.
Sourcepub fn with_options(options: &EnvironmentOptions) -> Result<Self>
pub fn with_options(options: &EnvironmentOptions) -> Result<Self>
Creates a WebView2 environment configured by options, pumping the UI thread.
Sourcepub fn create_controller(&self, window: &Window) -> Result<Controller>
pub fn create_controller(&self, window: &Window) -> Result<Controller>
Creates a Controller hosted in the given window, pumping the UI thread.
Sourcepub unsafe fn create_controller_for_hwnd(
&self,
parent: *mut c_void,
) -> Result<Controller>
pub unsafe fn create_controller_for_hwnd( &self, parent: *mut c_void, ) -> Result<Controller>
Creates a Controller hosted in a raw window handle, pumping the UI thread.
§Safety
parent must be a valid window handle that outlives the controller.
Sourcepub fn create_controller_with_options(
&self,
window: &Window,
options: &ControllerOptions,
) -> Result<Controller>
pub fn create_controller_with_options( &self, window: &Window, options: &ControllerOptions, ) -> Result<Controller>
Creates an option-configured Controller hosted in the given window.
Sourcepub unsafe fn create_controller_with_options_for_hwnd(
&self,
parent: *mut c_void,
options: &ControllerOptions,
) -> Result<Controller>
pub unsafe fn create_controller_with_options_for_hwnd( &self, parent: *mut c_void, options: &ControllerOptions, ) -> Result<Controller>
Creates an option-configured Controller hosted in a raw window handle.
§Safety
parent must be a valid window handle that outlives the controller.