Skip to main content

Environment

Struct Environment 

Source
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

Source

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.

Source

pub fn with_options(options: &EnvironmentOptions) -> Result<Self>

Creates a WebView2 environment configured by options, pumping the UI thread.

Source

pub fn create_controller(&self, window: &Window) -> Result<Controller>

Creates a Controller hosted in the given window, pumping the UI thread.

Source

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.

Source

pub fn create_controller_with_options( &self, window: &Window, options: &ControllerOptions, ) -> Result<Controller>

Creates an option-configured Controller hosted in the given window.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.