ConfigBuilder

Struct ConfigBuilder 

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

Builder for the Config struct.

Implementations§

Source§

impl ConfigBuilder

Source

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

A writable OS file path to store persistent Session data in.

This data may include cookies, cached network resources, indexed DB, etc.

Files are only written to disk when using a persistent Session (see Renderer::create_session).

Source

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

The relative path to the resources folder (loaded via the FileSystem API). The library loads certain resources (SSL certs, ICU data, etc.) from the FileSystem API during runtime (eg, file:///resources/cacert.pem).

You can customize the relative file path to the resources folder by modifying this setting.

(Default = “resources/”)

Source

pub fn face_winding(self, winding: FaceWinding) -> Self

The winding order for front-facing triangles. (See FaceWinding)

Note: This is only used when the GPU renderer is enabled.

Source

pub fn font_hinting(self, hinting: FontHinting) -> Self

The hinting algorithm to use when rendering fonts. (See FontHinting)

Source

pub fn font_gamma(self, gamma: f64) -> Self

The gamma to use when compositing font glyphs, change this value to adjust contrast (Adobe and Apple prefer 1.8, others may prefer 2.2).

Source

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

Default user stylesheet. You should set this to your own custom CSS string to define default styles for various DOM elements, scrollbars, and platform input widgets.

Source

pub fn force_repaint(self, force: bool) -> Self

Whether or not we should continuously repaint any Views or compositor layers, regardless if they are dirty or not. This is mainly used to diagnose painting/shader issues.

(Default = false)

Source

pub fn animation_timer_delay(self, delay: f64) -> Self

When a CSS animation is active, the amount of time (in seconds) to wait before triggering another repaint.

(Default = 1.0 / 60.0)

Source

pub fn scroll_timer_delay(self, delay: f64) -> Self

When a smooth scroll animation is active, the amount of time (in seconds) to wait before triggering another repaint.

(Default = 1.0 / 60.0)

Source

pub fn recycle_delay(self, delay: f64) -> Self

The amount of time (in seconds) to wait before running the recycler (will attempt to return excess memory back to the system).

Source

pub fn memory_cache_size(self, size: u32) -> Self

The size of WebCore’s memory cache in bytes.

You should increase this if you anticipate handling pages with large resources, Safari typically uses 128+ MiB for its cache.

size is in bytes.

(Default = 64 * 1024 * 1024)

Source

pub fn page_cache_size(self, size: u32) -> Self

Number of pages to keep in the cache. Defaults to 0 (none).

Safari typically caches about 5 pages and maintains an on-disk cache to support typical web-browsing activities. If you increase this, you should probably increase the memory cache size as well.

Source

pub fn override_ram_size(self, size: u32) -> Self

The system’s physical RAM size in bytes.

JavaScriptCore tries to detect the system’s physical RAM size to set reasonable allocation limits. Set this to anything other than 0 to override the detected value. size is in bytes.

This can be used to force JavaScriptCore to be more conservative with its allocation strategy (at the cost of some performance).

Source

pub fn min_large_heap_size(self, size: u32) -> Self

The minimum size of large VM heaps in JavaScriptCore. Set this to a lower value to make these heaps start with a smaller initial value.

size is in bytes.

(Default = 32 * 1024 * 1024)

Source

pub fn min_small_heap_size(self, size: u32) -> Self

The minimum size of small VM heaps in JavaScriptCore. Set this to a lower value to make these heaps start with a smaller initial value.

size is in bytes.

(Default = 1 * 1024 * 1024)

Source

pub fn num_renderer_threads(self, threads: u32) -> Self

The number of threads to use in the Renderer (for parallel painting on the CPU, etc.).

You can set this to a certain number to limit the number of threads to spawn.

If this value is 0 (the default), the number of threads will be determined at runtime using the following formula:

max(PhysicalProcessorCount() - 1, 1)

Source

pub fn max_update_time(self, time: f64) -> Self

The max amount of time (in seconds) to allow repeating timers to run during each call to Renderer::update. The library will attempt to throttle timers and/or reschedule work if this time budget is exceeded.

(Default = 1.0 / 200.0)

Source

pub fn bitmap_alignment(self, alignment: u32) -> Self

Note that this is currently is useless in this library as we can’t get the bitmap from Surface when using CPU rendering.

The alignment (in bytes) of the BitmapSurface when using the CPU renderer.

The underlying bitmap associated with each BitmapSurface will have row_bytes padded to reach this alignment.

Aligning the bitmap helps improve performance when using the CPU renderer/ Determining the proper value to use depends on the CPU architecture and max SIMD instruction set used.

We generally target the 128-bit SSE2 instruction set across most PC platforms so ‘16’ is a default and safe value to use.

You can set this to ‘0’ to perform no padding (row_bytes will always be width * 4) at a slight cost to performance.

Source

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

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

Returns None if failed to create Config.

Trait Implementations§

Source§

impl Default for ConfigBuilder

Source§

fn default() -> ConfigBuilder

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.