pub struct ViewConfigBuilder { /* private fields */ }Expand description
Builder for the ViewConfig struct.
Implementations§
Source§impl ViewConfigBuilder
impl ViewConfigBuilder
Sourcepub fn is_accelerated(self, is_accelerated: bool) -> Self
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.
Sourcepub fn is_transparent(self, is_transparent: bool) -> Self
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
Sourcepub fn initial_device_scale(self, initial_device_scale: f64) -> Self
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
Sourcepub fn initial_focus(self, initial_focus: bool) -> Self
pub fn initial_focus(self, initial_focus: bool) -> Self
Whether or not the View should initially have input focus, View::focus.
default is false
Sourcepub fn enable_images(self, enable_images: bool) -> Self
pub fn enable_images(self, enable_images: bool) -> Self
Whether or not images should be enabled.
default is true
Sourcepub fn enable_javascript(self, enable_javascript: bool) -> Self
pub fn enable_javascript(self, enable_javascript: bool) -> Self
Whether or not JavaScript should be enabled.
default is true
Sourcepub fn font_family_standard(self, font_family_standard: &str) -> Self
pub fn font_family_standard(self, font_family_standard: &str) -> Self
Default font-family to use.
default is "Times New Roman"
Sourcepub fn font_family_fixed(self, font_family_fixed: &str) -> Self
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"
Sourcepub fn font_family_serif(self, font_family_serif: &str) -> Self
pub fn font_family_serif(self, font_family_serif: &str) -> Self
Default font-family to use for serif fonts.
default is "Times New Roman"
Sourcepub fn font_family_sans_serif(self, font_family_sans_serif: &str) -> Self
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"
Sourcepub fn user_agent(self, user_agent: &str) -> Self
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"
Sourcepub fn build(self, lib: Arc<Library>) -> Option<ViewConfig>
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.