ViewConfigBuilder

Struct ViewConfigBuilder 

Source
pub struct ViewConfigBuilder { /* private fields */ }
Expand description

Builder for the ViewConfig struct.

Implementations§

Source§

impl ViewConfigBuilder

Source

pub fn is_accelerated(self, is_accelerated: bool) -> Self

Whether to render using the GPU renderer (accelerated) or the CPU renderer (unaccelerated).

When true, the View will be rendered to an offscreen GPU texture using the GPU driver set in platform::set_gpu_driver. You can fetch details for the texture via View::render_target.

When false (the default), the View will be rendered to an offscreen pixel buffer using the multithreaded CPU renderer.

Source

pub fn is_transparent(self, is_transparent: bool) -> Self

Whether or not this View should support transparency.

Make sure to also set the following CSS on the page:

html, body { background: transparent; }

default is false

Source

pub fn initial_device_scale(self, initial_device_scale: f64) -> Self

The initial device scale, ie. the amount to scale page units to screen pixels. This should be set to the scaling factor of the device that the View is displayed on.

1.0 is equal to 100% zoom (no scaling), 2.0 is equal to 200% zoom (2x scaling)

default is 1.0

Source

pub fn initial_focus(self, initial_focus: bool) -> Self

Whether or not the View should initially have input focus, View::focus.

default is false

Source

pub fn enable_images(self, enable_images: bool) -> Self

Whether or not images should be enabled.

default is true

Source

pub fn enable_javascript(self, enable_javascript: bool) -> Self

Whether or not JavaScript should be enabled.

default is true

Source

pub fn font_family_standard(self, font_family_standard: &str) -> Self

Default font-family to use.

default is "Times New Roman"

Source

pub fn font_family_fixed(self, font_family_fixed: &str) -> Self

Default font-family to use for fixed fonts. (pre/code)

default is "Courier New"

Source

pub fn font_family_serif(self, font_family_serif: &str) -> Self

Default font-family to use for serif fonts.

default is "Times New Roman"

Source

pub fn font_family_sans_serif(self, font_family_sans_serif: &str) -> Self

Default font-family to use for sans-serif fonts.

default is "Arial"

Source

pub fn user_agent(self, user_agent: &str) -> Self

User-agent string to use.

default is "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/608.3.10 (KHTML, like Gecko) Ultralight/1.3.0 Safari/608.3.10"

Source

pub fn build(self, lib: Arc<Library>) -> Option<ViewConfig>

Builds the ViewConfig struct using the settings configured in this builder.

Returns None if failed to create ViewConfig.

Trait Implementations§

Source§

impl Default for ViewConfigBuilder

Source§

fn default() -> ViewConfigBuilder

Returns the “default value” for a type. Read more

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.